:root {
    --primary: #f5c400;
    --primary-dark: #d4a900;
    --dark: #111111;
    --dark2: #1c1c1c;
    --dark3: #2a2a2a;
    --gray: #6c757d;
    --light-gray: #f8f9fa;
    --white: #ffffff;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --info: #2980b9;
    --sidebar-width: 250px;
    --font: 'Inter', 'Segoe UI', sans-serif;
}

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

body {
    font-family: var(--font);
    background: #f0f2f5;
    color: #333;
    font-size: 14px;
}

/* ── LOGIN PAGE ── */
.login-page {
    min-height: 100vh;
    background: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: var(--dark2);
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    border: 1px solid #333;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    padding: 4px;
}

.login-logo h1 {
    color: var(--white);
    font-size: 22px;
    font-weight: 700;
    margin-top: 12px;
}

.login-logo p {
    color: var(--gray);
    font-size: 13px;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    color: #aaa;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: var(--dark3);
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    color: var(--white);
    padding: 11px 14px;
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245,196,0,0.15);
}

.form-control::placeholder { color: #999; }

select.form-control option { background: var(--dark3); }

/* ── Light inputs inside main page content (cards are white) ── */
.page-content .form-control,
.main-content .form-control {
    background: #ffffff !important;
    border: 1px solid #d0d5dd !important;
    color: #1a1a1a !important;
}
.page-content .form-control:focus,
.main-content .form-control:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(245,196,0,0.15) !important;
}
.page-content .form-control::placeholder,
.main-content .form-control::placeholder { color: #9ca3af !important; }
.page-content select.form-control option,
.main-content select.form-control option { background: #ffffff !important; color: #1a1a1a !important; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1;
}

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

.btn-secondary {
    background: #e9ecef;
    color: #333;
}
.btn-secondary:hover { background: #dee2e6; }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #c0392b; }

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover { background: #219a52; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 13px;
    font-weight: 500;
}
.alert-danger { background: rgba(231,76,60,0.15); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }
.alert-success { background: rgba(39,174,96,0.15); color: #27ae60; border: 1px solid rgba(39,174,96,0.3); }
.alert-warning { background: rgba(243,156,18,0.15); color: #f39c12; border: 1px solid rgba(243,156,18,0.3); }
.alert-info { background: rgba(41,128,185,0.15); color: #2980b9; border: 1px solid rgba(41,128,185,0.3); }

/* ── LAYOUT ── */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: var(--white);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid #222;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .brand-icon {
    width: 38px;
    height: 38px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
    color: var(--dark);
    flex-shrink: 0;
}

.sidebar-brand .brand-text h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
    line-height: 1.2;
}

.sidebar-brand .brand-text p {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.sidebar-user {
    padding: 14px 20px;
    background: #181818;
    border-bottom: 1px solid #222;
}

.sidebar-user .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
}

.sidebar-user .user-role {
    font-size: 11px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.nav-section-title {
    padding: 10px 20px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #555;
    font-weight: 700;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #aaa;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-item a:hover,
.nav-item a.active {
    color: var(--white);
    background: rgba(245,196,0,0.08);
    border-left-color: var(--primary);
}

.nav-item a .nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #222;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #888;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.15s;
}

.sidebar-footer a:hover { color: var(--danger); }

/* ── MAIN CONTENT ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--white);
    padding: 14px 28px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
}

.topbar-title p {
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-content {
    padding: 28px;
    flex: 1;
}

/* ── CARDS ── */
.card {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
}

.card-body {
    padding: 20px;
}

/* ── STATS GRID ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.yellow { background: rgba(245,196,0,0.15); }
.stat-icon.green { background: rgba(39,174,96,0.15); }
.stat-icon.blue { background: rgba(41,128,185,0.15); }
.stat-icon.red { background: rgba(231,76,60,0.15); }
.stat-icon.orange { background: rgba(243,156,18,0.15); }

.stat-info .stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1;
}

.stat-info .stat-label {
    font-size: 12px;
    color: var(--gray);
    margin-top: 4px;
    font-weight: 500;
}

/* ── TABLE ── */
.table-responsive {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #bbb #f0f0f0;
    -webkit-overflow-scrolling: touch;
}
/* Always-visible scrollbar for WebKit (macOS/Chrome/Safari) */
.table-responsive::-webkit-scrollbar { height: 10px; display: block; }
.table-responsive::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 5px; }
.table-responsive::-webkit-scrollbar-thumb { background: #bbb; border-radius: 5px; min-width: 40px; }
.table-responsive::-webkit-scrollbar-thumb:hover { background: #888; }

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

table th {
    background: #f8f9fa;
    padding: 11px 14px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray);
    font-weight: 700;
    border-bottom: 1px solid #e9ecef;
    border-right: 1px solid #e9ecef;
    position: relative;
    white-space: nowrap;
}
table th:last-child { border-right: none; }

/* Column resize handle — visible line between columns */
table th .col-resize {
    position: absolute;
    right: -1px;
    top: 4px;
    bottom: 4px;
    width: 3px;
    cursor: col-resize;
    user-select: none;
    z-index: 1;
    border-radius: 2px;
    background: #ddd;
    transition: background .15s;
}
table th .col-resize:hover, table th .col-resize.active { background: var(--primary); width: 4px; right: -2px; }

table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f5f5f5;
    border-right: 1px solid #f0f1f3;
    font-size: 13px;
    color: #444;
    vertical-align: middle;
    white-space: nowrap;
}
table td:last-child { border-right: none; }

table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #fafafa; }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-success { background: rgba(39,174,96,0.15); color: #27ae60; }
.badge-danger { background: rgba(231,76,60,0.15); color: #e74c3c; }
.badge-warning { background: rgba(243,156,18,0.15); color: #e67e22; }
.badge-info { background: rgba(41,128,185,0.15); color: #2980b9; }
.badge-gray { background: #f0f0f0; color: #666; }
.badge-yellow { background: rgba(245,196,0,0.2); color: #b38800; }

/* ── FORMS ── */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-group-light label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.form-control-light {
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    color: #333;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.form-control-light:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245,196,0,0.15);
}

textarea.form-control-light { resize: vertical; min-height: 80px; }

/* ── SEARCH BAR ── */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 14px;
    outline: none;
}

.search-bar input:focus { border-color: var(--primary); }

/* ── PAGINATION ── */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.pagination-info { font-size: 12px; color: var(--gray); }
.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
}

.pagination a, .pagination span {
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid #dee2e6;
    color: #555;
}
.pagination .ellipsis { border: none; color: #999; padding: 7px 6px; }

.pagination a:hover { background: #f0f0f0; }
.pagination span.active { background: var(--primary); color: var(--dark); border-color: var(--primary); font-weight: 700; }

.per-page-select { padding: 5px 8px; border-radius: 6px; border: 1px solid #dee2e6; font-size: 12px; color: #555; background: #fff; cursor: pointer; font-family: var(--font); }
.per-page-select:focus { border-color: var(--primary); outline: none; }

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: #555; }
.empty-state p { font-size: 13px; margin-top: 6px; }

/* ── MOBILE HAMBURGER ── */
.mobile-hamburger {
    display: none;          /* hidden on desktop */
    position: absolute;
    top: 14px;
    left: 12px;
    z-index: 60;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}
.mobile-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--dark);
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
/* X state when sidebar open */
body.sidebar-visible .mobile-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.sidebar-visible .mobile-hamburger span:nth-child(2) { opacity: 0; }
body.sidebar-visible .mobile-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── SIDEBAR OVERLAY ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99;           /* below sidebar (100), above content */
    opacity: 0;
    transition: opacity .25s;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    /* Sidebar: hidden by default, slide-in when toggled */
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Main content: no left margin */
    .main-content {
        margin-left: 0;
        position: relative;     /* for hamburger absolute positioning */
    }

    /* Show hamburger */
    .mobile-hamburger { display: flex; }

    /* Topbar: accommodate hamburger + stack on very small screens */
    .topbar {
        padding: 12px 14px 12px 52px;   /* left space for hamburger */
        flex-wrap: wrap;
        gap: 8px;
    }
    .topbar-title h1 { font-size: 16px; }
    .topbar-title p { font-size: 11px; }
    .topbar-actions {
        gap: 8px;
        flex-wrap: wrap;
    }
    .topbar-actions .btn { font-size: 12px; padding: 6px 10px; }

    /* Cards and grids */
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 14px; }

    /* Tables: horizontal scroll */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 600px; }

    /* Forms: single column on narrow screens */
    .card { margin-left: 0 !important; margin-right: 0 !important; }
}

/* Extra-small phones */
@media (max-width: 420px) {
    .topbar {
        padding: 10px 10px 10px 48px;
    }
    .topbar-title h1 { font-size: 15px; }
    .stats-grid { grid-template-columns: 1fr; }
    .topbar-actions .btn { font-size: 11px; padding: 5px 8px; }
}
