/* =========================================================
   LeMatrix Admin — Shared Design System
   Font: Plus Jakarta Sans (Google Fonts)
   ========================================================= */

/* ── Variables ── */
:root {
    /* Brand */
    --primary:        #2563eb;
    --primary-dark:   #1e40af;
    --primary-light:  #dbeafe;
    --primary-hover:  #1d4ed8;

    /* Semantic */
    --success:  #059669;
    --warning:  #d97706;
    --danger:   #dc2626;
    --info:     #0891b2;

    /* Grays */
    --gray-50:  #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Layout */
    --sidebar-w:    260px;
    --sidebar-bg:   #0f172a;
    --sidebar-sec:  #1e293b;
    --sidebar-hover:#334155;
    --header-h:     76px;
    --main-bg:      #f1f5f9;
    --card-bg:      #ffffff;
    --radius-sm:    8px;
    --radius-md:    14px;
    --radius-lg:    20px;
    --radius-xl:    28px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:    0 4px 12px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
    --shadow-lg:    0 10px 30px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.06);

    /* Typography */
    --font:         'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --fs-xs:   0.72rem;
    --fs-sm:   0.82rem;
    --fs-base: 0.92rem;
    --fs-md:   1rem;
    --fs-lg:   1.15rem;
    --fs-xl:   1.4rem;
    --fs-2xl:  1.75rem;
    --fs-3xl:  2.25rem;
    --fw-normal: 400;
    --fw-medium: 500;
    --fw-semi:   600;
    --fw-bold:   700;
    --fw-black:  800;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--main-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Sidebar ── */
.admin-sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255,255,255,.06);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: transform .25s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 1.5rem 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

.logo-section { display: flex; align-items: center; gap: 12px; }

.logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

.logo-text h5 {
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
    color: #fff;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -.01em;
}

.logo-text small {
    font-size: var(--fs-xs);
    color: var(--gray-400);
    font-weight: var(--fw-medium);
    letter-spacing: .03em;
    text-transform: uppercase;
}

.sidebar-content { flex: 1; padding: 1.25rem 1rem; }

.nav-section { margin-bottom: 1.75rem; }

.nav-title {
    font-size: 0.65rem;
    font-weight: var(--fw-bold);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gray-500);
    padding: 0 .75rem;
    margin-bottom: .6rem;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: .62rem .75rem;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    text-decoration: none;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    transition: all .18s ease;
    white-space: nowrap;
}

.admin-nav-link i { width: 18px; text-align: center; font-size: .9rem; flex-shrink: 0; }

.admin-nav-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.admin-nav-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-weight: var(--fw-semi);
    box-shadow: 0 3px 10px rgba(37,99,235,.3);
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

/* ── Main content ── */
.admin-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Top header ── */
.admin-header {
    background: var(--card-bg);
    height: var(--header-h);
    padding: 0 2rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.admin-header h1,
.admin-header .page-title {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--gray-900);
    margin: 0;
    letter-spacing: -.02em;
}

.admin-header .breadcrumb-text {
    font-size: var(--fs-xs);
    color: var(--gray-400);
    margin-top: 2px;
}

.admin-header .breadcrumb-text a {
    color: var(--gray-400);
    text-decoration: none;
}

.admin-header .breadcrumb-text a:hover { color: var(--primary); }

/* ── Cards ── */
.admin-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.glass-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

/* ── Stat cards ── */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.5rem;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-number {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-black);
    letter-spacing: -.04em;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: .3rem;
}

.stat-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--gray-500);
}

.stat-icon {
    position: absolute;
    bottom: 1rem; right: 1.25rem;
    font-size: 2.4rem;
    color: var(--primary);
    opacity: .08;
}

/* ── Tables ── */
.table {
    font-size: var(--fs-sm);
    color: var(--gray-700);
}

.table thead th {
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
    padding: .75rem 1rem;
    background: var(--gray-50);
    white-space: nowrap;
}

.table tbody td {
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--gray-50); }

/* ── Buttons ── */
.btn {
    font-family: var(--font);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    border-radius: var(--radius-sm);
    padding: .5rem 1.1rem;
    transition: all .18s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-dark) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(220,38,38,.2);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(220,38,38,.35);
    color: #fff;
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover { background: var(--gray-200); color: var(--gray-800); }

.btn-outline-success {
    border: 1.5px solid var(--success);
    color: var(--success);
    background: transparent;
}

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

.btn-sm { padding: .35rem .8rem; font-size: var(--fs-xs); }
.btn-lg { padding: .7rem 1.5rem; font-size: var(--fs-md); border-radius: var(--radius-md); }

/* ── Forms ── */
.form-label {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    color: var(--gray-700);
    margin-bottom: .4rem;
}

.form-control, .form-select {
    font-family: var(--font);
    font-size: var(--fs-sm);
    color: var(--gray-800);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: .55rem .9rem;
    background: var(--card-bg);
    transition: border-color .18s, box-shadow .18s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    outline: none;
}

.form-text {
    font-size: var(--fs-xs);
    color: var(--gray-400);
    margin-top: .3rem;
}

/* ── Badges ── */
.badge {
    font-family: var(--font);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semi);
    letter-spacing: .02em;
    padding: .3rem .7rem;
    border-radius: 20px;
}

.badge-status {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semi);
    padding: .3rem .85rem;
    border-radius: 20px;
    letter-spacing: .02em;
}

.badge-pending   { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-processed { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-completed { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-active    { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-inactive  { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-300); }

/* ── Alerts ── */
.alert {
    font-family: var(--font);
    font-size: var(--fs-sm);
    border-radius: var(--radius-md);
    border: none;
    padding: .85rem 1.1rem;
}

/* ── Modal ── */
.modal-content {
    border-radius: var(--radius-xl);
    border: none;
    box-shadow: var(--shadow-lg);
    font-family: var(--font);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.modal-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    color: var(--gray-900);
}

.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-100); }

/* ── Filter section ── */
.filter-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

/* ── Section header utility ── */
.section-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    color: var(--gray-900);
    letter-spacing: -.02em;
    margin-bottom: .25rem;
}

.section-subtitle {
    font-size: var(--fs-sm);
    color: var(--gray-400);
}

/* ── Dropdown ── */
.dropdown-menu {
    font-family: var(--font);
    font-size: var(--fs-sm);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    padding: .4rem;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: .5rem .85rem;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--gray-700);
    transition: background .15s;
}

.dropdown-item:hover { background: var(--gray-50); color: var(--gray-900); }

/* ── User profile in sidebar footer ── */
.user-profile { display: flex; align-items: center; gap: 10px; }

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: .85rem;
    flex-shrink: 0;
}

.user-name  { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: #e2e8f0; line-height: 1.2; }
.user-role  { font-size: var(--fs-xs); color: var(--gray-500); }

/* ── Headings ── */
h1,h2,h3,h4,h5,h6 {
    font-family: var(--font);
    font-weight: var(--fw-bold);
    letter-spacing: -.02em;
    color: var(--gray-900);
}

/* ── Quick action button (dashboard) ── */
.quick-action-btn {
    padding: 1rem;
    border-radius: var(--radius-lg);
    background: var(--gray-100);
    text-align: center;
    transition: all .2s;
    text-decoration: none;
    display: block;
    border: 1.5px solid var(--gray-200);
    color: var(--gray-700);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    cursor: pointer;
}

.quick-action-btn:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary);
    transform: scale(.98);
    box-shadow: 0 4px 12px rgba(37,99,235,.12);
}

/* =========================================================
   Responsive — Mobile-first breakpoints
   ========================================================= */

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1040;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ── Hamburger toggle button ── */
.sidebar-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    background: var(--gray-100);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    color: var(--gray-700);
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .18s, color .18s;
    margin-right: .75rem;
}
.sidebar-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* ── Tablet (≤992px) ── */
@media (max-width: 992px) {
    /* Sidebar slides off-screen by default, slides in when .open */
    .admin-sidebar {
        transform: translateX(-100%);
        z-index: 1050;
        box-shadow: 4px 0 24px rgba(0,0,0,.25);
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }

    /* Content takes full width */
    .admin-content {
        margin-left: 0;
    }

    /* Show hamburger */
    .sidebar-toggle-btn {
        display: flex;
    }

    /* Header layout */
    .admin-header {
        height: auto;
        min-height: var(--header-h);
        padding: .75rem 1.25rem;
        flex-wrap: wrap;
        gap: .5rem;
    }

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

    /* Filter row stacks */
    .filter-section .row { --bs-gutter-y: .75rem; }
}

/* ── Mobile (≤768px) ── */
@media (max-width: 768px) {
    .admin-header h1,
    .admin-header .page-title {
        font-size: var(--fs-lg);
    }

    /* Main padding tighter */
    .admin-content main,
    .admin-content .p-4 {
        padding: 1rem !important;
    }

    /* Stat cards 2-col */
    .stat-card { margin-bottom: .75rem; }

    /* Modal full screen */
    .modal-dialog {
        margin: .5rem;
        max-width: calc(100% - 1rem);
    }
    .modal-content { border-radius: var(--radius-lg); }
}

/* ── Small mobile (≤576px) ── */
@media (max-width: 576px) {
    .stat-number { font-size: var(--fs-2xl); }

    /* Header actions wrap */
    .admin-header { gap: .4rem; }

    /* Buttons shrink */
    .btn.rounded-pill { padding: .4rem .85rem; font-size: var(--fs-xs); }

    /* Tables smaller font */
    .table { font-size: var(--fs-xs); }
    .table thead th,
    .table tbody td { padding: .55rem .65rem; }

    /* Badges compact */
    .badge-status { padding: .2rem .55rem; font-size: 0.65rem; }

    /* Modal */
    .modal-dialog { margin: .25rem; }

    /* Glass card padding */
    .glass-card, .admin-card { padding: 1rem; }
}
