:root {
    --primary: #10b981; /* Vibrant Green for Tea */
    --primary-dark: #059669;
    --bg-color: #0f172a; /* Dark sleek bg */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--bg-color);
    background-image: radial-gradient(circle at top right, #1e293b, #0f172a);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    max-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding: 20px 14px 30px 20px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    -webkit-overflow-scrolling: touch;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.sidebar h2 {
    color: var(--primary);
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 30px;
}

.nav-links li a {
    text-decoration: none;
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 8px;
    display: block;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-links li a:hover, .nav-links li a.active {
    background: var(--primary);
    color: #fff;
    transform: translateX(5px);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 20px;
    transition: margin 0.3s ease;
    width: calc(100% - var(--sidebar-width));
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
}

.topbar .lang-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.3s;
}

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

/* Marquee */
.marquee-container {
    width: 100%;
    overflow: hidden;
    padding: 10px 0;
    margin-bottom: 20px;
    color: var(--primary);
    font-weight: bold;
    letter-spacing: 1px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 20px;
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
}

/* Forms & Controls */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]), 
select, 
textarea {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 14px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.7);
    color: white;
    outline: none;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

button {
    font-family: inherit;
    outline: none;
}

button.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: #0f172a;
    border: none;
    font-weight: 700;
    padding: 11px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

button.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 15, 29, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

.sidebar-close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: #fff;
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0 !important;
}

/* Responsive Navigation & Breakpoints */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px !important;
        max-width: 85vw !important;
        z-index: 1000 !important;
        box-shadow: 5px 0 30px rgba(0, 0, 0, 0.7);
        overflow-y: auto;
    }
    .sidebar.open {
        transform: translateX(0) !important;
    }
    .sidebar-close-btn {
        display: inline-flex !important;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 12px 10px 40px !important;
    }
    .mobile-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 38px !important;
        height: 38px !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid var(--glass-border);
        color: #fff;
        font-size: 1.15rem;
        cursor: pointer;
        transition: background 0.2s;
    }
    .mobile-toggle:hover {
        background: rgba(255, 255, 255, 0.2);
    }
    .topbar {
        padding: 10px 14px;
        margin-bottom: 12px;
    }
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
        gap: 12px !important;
    }
    .stat-card {
        padding: 14px 10px !important;
    }
    .stat-card .value {
        font-size: 1.7rem !important;
    }
}

@media (min-width: 993px) {
    .mobile-toggle {
        display: none !important;
    }
    .sidebar {
        transform: translateX(0) !important;
    }
    .sidebar-close-btn {
        display: none !important;
    }
}

/* Leaf Type Badges & Pill Buttons */
.badge-grade-a {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
}
.badge-grade-b {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
}
.badge-grade-c {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
}

.leaf-type-btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: 2px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    user-select: none;
}
.leaf-type-btn:hover {
    border-color: var(--primary);
    color: #fff;
}
.leaf-type-btn.active {
    background: rgba(16, 185, 129, 0.25);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

/* Autocomplete suggestions */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid var(--primary);
    border-radius: 8px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: none;
}
.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s ease;
}
.autocomplete-item:hover, .autocomplete-item.selected {
    background: rgba(16, 185, 129, 0.25);
    color: #fff;
}

/* Tables styling */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
.data-table th {
    background: rgba(0, 0, 0, 0.3);
    color: var(--primary);
    padding: 12px;
    text-align: left;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--glass-border);
}
.data-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}
.data-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Tabs Navigation - Sleek, Space-Saving, Horizontal Scrollable */
.tabs-header, .tabs-nav-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 185, 129, 0.4) transparent;
}
.tabs-header::-webkit-scrollbar, .tabs-nav-bar::-webkit-scrollbar {
    height: 4px;
}
.tabs-header::-webkit-scrollbar-thumb, .tabs-nav-bar::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.4);
    border-radius: 4px;
}
.tab-btn {
    width: auto !important;
    margin-bottom: 0 !important;
    flex: 0 0 auto;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.tab-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}
.tab-btn.active {
    background: var(--primary) !important;
    color: #0f172a !important;
    border-color: var(--primary) !important;
    font-weight: 700;
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.35);
}

/* Responsive Two-Column Deduction Layout */
.deduction-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 992px) {
    .deduction-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .data-table th, .data-table td {
        padding: 8px 10px;
        font-size: 0.84rem;
    }
}

/* Month Filter Pills */
.month-selector-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    padding: 15px 20px;
}
.month-pills {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.month-pill-btn {
    padding: 8px 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--glass-border);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.month-pill-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--primary);
    color: #fff;
}
.month-pill-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

/* Month Input */
.month-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}
.month-input-wrapper input[type="month"] {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s;
}
.month-input-wrapper input[type="month"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

/* Progress bar for route share */
.route-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}
.route-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #34d399);
    border-radius: 4px;
}

/* Customer Printable Slip */
.supplier-statement-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 25px;
    margin-top: 20px;
}
.statement-header {
    border-bottom: 2px dashed rgba(255, 255, 255, 0.2);
    padding-bottom: 18px;
    margin-bottom: 20px;
}

/* Mobile Touch & Layout Enhancements */
@media (max-width: 768px) {
    .glass-panel {
        padding: 14px !important;
        border-radius: 12px !important;
    }
    .month-selector-bar {
        padding: 12px !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .month-pills {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
    }
    .month-input-wrapper {
        width: 100%;
        justify-content: space-between;
    }
    .month-input-wrapper input[type="month"] {
        flex: 1;
    }
    .supplier-statement-card {
        padding: 14px !important;
    }
    div[style*="overflow-x: auto"], .table-responsive {
        -webkit-overflow-scrolling: touch;
        margin-bottom: 10px;
    }
    .data-table {
        min-width: 540px;
    }
}

/* Print Stylesheet */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 11pt;
    }
    .sidebar,
    .topbar,
    .marquee-container,
    .tabs-header,
    .month-selector-bar,
    .no-print,
    .btn,
    .tab-btn,
    .month-pill-btn,
    .autocomplete-dropdown {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    .glass-panel, .supplier-statement-card {
        background: #fff !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        color: #000 !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 10px !important;
    }
    .data-table {
        width: 100% !important;
        color: #000 !important;
        border: 1px solid #333 !important;
    }
    .data-table th {
        background: #e2e8f0 !important;
        color: #000 !important;
        border: 1px solid #777 !important;
        font-weight: bold !important;
    }
    .data-table td {
        color: #000 !important;
        border: 1px solid #aaa !important;
        padding: 6px 8px !important;
    }
    .badge-grade-a, .badge-grade-b, .badge-grade-c {
        border: 1px solid #444 !important;
        color: #000 !important;
        background: #f1f5f9 !important;
        padding: 2px 5px !important;
    }
    .print-only {
        display: block !important;
    }
    .print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 15px;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
    }
    .print-header h2 {
        font-size: 18pt;
        margin-bottom: 4px;
        color: #000;
    }
    .print-header p {
        font-size: 11pt;
        color: #333;
    }
    .statement-signatures {
        display: flex !important;
        justify-content: space-between;
        margin-top: 50px;
        padding-top: 20px;
    }
    .sig-line {
        width: 200px;
        border-top: 1px dashed #000;
        text-align: center;
        padding-top: 5px;
        font-size: 10pt;
    }
}
