/* Olive Harvest Manager - Custom Styles */

:root {
    --primary: #6B8E23;
    --primary-dark: #556B2F;
    --primary-light: #9ACD32;
    --secondary: #8FBC8F;
    --background: #FAFAF9;
    --surface: #FFFFFF;
    --text: #1C1917;
    --text-muted: #78716C;
    --border: #E7E5E4;
    --success: #22C55E;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
}

/* Mobile Menu Toggle */
#mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#mobile-menu-toggle:hover {
    background: var(--primary-dark);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    cursor: pointer;
    transition: opacity 0.2s;
}

.sidebar-logo:hover {
    opacity: 0.8;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu-item {
    margin-bottom: 0.5rem;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
}

.sidebar-menu-link:hover {
    background: var(--background);
    color: var(--primary);
}

.sidebar-menu-link.active {
    background: var(--primary);
    color: white;
}

.sidebar-menu-icon {
    width: 20px;
    height: 20px;
}

.sidebar-menu-item.has-children {
    position: relative;
}

.sidebar-dropdown-toggle {
    justify-content: space-between;
}

.sidebar-caret {
    margin-left: auto;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.sidebar-menu-item.open .sidebar-caret {
    transform: rotate(180deg);
}

.sidebar-submenu {
    list-style: none;
    margin-top: 0.25rem;
    margin-left: 2.5rem;
    padding-left: 0;
    display: none;
}

.sidebar-submenu .sidebar-menu-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    margin-left: 280px;
    padding: 2rem;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    /* margin-bottom: 0.5rem; */
}

.page-description {
    color: var(--text-muted);
    font-size: 1rem;
}

.analytics-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2e3a17;
    margin-bottom: 0.35rem;
}

.analytics-description {
    font-size: 1rem;
    color: #7c8761;
}

.analytics-card {
    border-radius: 18px;
    border-color: rgba(110, 138, 64, 0.25);
}

.analytics-card-header {
    margin-bottom: 0.75rem;
}

.analytics-card-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: #374218;
    margin-bottom: 0.15rem;
}

.analytics-card-subtitle {
    font-size: 0.95rem;
    color: #8c966f;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.analytics-card-header--with-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.analytics-card-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.analytics-card-controls label {
    font-size: 0.8rem;
    color: #7a8455;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.analytics-card-controls select {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(110, 138, 64, 0.3);
    background: #f8faf3;
    color: #3a3d28;
    font-weight: 500;
    min-width: 180px;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    /*margin-bottom: 0.25rem;*/
}

.card-description {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.5rem;
}

.stat-header {
    /*display: flex;*/
    /*justify-content: space-between;*/
    /*align-items: center;*/
    /*margin-bottom: 0rem;*/
    display: flex;
    justify-content: flex-end;
    align-items: normal;
    margin-bottom: 0rem;
    flex-direction: row-reverse;
}

.stat-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
}

.stat-icon {
    width: 20px;
    height: 20px;
    margin-right: 5px;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    /* margin-bottom: 0.25rem; */
}

.stat-value.success {
    color: var(--success);
}

.stat-value.danger {
    color: var(--danger);
}

.stat-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--background);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--background);
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
    background: var(--background);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-dialog {
    background: var(--surface);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 2.5rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
    font-size: 2rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Mobile Styles */
@media (max-width: 768px) {
    /* Mobile Header */
    .mobile-navbar {
        display: flex;
    }
    
    #mobile-menu-toggle {
        display: flex;
        position: static;
        background: transparent;
        box-shadow: none;
        padding: 0.5rem;
    }
    
    #mobile-menu-toggle:hover {
        background: rgba(255, 255, 255, 0.1);
    }   
    .sidebar {
        transform: translateX(-100%);
        background: #FFFFFF;
        box-shadow: none;
    }
    
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 2px 0 20px rgba(0,0,0,0.3);
        background: #FFFFFF;
    }
    
    .sidebar-header {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 80px; /* 64px navbar + 16px spacing */
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-dialog {
        width: 95%;
    }
    
    .table-responsive {
        overflow-x: auto;
    }
    
    /* Responsive Charts */
    .chart-container {
        position: relative;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden;
    }
    
    .chart-container canvas {
        max-width: 100% !important;
        height: auto !important;
    }
    
    #page-content {
        overflow-x: hidden;
    }
    
    .card {
        overflow-x: hidden;
    }
    
    /* Remove card styling when it contains table-responsive */
    .card:has(.table-responsive) {
        padding: 0;
        border: none;
        background: transparent;
        margin-bottom: 0;
        border-radius: 0;
    }
    
    /* Hide tables on mobile */
    .table-responsive .table {
        display: none;
    }
    
    /* Mobile Card Layout */
    .mobile-card {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .mobile-card-header {
        font-weight: 600;
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 2px solid var(--primary);
        color: var(--primary);
    }
    
    .mobile-card-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.625rem 0;
        border-bottom: 1px solid var(--border);
    }
    
    .mobile-card-row:last-of-type {
        border-bottom: none;
    }
    
    .mobile-card-label {
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.875rem;
        flex-shrink: 0;
        margin-right: 1rem;
    }
    
    .mobile-card-value {
        text-align: right;
        font-size: 0.875rem;
        color: var(--text);
        word-break: break-word;
    }
    
    .mobile-card-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border);
    }
    
    .mobile-card-actions .btn {
        flex: 1;
        font-size: 0.875rem;
        padding: 0.5rem;
    }
    
    /* Page title on mobile */
    .page-title {
        font-size: 1.5rem;
    }
    
    /* Add buttons - show only white "+" on mobile */
    .page-header .btn-primary {
        font-size: 0;
        padding: 0.625rem;
        min-width: 40px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
    }
    
    .page-header .btn-primary::before {
        content: '+';
        font-size: 1.5rem;
        color: white;
        font-weight: 300;
        line-height: 1;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden { display: none !important; }
/* Mobile Navbar - New Design */
.mobile-navbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 999;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.mobile-navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-navbar-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    cursor: pointer;
    transition: opacity 0.2s;
}

.mobile-navbar-logo:hover {
    opacity: 0.8;
}

.mobile-navbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.mobile-navbar-burger {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 0;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-navbar-burger:hover {
    background: var(--background);
}

.mobile-navbar-burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-navbar-burger:active span {
    background: var(--primary-dark);
}

@media (max-width: 768px) {
    .mobile-navbar {
        display: flex;
    }
    
    .main-content {
        padding-top: 80px; /* 64px navbar + 16px spacing */
    }
}
