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

:root {
    --primary: #1a3fdb;
    --primary-light: #2563EB;
    --navy: #0d1b3e;
    --navy-mid: #1a2f60;
    --sidebar-bg: #0d1b3e;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active: rgba(26,63,219,0.25);
    --main-bg: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --radius: 10px;
    --radius-lg: 16px;
    --radius-sm: 6px;
    --sidebar-width: 260px;
    --transition: all 0.25s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--main-bg); color: var(--text); display: flex; min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ===== SIDEBAR ===== */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 200; display: flex; flex-direction: column;
    transition: var(--transition);
    overflow: hidden;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-logo {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; color: white; font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(26,63,219,0.4);
}
.sidebar-logo-text { font-size: 1rem; font-weight: 700; color: white; }
.sidebar-logo-sub { font-size: 0.7rem; color: rgba(255,255,255,0.4); font-weight: 500; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section-title {
    font-size: 0.65rem; font-weight: 700; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.3); text-transform: uppercase;
    padding: 1rem 1.5rem 0.4rem;
}

.sidebar-link {
    display: flex; align-items: center; gap: 0.875rem;
    padding: 0.7rem 1.5rem; color: rgba(255,255,255,0.65);
    font-size: 0.875rem; font-weight: 500;
    transition: var(--transition); position: relative;
    border-left: 3px solid transparent;
    text-decoration: none;
}
.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: rgba(255,255,255,0.9);
    border-left-color: rgba(26,63,219,0.5);
}
.sidebar-link.active {
    background: var(--sidebar-active);
    color: white;
    border-left-color: var(--primary-light);
}
.sidebar-icon { width: 20px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.sidebar-badge {
    margin-left: auto; background: var(--primary); color: white;
    font-size: 0.65rem; font-weight: 700; padding: 0.15rem 0.4rem;
    border-radius: 999px; min-width: 18px; text-align: center;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 1rem;
}
.sidebar-user {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius);
}
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.875rem; color: white; flex-shrink: 0;
}
.user-name { font-size: 0.875rem; font-weight: 600; color: white; }
.user-role { font-size: 0.75rem; color: rgba(255,255,255,0.4); }

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

/* ===== TOP HEADER ===== */
.admin-topbar {
    background: white; border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.topbar-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.1rem; }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.topbar-date {
    font-size: 0.8rem; color: var(--text-muted); font-weight: 500;
    background: var(--main-bg); padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
}

/* ===== CONTENT AREA ===== */
.admin-content { padding: 2rem; flex: 1; }

/* ===== STAT CARDS ===== */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card {
    background: var(--card-bg); border-radius: var(--radius-lg);
    padding: 1.5rem; box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex; align-items: center; gap: 1rem;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 52px; height: 52px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; flex-shrink: 0;
}
.stat-icon.blue { background: rgba(26,63,219,0.1); }
.stat-icon.green { background: rgba(16,185,129,0.1); }
.stat-icon.yellow { background: rgba(245,158,11,0.1); }
.stat-icon.purple { background: rgba(139,92,246,0.1); }
.stat-icon.red { background: rgba(239,68,68,0.1); }
.stat-info { flex: 1; }
.stat-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.35rem; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-trend { font-size: 0.75rem; color: var(--success); font-weight: 600; margin-top: 0.25rem; }
.stat-trend.down { color: var(--danger); }

/* ===== CARDS ===== */
.admin-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: #fafafa;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 0.5rem; }
.card-body { padding: 1.5rem; }

/* ===== TABLES ===== */
.table-container { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
    padding: 0.75rem 1rem; text-align: left;
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px;
    text-transform: uppercase; color: var(--text-muted);
    background: #f8fafc; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.admin-table td {
    padding: 0.875rem 1rem; border-bottom: 1px solid var(--border);
    font-size: 0.875rem; vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: #f8fafc; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.2rem; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.875rem; cursor: pointer; border: none; transition: var(--transition); white-space: nowrap; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(26,63,219,0.25); }
.btn-primary:hover { background: #1532b3; }
.btn-secondary { background: var(--navy); color: white; }
.btn-secondary:hover { background: var(--navy-mid); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); justify-content: center; }

/* ===== BADGES / STATUS ===== */
.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-info { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-gray { background: rgba(100,116,139,0.1); color: var(--text-muted); }

/* ===== FORMS ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--navy); margin-bottom: 0.4rem; }
.form-control {
    width: 100%; padding: 0.7rem 0.875rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.9rem; color: var(--text); background: white;
    transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,63,219,0.08); }
.form-control::placeholder { color: var(--text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ===== MODALS ===== */
.modal, .modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
    z-index: 1000; align-items: center; justify-content: center;
}
.modal.active, .modal-overlay.active { display: flex !important; }
.modal-content, .modal-box {
    background: white; border-radius: var(--radius-lg);
    width: 100%; max-width: 560px;
    padding: 1.5rem;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; line-height: 1; padding: 0.25rem; }
.modal-close:hover { color: var(--navy); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.75rem; }

/* ===== ALERTS ===== */
.alert { padding: 0.875rem 1.25rem; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 500; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.alert-success { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert-danger { background: rgba(239,68,68,0.08); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: rgba(245,158,11,0.1); color: #92400e; border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: rgba(59,130,246,0.1); color: var(--info); border: 1px solid rgba(59,130,246,0.2); }

/* ===== SEARCH / FILTERS ===== */
.search-bar { display: flex; gap: 0.75rem; align-items: center; }
.search-input-wrap { position: relative; }
.search-input-wrap input { padding-left: 2.25rem; }
.search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.9rem; }
.filter-bar { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; gap: 0.4rem; margin-top: 1.5rem; }
.page-btn { padding: 0.4rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500; cursor: pointer; color: var(--text); background: white; transition: var(--transition); }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== ADMIN LOGIN PAGE ===== */
.admin-login-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, #1a2f60 50%, #0a1630 100%);
    padding: 2rem;
}
.login-card {
    background: white; border-radius: var(--radius-lg);
    padding: 2.5rem; width: 100%; max-width: 420px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.login-logo-icon { width: 44px; height: 44px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: white; }
.login-logo-text { font-size: 1.5rem; font-weight: 800; color: var(--navy); }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }
.login-heading { text-align: center; font-size: 0.75rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-light); margin-bottom: 1.5rem; }

/* ===== TOGGLE SWITCH ===== */
.toggle-wrapper { display: flex; align-items: center; gap: 0.75rem; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--border); border-radius: 999px; transition: 0.3s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===== DATA EMPTY STATE ===== */
.empty-state { text-align: center; padding: 3rem 2rem; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state p { font-size: 0.95rem; }

/* ===== CHARTS / VISUAL ELEMENTS ===== */
.trend-indicator { display: flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; font-weight: 600; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* ===== MISC ===== */
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.text-mono { font-family: 'Courier New', monospace; font-size: 0.85rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light)); display: flex; align-items: center; justify-content: center; color: white; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; }
.actions-cell { display: flex; gap: 0.4rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .admin-content { padding: 1rem; }
    .admin-topbar { padding: 1rem; }
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr; }
}
