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

:root {
    --primary: #0ea5e9;
    --primary-light: #38bdf8;
    --primary-dark: #0284c7;
    --primary-50: rgba(14,165,233,0.08);
    --primary-100: rgba(14,165,233,0.12);
    --secondary: #6366f1;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-text: #059669;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-text: #d97706;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-text: #dc2626;
    --info: #06b6d4;
    --info-bg: #ecfeff;
    --info-text: #0891b2;
    --dark: #0f172a;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.06), 0 4px 8px rgba(0,0,0,0.03);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.08);
    --transition: 0.2s ease;
}

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

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
    background: var(--gray-50);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

/* ─── SIDEBAR ─── */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background: var(--gray-900);
    color: #fff;
    z-index: 1000;
    transition: width var(--transition), transform var(--transition);
    overflow: hidden;
    display: flex; flex-direction: column;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 20px;
    font-size: 1rem; font-weight: 700;
    min-height: var(--header-height);
    letter-spacing: -0.2px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; color: #fff; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(14,165,233,0.3);
}

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

.sidebar-nav .nav-section {
    padding: 16px 20px 6px;
    font-size: 0.6rem; text-transform: uppercase;
    letter-spacing: 1px; color: rgba(255,255,255,0.2);
    font-weight: 600;
}

.sidebar-nav .nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 20px; margin: 1px 10px;
    color: rgba(255,255,255,0.5);
    border-radius: 8px; font-size: 0.85rem; font-weight: 500;
    transition: all 0.15s;
}
.sidebar-nav .nav-item:hover { background: rgba(255,255,255,0.04); color: #fff; }
.sidebar-nav .nav-item.active { background: rgba(14,165,233,0.1); color: #fff; font-weight: 600; }

.sidebar-nav .nav-item .nav-icon {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}

.sidebar-nav .nav-item .nav-badge {
    margin-left: auto; font-size: 0.6rem;
    padding: 1px 7px; border-radius: 6px;
    background: var(--danger); color: #fff; font-weight: 600;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .nav-item .nav-text,
.sidebar.collapsed .nav-section { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px; margin: 1px 8px; }

/* ─── MAIN ─── */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; transition: margin-left var(--transition); }
.main-content.expanded { margin-left: var(--sidebar-collapsed); }

/* ─── HEADER ─── */
.header {
    position: sticky; top: 0; z-index: 900;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px; height: var(--header-height);
    display: flex; align-items: center; justify-content: space-between;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.sidebar-toggle {
    background: none; border: none; cursor: pointer;
    width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-400); font-size: 1.3rem;
    transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--gray-100); color: var(--gray-600); }

.search-bar {
    display: flex; align-items: center;
    background: var(--gray-100);
    border-radius: 8px; padding: 6px 12px; gap: 8px;
    min-width: 260px; border: 1px solid transparent;
    transition: var(--transition);
}
.search-bar:focus-within { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.search-bar input { border: none; background: none; outline: none; width: 100%; font-size: 0.85rem; color: var(--gray-600); font-family: var(--font-family); }
.search-bar input::placeholder { color: var(--gray-400); }
.search-bar .search-icon { color: var(--gray-400); font-size: 0.85rem; }
.search-bar kbd { font-size: 0.6rem; padding: 1px 5px; background: var(--gray-200); border-radius: 4px; color: var(--gray-400); font-family: var(--font-mono); }

.header-btn {
    background: none; border: none; width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--gray-400);
    transition: var(--transition); font-size: 1.15rem; position: relative;
}
.header-btn:hover { background: var(--gray-100); color: var(--gray-600); }

.header-btn .badge-dot {
    position: absolute; top: 7px; right: 7px;
    width: 7px; height: 7px;
    background: var(--danger); border-radius: 50%;
    border: 2px solid #fff; animation: pulse 2s infinite;
}

.user-avatar {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 0.75rem;
    cursor: pointer; transition: var(--transition);
}
.user-avatar:hover { opacity: 0.9; }

/* ─── CONTENT ─── */
.content-area { padding: 28px 32px 40px; max-width: 1440px; margin: 0 auto; }

.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 28px; flex-wrap: wrap; gap: 16px;
}

.page-title {
    font-size: 1.5rem; font-weight: 700;
    color: var(--gray-900); letter-spacing: -0.3px;
    line-height: 1.3;
}
.page-subtitle { font-size: 0.9rem; color: var(--gray-400); margin-top: 2px; }

/* ─── STAT CARDS ─── */
.stat-card {
    background: #fff; border-radius: var(--border-radius);
    padding: 20px; box-shadow: var(--shadow-xs);
    border: 1px solid var(--gray-200);
    transition: all 0.2s; position: relative;
}
.stat-card:hover { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-sm); }

.stat-card .stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; margin-bottom: 14px;
}
.stat-card .stat-icon.primary { background: var(--primary-50); color: var(--primary); }
.stat-card .stat-icon.success { background: var(--success-bg); color: var(--success-text); }
.stat-card .stat-icon.warning { background: var(--warning-bg); color: var(--warning-text); }
.stat-card .stat-icon.danger { background: var(--danger-bg); color: var(--danger-text); }
.stat-card .stat-icon.info { background: var(--info-bg); color: var(--info-text); }

.stat-card .stat-value {
    font-size: 1.6rem; font-weight: 700;
    color: var(--gray-900); line-height: 1.2;
}
.stat-card .stat-label { font-size: 0.8rem; color: var(--gray-400); margin-top: 2px; font-weight: 500; }

.stat-card .stat-trend {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 0.7rem; margin-top: 8px;
    padding: 2px 8px; border-radius: 6px; font-weight: 600;
}
.stat-trend.up { background: var(--success-bg); color: var(--success-text); }
.stat-trend.down { background: var(--danger-bg); color: var(--danger-text); }

/* ─── CARDS ─── */
.card { background: #fff; border-radius: var(--border-radius); box-shadow: var(--shadow-xs); border: 1px solid var(--gray-200); transition: var(--transition); }
.card-header { border-bottom: 1px solid var(--gray-100); padding: 16px 20px; font-weight: 600; font-size: 0.9rem; color: var(--gray-800); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }
.card-footer { border-top: 1px solid var(--gray-100); padding: 12px 20px; background: var(--gray-50); border-radius: 0 0 var(--border-radius) var(--border-radius); }

/* ─── TABLES ─── */
.table-container { overflow-x: auto; border-radius: 8px; border: 1px solid var(--gray-200); }
.table { margin-bottom: 0; }
.table th {
    background: var(--gray-50);
    font-weight: 600; font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--gray-400);
    padding: 12px 16px; white-space: nowrap;
    cursor: pointer; user-select: none;
    border-bottom: 1px solid var(--gray-200);
}
.table th:hover { color: var(--primary); }
.table th .sort-icon { margin-left: 4px; opacity: 0.2; font-size: 0.65rem; }
.table th.sorted .sort-icon { opacity: 1; color: var(--primary); }
.table td { padding: 12px 16px; vertical-align: middle; border-bottom: 1px solid var(--gray-100); color: var(--gray-600); font-size: 0.85rem; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }
.table .row-expand { display: none; }
.table .row-expand.show { display: table-row; }
.table .row-expand td { background: var(--gray-50); padding: 16px 20px; }

/* ─── BADGES ─── */
.badge { padding: 3px 10px; font-size: 0.65rem; font-weight: 600; border-radius: 6px; letter-spacing: 0.2px; }
.badge.bg-success { background: var(--success-bg) !important; color: var(--success-text); }
.badge.bg-danger { background: var(--danger-bg) !important; color: var(--danger-text); }
.badge.bg-warning { background: var(--warning-bg) !important; color: var(--warning-text); }
.badge.bg-info { background: var(--info-bg) !important; color: var(--info-text); }
.badge.bg-secondary { background: var(--gray-100) !important; color: var(--gray-500); }

/* ─── BUTTONS ─── */
.btn {
    padding: 8px 20px; border-radius: 8px; font-weight: 500;
    font-size: 0.85rem; transition: all 0.15s;
    border: 1px solid transparent;
    display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer; font-family: var(--font-family); line-height: 1.4;
}
.btn:hover { box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.97); }

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

.btn-secondary { background: #fff; color: var(--gray-600); border-color: var(--gray-200); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-outline-secondary { background: transparent; color: var(--gray-500); border-color: var(--gray-200); }
.btn-outline-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline-success { background: transparent; color: var(--success-text); border-color: var(--success); }
.btn-outline-success:hover { background: var(--success); color: #fff; }
.btn-outline-danger { background: transparent; color: var(--danger-text); border-color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-outline-info { background: transparent; color: var(--info-text); border-color: var(--info); }
.btn-outline-info:hover { background: var(--info); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 0.75rem; border-radius: 6px; }
.btn-lg { padding: 11px 24px; font-size: 0.95rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 8px; }

/* ─── FORMS ─── */
.form-control, .form-select {
    border: 1px solid var(--gray-200);
    border-radius: 8px; padding: 9px 12px;
    font-size: 0.85rem; transition: var(--transition);
    font-family: var(--font-family); color: var(--gray-700); background: #fff;
}
.form-control:hover, .form-select:hover { border-color: var(--gray-300); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); outline: none; }
.form-control::placeholder { color: var(--gray-400); }

.form-label { font-weight: 500; font-size: 0.8rem; color: var(--gray-500); margin-bottom: 4px; }
.form-text { font-size: 0.7rem; color: var(--gray-400); margin-top: 4px; }

.input-group .input-group-text { background: var(--gray-50); border: 1px solid var(--gray-200); border-right: none; border-radius: 8px 0 0 8px; color: var(--gray-400); padding: 9px 12px; }
.input-group .form-control { border-left: none; border-radius: 0 8px 8px 0; }
.input-group:focus-within .input-group-text { border-color: var(--primary); }

/* ─── MODALS ─── */
.modal-content { border-radius: 12px; border: none; box-shadow: 0 20px 60px rgba(0,0,0,0.12); }
.modal-header { border-bottom: 1px solid var(--gray-100); padding: 16px 20px; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--gray-100); padding: 12px 20px; }
.modal-backdrop.show { opacity: 0.3; }

/* ─── ALERTS & TOASTS ─── */
.alert { border-radius: 8px; border: none; padding: 12px 16px; font-size: 0.85rem; }
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    min-width: 320px; padding: 14px 18px; border-radius: 10px;
    color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    display: flex; align-items: flex-start; gap: 10px;
    animation: slideInRight 0.25s ease; cursor: pointer;
}
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }
.toast.warning { background: #92400e; }
.toast.info { background: #155e75; }
.toast .toast-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.toast .toast-content { flex: 1; }
.toast .toast-title { font-weight: 600; font-size: 0.85rem; }
.toast .toast-message { font-size: 0.75rem; opacity: 0.85; margin-top: 1px; }

/* ─── PROGRESS ─── */
.progress { height: 6px; border-radius: 4px; background: var(--gray-100); }
.progress-bar { border-radius: 4px; background: var(--primary); }

/* ─── TIMELINE ─── */
.timeline { position: relative; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 4px; bottom: 4px; width: 2px; background: var(--gray-100); }
.timeline-item { position: relative; padding-left: 36px; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker { position: absolute; left: 3px; top: 5px; width: 18px; height: 18px; border-radius: 50%; border: 3px solid; background: #fff; z-index: 1; }
.timeline-marker.success { border-color: var(--success); }
.timeline-marker.failed { border-color: var(--danger); }
.timeline-marker.warning { border-color: var(--warning); }
.timeline-marker.info { border-color: var(--info); }
.timeline-content { background: var(--gray-50); padding: 10px 14px; border-radius: 8px; border: 1px solid var(--gray-100); }
.timeline-content .timeline-title { font-weight: 600; font-size: 0.8rem; color: var(--gray-800); }
.timeline-content .timeline-time { font-size: 0.7rem; color: var(--gray-400); margin-top: 2px; }

/* ─── PAGINATION ─── */
.pagination { gap: 4px; }
.pagination .page-link { border: 1px solid var(--gray-200); border-radius: 6px; padding: 7px 13px; color: var(--gray-500); font-weight: 500; font-size: 0.8rem; transition: var(--transition); font-family: var(--font-family); }
.pagination .page-link:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-700); }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ─── UTILITIES ─── */
.cursor-pointer { cursor: pointer; }
.fw-600 { font-weight: 600; }
.text-muted { color: var(--gray-400) !important; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }

/* ─── EMPTY STATE ─── */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; color: var(--gray-200); }
.empty-state .empty-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; color: var(--gray-600); }
.empty-state .empty-text { color: var(--gray-400); margin-bottom: 20px; font-size: 0.85rem; }

/* ─── SKELETON ─── */
.skeleton { background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%); background-size: 200% 100%; animation: skeleton 1.5s ease infinite; border-radius: 4px; }

/* ─── LIVE INDICATOR ─── */
.live-indicator { display: inline-flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--success-text); font-weight: 500; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }

/* ─── KEYFRAMES ─── */
@keyframes slideInRight { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.fade-in { animation: fadeIn 0.25s ease; }
.fade-in-up { animation: fadeInUp 0.3s ease; }

/* ─── PASSWORD STRENGTH ─── */
.password-strength { display: flex; gap: 4px; margin-top: 8px; }
.password-strength .strength-bar { height: 3px; flex: 1; border-radius: 2px; background: var(--gray-200); transition: var(--transition); }
.strength-bar.weak { background: var(--danger); }
.strength-bar.medium { background: var(--warning); }
.strength-bar.strong { background: var(--success); }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

/* ─── CHECKBOX ─── */
.form-check-input { border: 1.5px solid var(--gray-300); cursor: pointer; width: 1em; height: 1em; margin-top: 0.15em; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--primary-50); border-color: var(--primary); }

/* ─── DROPDOWN ─── */
.dropdown-menu { border: 1px solid var(--gray-200); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.06); padding: 4px; }
.dropdown-menu .dropdown-item { padding: 7px 12px; border-radius: 6px; font-size: 0.8rem; transition: var(--transition); color: var(--gray-600); }
.dropdown-menu .dropdown-item:hover { background: var(--gray-50); color: var(--gray-800); }
.dropdown-menu .dropdown-item .dropdown-icon { width: 16px; margin-right: 8px; color: var(--gray-400); font-size: 0.85rem; }
.dropdown-menu .dropdown-item.text-danger { color: var(--danger-text); }
.dropdown-menu .dropdown-item.text-danger:hover { background: var(--danger-bg); }
.dropdown-divider { border-color: var(--gray-100); margin: 4px 0; }

/* ─── CHARTS ─── */
.chart-container { position: relative; height: 280px; }
.chart-container-sm { height: 200px; }

/* ─── TABS ─── */
.nav-tabs { border-bottom: 1px solid var(--gray-100); gap: 2px; }
.nav-tabs .nav-link { border: none; color: var(--gray-400); font-weight: 500; font-size: 0.85rem; padding: 8px 16px; border-radius: 6px 6px 0 0; transition: var(--transition); font-family: var(--font-family); }
.nav-tabs .nav-link:hover { color: var(--gray-600); background: var(--gray-50); }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom: 2px solid var(--primary); font-weight: 600; background: none; }

/* ─── CODE ─── */
code { font-family: var(--font-mono); font-size: 0.85em; padding: 2px 6px; background: var(--gray-100); border-radius: 4px; color: var(--gray-600); }

/* ─── BOTTOM NAV ─── */
.bottom-nav { display: none; }
