/* ============================================================
   STMS - School Tablet Management System
   Custom Stylesheet
   ============================================================ */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS Variables / Design Tokens
   ============================================================ */
:root {
    /* Primary Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-subtle: rgba(99, 102, 241, 0.1);

    /* Accent */
    --accent: #06b6d4;
    --accent-dark: #0891b2;

    /* Neutrals */
    --bg-body: #0f1117;
    --bg-sidebar: #13151d;
    --bg-card: #1a1d2e;
    --bg-card-hover: #222640;
    --bg-input: #1e2235;
    --bg-table-header: #161929;

    --text-primary: #e8eaed;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-white: #ffffff;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.05);

    /* Status Colors */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.12);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-success: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-dark: linear-gradient(135deg, #1a1d2e 0%, #13151d 100%);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ============================================================
   Base Styles
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    position: relative;
    overflow: hidden;
}

.login-bg-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.login-bg-animation .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: orbFloat 20s infinite ease-in-out;
}

.login-bg-animation .orb:nth-child(1) {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.login-bg-animation .orb:nth-child(2) {
    width: 300px;
    height: 300px;
    background: var(--accent);
    bottom: -50px;
    right: -50px;
    animation-delay: -7s;
}

.login-bg-animation .orb:nth-child(3) {
    width: 200px;
    height: 200px;
    background: #8b5cf6;
    top: 50%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(50px, -30px) scale(1.1); }
    50% { transform: translate(-20px, 50px) scale(0.9); }
    75% { transform: translate(30px, 20px) scale(1.05); }
}

.login-card {
    background: rgba(26, 29, 46, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 420px;
    max-width: 90vw;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

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

.login-card .login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.login-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 4px;
}

.login-card .login-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
}

.login-card .form-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.login-card .form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: var(--bg-input);
    color: var(--text-primary);
}

.login-card .btn-login {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    width: 100%;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.login-card .btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.login-card .btn-login:active {
    transform: translateY(0);
}

.login-error {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.login-error.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ============================================================
   Layout: Sidebar + Content
   ============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

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

.sidebar-brand {
    padding: 20px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

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

.sidebar-brand .brand-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-white);
    white-space: nowrap;
}

.sidebar-brand .brand-version {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
    font-weight: 400;
}

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

.nav-section {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    white-space: nowrap;
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
    cursor: pointer;
}

.nav-link i {
    font-size: 17px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--primary-subtle);
    color: var(--primary-light);
    font-weight: 600;
}

.nav-link.active i {
    color: var(--primary-light);
}

/* Sidebar user profile */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    overflow: hidden;
}

.sidebar-user .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

/* Top Bar */
.topbar {
    height: 64px;
    background: rgba(15, 17, 23, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

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

.topbar-breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: none;
}

.btn-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

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

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

.topbar-right .btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Page Content */
.page-content {
    padding: 24px;
}

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

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(99, 102, 241, 0.2);
}

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

.stat-card.primary::before { background: var(--gradient-primary); }
.stat-card.success::before { background: var(--gradient-success); }
.stat-card.warning::before { background: var(--gradient-warning); }
.stat-card.danger::before { background: var(--gradient-danger); }
.stat-card.info::before { background: var(--gradient-accent); }

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}

.stat-card.primary .stat-icon { background: var(--primary-subtle); color: var(--primary-light); }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.danger .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.info .stat-icon { background: var(--info-bg); color: var(--info); }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   Cards
   ============================================================ */
.card-dark {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.card-dark .card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-white);
    margin: 0;
}

.card-dark .card-body {
    padding: 20px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary-custom {
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.btn-primary-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    color: white;
}

.btn-outline-custom {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.btn-outline-custom:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.btn-danger-custom {
    background: var(--gradient-danger);
    border: none;
    color: white;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* ============================================================
   Tables (DataTables Integration)
   ============================================================ */
.table-dark-custom {
    width: 100%;
    color: var(--text-primary);
    border-collapse: separate;
    border-spacing: 0;
}

.table-dark-custom thead th {
    background: var(--bg-table-header);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

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

.table-dark-custom tbody tr {
    transition: background var(--transition-fast);
}

.table-dark-custom tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
}

.dataTables_wrapper .dataTables_length select {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
    padding: 4px 8px !important;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    color: var(--text-secondary) !important;
    font-size: 13px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
    margin: 0 2px !important;
    padding: 4px 10px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--gradient-primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--bg-card-hover) !important;
    color: var(--text-primary) !important;
}

/* ============================================================
   Status Badges
   ============================================================ */
.badge-status {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-online { background: var(--success-bg); color: var(--success); }
.badge-online::before { background: var(--success); box-shadow: 0 0 6px var(--success); }

.badge-offline { background: rgba(107, 114, 128, 0.15); color: var(--text-muted); }
.badge-offline::before { background: var(--text-muted); }

.badge-maintenance { background: var(--warning-bg); color: var(--warning); }
.badge-maintenance::before { background: var(--warning); }

.badge-retired { background: var(--danger-bg); color: var(--danger); }
.badge-retired::before { background: var(--danger); }

.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--danger-bg); color: var(--danger); }

.badge-installed { background: var(--success-bg); color: var(--success); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-installing { background: var(--info-bg); color: var(--info); }
.badge-downloading { background: var(--info-bg); color: var(--info); }
.badge-failed { background: var(--danger-bg); color: var(--danger); }

/* ============================================================
   Forms (Bootstrap Overrides)
   ============================================================ */
.form-control,
.form-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 13px;
    transition: all var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-input);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    color: var(--text-primary);
}

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

.form-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   Modals (Bootstrap Overrides)
   ============================================================ */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

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

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-white);
}

.modal-body {
    padding: 24px;
}

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

.btn-close {
    filter: invert(1) brightness(0.8);
}

/* ============================================================
   Map Container
   ============================================================ */
.map-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.map-container .leaflet-container {
    background: var(--bg-card);
}

/* ============================================================
   Charts
   ============================================================ */
.chart-container {
    position: relative;
    height: 280px;
}

/* ============================================================
   Health Indicators
   ============================================================ */
.health-bar {
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.health-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width var(--transition-slow);
}

.health-bar-fill.good { background: var(--gradient-success); }
.health-bar-fill.warning { background: var(--gradient-warning); }
.health-bar-fill.danger { background: var(--gradient-danger); }

/* ============================================================
   Toast Notifications
   ============================================================ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-custom {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    backdrop-filter: blur(10px);
}

.toast-custom.success { border-left: 3px solid var(--success); }
.toast-custom.error { border-left: 3px solid var(--danger); }
.toast-custom.warning { border-left: 3px solid var(--warning); }
.toast-custom.info { border-left: 3px solid var(--info); }

.toast-custom .toast-icon { font-size: 18px; }
.toast-custom.success .toast-icon { color: var(--success); }
.toast-custom.error .toast-icon { color: var(--danger); }

.toast-custom .toast-message {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.toast-custom .toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease;
}

/* ============================================================
   Utilities
   ============================================================ */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glow-primary {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .btn-sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 576px) {
    .page-content {
        padding: 16px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }

    .topbar {
        padding: 0 16px;
    }

    .login-card {
        padding: 32px 24px;
    }
}

/* ============================================================
   Loading Spinner
   ============================================================ */
.spinner-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.spinner-custom {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h5 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}
