/* ============================================================
   PharmaCore Pro - Main Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:wght@300;400;500;600;700&display=swap');

/* ============ CSS Variables ============ */
:root {
    --primary:        #1a6bff;
    --primary-dark:   #0050d8;
    --primary-light:  #e8f0ff;
    --secondary:      #6366f1;
    --success:        #10b981;
    --warning:        #f59e0b;
    --danger:         #ef4444;
    --info:           #06b6d4;

    --bg-body:        #f0f4ff;
    --bg-card:        #ffffff;
    --bg-sidebar:     #0f172a;
    --bg-topbar:      #ffffff;

    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;
    --text-inverse:   #ffffff;

    --border:         #e2e8f0;
    --border-light:   #f1f5f9;
    --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow:         0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.05);
    --shadow-xl:      0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);
    --radius-sm:      6px;
    --radius:         10px;
    --radius-lg:      16px;
    --radius-xl:      24px;

    --sidebar-width:  260px;
    --sidebar-collapsed: 72px;
    --topbar-height:  64px;
    --font-main:      'DM Sans', sans-serif;
    --font-display:   'Syne', sans-serif;

    --transition:     all 0.25s cubic-bezier(.4,0,.2,1);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-body:        #060d1e;
    --bg-card:        #0f1c33;
    --bg-sidebar:     #060d1e;
    --bg-topbar:      #0f1c33;
    --text-primary:   #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted:     #475569;
    --border:         #1e2d47;
    --border-light:   #162035;
    --shadow-sm:      0 1px 3px rgba(0,0,0,.3);
    --shadow:         0 4px 6px -1px rgba(0,0,0,.35);
    --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.4);
    --primary-light:  rgba(26,107,255,0.12);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; }

/* ============ Scrollbar ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ LAYOUT ============ */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    overflow: hidden;
    border-right: 1px solid rgba(255,255,255,.04);
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.main-content.expanded { margin-left: var(--sidebar-collapsed); }

/* ============ SIDEBAR BRAND ============ */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    min-height: 70px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(26,107,255,.4);
}

.brand-text { overflow: hidden; }
.brand-name {
    display: block;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 16px;
    color: #fff;
    letter-spacing: -.3px;
    white-space: nowrap;
}

.brand-tagline {
    display: block;
    font-size: 10px;
    color: rgba(255,255,255,.45);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    white-space: nowrap;
}

.sidebar-toggle-btn {
    background: rgba(255,255,255,.06);
    border: none;
    color: rgba(255,255,255,.6);
    width: 28px; height: 28px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar.collapsed .sidebar-toggle-btn i { transform: rotate(180deg); }

/* ============ SIDEBAR USER ============ */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    overflow: hidden;
}

.user-avatar-wrap { position: relative; flex-shrink: 0; }
.user-avatar-img {
    width: 38px; height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.15);
}

.status-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    position: absolute;
    bottom: 1px; right: 0;
    border: 2px solid var(--bg-sidebar);
}
.status-dot.online { background: var(--success); }

.user-info { overflow: hidden; min-width: 0; }
.user-name {
    display: block;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    font-size: 10px;
    background: rgba(26,107,255,.25);
    color: #7aadff;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
}

/* ============ SIDEBAR NAV ============ */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
}

.nav-list { list-style: none; padding: 0 10px; }

.nav-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,.25);
    padding: 12px 10px 4px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-label { opacity: 0; }

.nav-item { margin: 2px 0; }

.nav-item .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: var(--radius);
    color: rgba(255,255,255,.55);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.nav-item .nav-link:hover {
    background: rgba(255,255,255,.07);
    color: rgba(255,255,255,.9);
}

.nav-item.active .nav-link {
    background: linear-gradient(135deg, rgba(26,107,255,.25), rgba(99,102,241,.15));
    color: #fff;
    box-shadow: 0 2px 8px rgba(26,107,255,.2);
}

.nav-item.active .nav-link::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    border-radius: 8px;
    flex-shrink: 0;
    background: rgba(255,255,255,.06);
    transition: var(--transition);
}

.nav-item.active .nav-icon {
    background: rgba(26,107,255,.3);
    color: #7aadff;
}

.nav-text { flex: 1; }

.nav-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 20px;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-badge { display: none; }

.sidebar.collapsed .nav-item .nav-link { padding: 10px; justify-content: center; }
.sidebar.collapsed .nav-icon { width: 40px; height: 40px; font-size: 20px; }

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.06);
    text-align: center;
}

.sidebar-version {
    font-size: 11px;
    color: rgba(255,255,255,.2);
}

/* ============ TOPBAR ============ */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-sm);
}

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

.topbar-menu-btn {
    background: none; border: none;
    font-size: 22px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
    display: flex; align-items: center;
}
.topbar-menu-btn:hover { background: var(--border-light); color: var(--text-primary); }

.topbar-breadcrumb {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex; align-items: center; gap: 6px;
}

.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.topbar-btn {
    width: 38px; height: 38px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 17px;
    transition: var(--transition);
    position: relative;
}

.topbar-btn:hover { background: var(--bg-body); color: var(--text-primary); }

.btn-pos {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}
.btn-pos:hover { background: var(--primary-dark) !important; }

.notification-badge {
    position: absolute;
    top: -4px; right: -4px;
    width: 18px; height: 18px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-topbar);
}

/* Notification Dropdown */
.notification-dropdown {
    width: 360px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    background: var(--bg-card);
    overflow: hidden;
}

.dropdown-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.notification-list { max-height: 340px; overflow-y: auto; }

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
    cursor: pointer;
    color: var(--text-primary);
}

.notification-item:hover { background: var(--bg-body); }

.notif-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.notification-item.type-warning .notif-icon { background: rgba(245,158,11,.12); color: var(--warning); }
.notification-item.type-danger .notif-icon { background: rgba(239,68,68,.12); color: var(--danger); }
.notification-item.type-success .notif-icon { background: rgba(16,185,129,.12); color: var(--success); }
.notification-item.type-info .notif-icon { background: rgba(6,182,212,.12); color: var(--info); }

.notif-title { font-size: 13px; font-weight: 600; }
.notif-msg { font-size: 12px; color: var(--text-secondary); }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.notification-empty {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 28px;
}
.notification-empty p { font-size: 13px; margin-top: 8px; }

.dropdown-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 13px;
}

/* User Dropdown */
.topbar-user-btn {
    display: flex; align-items: center; gap: 8px;
    background: none; border: 1px solid var(--border);
    padding: 6px 12px 6px 6px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}
.topbar-user-btn:hover { background: var(--bg-body); }

.topbar-avatar { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.topbar-user-info { display: flex; flex-direction: column; align-items: flex-start; }
.topbar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.topbar-user-role { font-size: 11px; color: var(--text-muted); }
.topbar-chevron { font-size: 12px; color: var(--text-muted); }

.user-dropdown {
    width: 220px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    background: var(--bg-card);
    padding: 0;
    overflow: hidden;
}

.user-dropdown-header {
    display: flex; gap: 12px; align-items: center;
    padding: 16px;
    background: var(--bg-body);
}
.user-dropdown-header img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.user-dropdown-header strong { display: block; font-size: 13px; }
.user-dropdown-header small { font-size: 11px; color: var(--text-muted); }

.user-dropdown .dropdown-item {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex; align-items: center;
    transition: var(--transition);
}
.user-dropdown .dropdown-item:hover { background: var(--bg-body); color: var(--text-primary); }
.user-dropdown .dropdown-item.text-danger:hover { background: rgba(239,68,68,.08); }

/* ============ PAGE CONTENT ============ */
.page-content {
    padding: 24px;
    flex: 1;
}

.flash-container { padding: 16px 24px 0; }

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: transparent;
    display: flex; align-items: center; justify-content: space-between;
}

.card-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-body { padding: 20px; }

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.stat-card.primary::before { background: linear-gradient(90deg, var(--primary), var(--secondary)); }
.stat-card.success::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.stat-card.info::before { background: linear-gradient(90deg, var(--info), #22d3ee); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--secondary), #a78bfa); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.stat-card.primary .stat-icon { background: rgba(26,107,255,.1); color: var(--primary); }
.stat-card.success .stat-icon { background: rgba(16,185,129,.1); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(245,158,11,.1); color: var(--warning); }
.stat-card.danger .stat-icon { background: rgba(239,68,68,.1); color: var(--danger); }
.stat-card.info .stat-icon { background: rgba(6,182,212,.1); color: var(--info); }
.stat-card.purple .stat-icon { background: rgba(99,102,241,.1); color: var(--secondary); }

.stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

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

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    padding: 3px 8px;
    border-radius: 20px;
}

.stat-change.up { background: rgba(16,185,129,.1); color: var(--success); }
.stat-change.down { background: rgba(239,68,68,.1); color: var(--danger); }

/* ============ TABLES ============ */
.table {
    color: var(--text-primary);
    border-color: var(--border);
}

.table thead th {
    background: var(--bg-body);
    border-bottom: 2px solid var(--border);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-secondary);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

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

/* ============ BADGES ============ */
.badge-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    display: inline-flex; align-items: center; gap: 5px;
}

.badge-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-status.paid, .badge-status.active, .badge-status.completed { background: rgba(16,185,129,.12); color: var(--success); }
.badge-status.pending { background: rgba(245,158,11,.12); color: var(--warning); }
.badge-status.cancelled, .badge-status.failed, .badge-status.expired { background: rgba(239,68,68,.12); color: var(--danger); }
.badge-status.partial { background: rgba(6,182,212,.12); color: var(--info); }
.badge-status.refunded { background: rgba(99,102,241,.12); color: var(--secondary); }

/* Stock badges */
.stock-ok { color: var(--success); font-weight: 600; }
.stock-low { color: var(--warning); font-weight: 600; }
.stock-critical { color: var(--danger); font-weight: 600; }
.stock-out { color: var(--danger); font-weight: 700; }

/* ============ FORMS ============ */
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control, .form-select {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius);
    padding: 9px 14px;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,107,255,.12);
    color: var(--text-primary);
}

.form-control::placeholder { color: var(--text-muted); }

/* ============ BUTTONS ============ */
.btn {
    font-weight: 600;
    font-size: 13.5px;
    padding: 9px 20px;
    border-radius: var(--radius);
    transition: var(--transition);
    display: inline-flex; align-items: center; gap: 6px;
    letter-spacing: .2px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(26,107,255,.3);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 6px 16px rgba(26,107,255,.4); }

.btn-success { box-shadow: 0 4px 12px rgba(16,185,129,.25); }
.btn-success:hover { box-shadow: 0 6px 16px rgba(16,185,129,.35); }

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

.btn-icon {
    width: 36px; height: 36px;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
}

/* ============ PAGE HEADER ============ */
.page-header {
    margin-bottom: 24px;
    display: flex; align-items: flex-start; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}

.page-header-left {}
.page-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
}
.breadcrumb-item.active { color: var(--text-muted); }

/* ============ SECTION DIVIDER ============ */
.section-divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

/* ============ DATATABLES OVERRIDE ============ */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius);
    padding: 7px 12px;
    font-size: 13px;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { font-size: 13px; }

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--radius-sm) !important;
    color: var(--text-secondary) !important;
    padding: 4px 10px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

/* ============ CHARTS ============ */
.chart-container { position: relative; }

/* ============ LOADING ============ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 56px; height: 56px;
    border: 4px solid rgba(255,255,255,.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 60px; opacity: .3; display: block; margin-bottom: 16px; }
.empty-state h5 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ============ PROGRESS BARS ============ */
.progress {
    height: 8px;
    border-radius: 10px;
    background: var(--border-light);
}

/* ============ MEDICINE IMAGE ============ */
.med-img {
    width: 44px; height: 44px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--bg-body);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ============ MODALS ============ */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 18px 24px;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
}

.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 24px; }

/* ============ ALERTS ============ */
.alert { border-radius: var(--radius); border: none; font-size: 14px; }
.alert-info { background: rgba(6,182,212,.1); color: #0891b2; }
.alert-warning { background: rgba(245,158,11,.1); color: #d97706; }
.alert-danger { background: rgba(239,68,68,.1); color: #dc2626; }
.alert-success { background: rgba(16,185,129,.1); color: #059669; }

/* ============ SELECT2 OVERRIDE ============ */
.select2-container--bootstrap-5 .select2-selection {
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}

/* ============ FLATPICKR OVERRIDE ============ */
.flatpickr-input { background: var(--bg-card) !important; }

/* ============ ANIMATIONS ============ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-ring {
    0% { transform: scale(0.85); }
    50% { transform: scale(1); }
    100% { transform: scale(0.85); }
}

.animate-fade-up { animation: fadeInUp 0.5s ease forwards; }
.animate-slide-left { animation: slideInLeft 0.4s ease forwards; }

/* Stagger children */
.stagger > *:nth-child(1) { animation-delay: .05s; opacity: 0; animation-fill-mode: both; }
.stagger > *:nth-child(2) { animation-delay: .10s; opacity: 0; animation-fill-mode: both; }
.stagger > *:nth-child(3) { animation-delay: .15s; opacity: 0; animation-fill-mode: both; }
.stagger > *:nth-child(4) { animation-delay: .20s; opacity: 0; animation-fill-mode: both; }
.stagger > *:nth-child(5) { animation-delay: .25s; opacity: 0; animation-fill-mode: both; }
.stagger > *:nth-child(6) { animation-delay: .30s; opacity: 0; animation-fill-mode: both; }
.stagger > * { animation: fadeInUp 0.5s ease; }

/* ============ RESPONSIVE ============ */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .stat-value { font-size: 22px; }
}

@media (max-width: 575.98px) {
    .topbar-user-info { display: none; }
    .page-title { font-size: 20px; }
}

/* ============ LOGIN PAGE ============ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #060d1e 0%, #0f1c33 40%, #1a2744 100%);
    display: flex; align-items: center; justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(26,107,255,.15) 0%, transparent 70%);
    top: -100px; right: -100px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(99,102,241,.1) 0%, transparent 70%);
    bottom: -50px; left: -50px;
    border-radius: 50%;
}

.login-card {
    width: 100%;
    max-width: 460px;
    background: rgba(15,28,51,.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 24px;
    padding: 44px;
    position: relative;
    z-index: 1;
    box-shadow: 0 25px 50px rgba(0,0,0,.5);
    animation: fadeInUp .6s ease;
}

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

.login-logo-icon {
    width: 70px; height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 32px;
    color: #fff;
    margin: 0 auto 14px;
    box-shadow: 0 8px 24px rgba(26,107,255,.4);
}

.login-app-name {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.login-tagline {
    font-size: 12px;
    color: rgba(255,255,255,.4);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.login-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.login-subtitle {
    color: rgba(255,255,255,.45);
    font-size: 13px;
    margin-bottom: 28px;
}

.login-form .form-label {
    color: rgba(255,255,255,.65);
    font-size: 13px;
    font-weight: 500;
}

.login-form .form-control {
    background: rgba(255,255,255,.06);
    border: 1.5px solid rgba(255,255,255,.1);
    color: #fff;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
}

.login-form .form-control:focus {
    background: rgba(255,255,255,.1);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,107,255,.2);
    color: #fff;
}

.login-form .form-control::placeholder { color: rgba(255,255,255,.25); }

.input-icon-wrap { position: relative; }
.input-icon {
    position: absolute;
    left: 14px; top: 50%; transform: translateY(-50%);
    color: rgba(255,255,255,.3);
    font-size: 16px;
    pointer-events: none;
}
.input-icon-wrap .form-control { padding-left: 42px; }

.toggle-password {
    position: absolute;
    right: 14px; top: 50%; transform: translateY(-50%);
    background: none; border: none;
    color: rgba(255,255,255,.3);
    cursor: pointer; font-size: 16px;
    transition: var(--transition);
}
.toggle-password:hover { color: rgba(255,255,255,.7); }

.btn-login {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: #fff;
    padding: 13px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 6px 20px rgba(26,107,255,.35);
    font-family: var(--font-display);
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(26,107,255,.45);
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,.06);
    color: rgba(255,255,255,.3);
    font-size: 12px;
}

/* ============ DARK MODE OVERRIDES ============ */
[data-theme="dark"] .table thead th { background: rgba(255,255,255,.04); }
[data-theme="dark"] .table tbody tr:hover { background: rgba(255,255,255,.03); }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select { background: rgba(255,255,255,.05); }
[data-theme="dark"] .btn-close { filter: invert(1); }
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-theme="dark"] .dataTables_wrapper .dataTables_length select { background: rgba(255,255,255,.05); color: var(--text-primary); border-color: var(--border); }

/* ============ UTILITIES ============ */
.text-primary-color { color: var(--primary) !important; }
.bg-card { background: var(--bg-card) !important; }
.border-color { border-color: var(--border) !important; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.font-display { font-family: var(--font-display); }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.shadow-card { box-shadow: var(--shadow) !important; }

.cursor-pointer { cursor: pointer; }
.gap-2 { gap: 8px !important; }

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }
