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

:root {
    --sidebar-w:     240px;
    --sidebar-bg:    #0a1628;
    --sidebar-hover: rgba(184,146,42,.12);
    --sidebar-active-bg: rgba(184,146,42,.18);
    --sidebar-text:  rgba(255,255,255,.78);
    --navy:          #14284a;
    --navy2:         #1c3a6e;
    --gold:          #b8922a;
    --gold-l:        #d4ad4c;
    --bg:            #f0ece4;
    --card:          #ffffff;
    --border:        #d6cebe;
    --text:          #1a1a18;
    --muted:         #64605a;
    --success:       #1e7e34;
    --success-bg:    #d4edda;
    --danger:        #b02a37;
    --danger-bg:     #f8d7da;
    --info-bg:       #d1ecf1;
    --info:          #0c5460;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

/* ── Layout ─────────────────────────────────────────────────── */
.admin-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(184,146,42,.25);
}

.sidebar-brand .logo {
    font-family: 'Oswald', sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #fff;
    text-transform: uppercase;
}
.sidebar-brand .logo span { color: var(--gold); }

.sidebar-brand .tagline {
    font-size: 10px;
    color: rgba(255,255,255,.4);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--sidebar-text);
    font-size: 13px;
    letter-spacing: .4px;
    border-left: 3px solid transparent;
    transition: all .18s;
    cursor: pointer;
}
.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: rgba(184,146,42,.5);
}
.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--gold);
    border-left-color: var(--gold);
    font-weight: 600;
}
.nav-item i { width: 17px; text-align: center; font-size: 14px; }

.nav-section-label {
    padding: 16px 20px 6px;
    font-size: 10px;
    color: rgba(255,255,255,.3);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 500;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 12px 0;
}

.nav-item.logout:hover {
    color: #ff7b7b;
    background: rgba(220,53,69,.1);
    border-left-color: #ff7b7b;
}

/* ── Main ───────────────────────────────────────────────────── */
.main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}

.page-header {
    background: var(--navy);
    color: #fff;
    padding: 18px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--gold);
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-header h1 {
    font-family: 'Oswald', sans-serif;
    font-size: 20px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}
.page-header-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: rgba(255,255,255,.6);
}
.page-header-meta a { color: var(--gold); transition: color .15s; }
.page-header-meta a:hover { color: var(--gold-l); }

.content-area {
    padding: 28px 30px;
    flex: 1;
}

/* ── Stat cards ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card);
    border-radius: 4px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--navy2);
}
.stat-card.gold::before { background: var(--gold); }
.stat-card.green::before { background: #28a745; }

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 500;
}
.stat-value {
    font-size: 36px;
    font-weight: 700;
    font-family: 'Oswald', sans-serif;
    color: var(--navy);
    line-height: 1;
}
.stat-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    color: rgba(20,40,74,.08);
}

/* ── Chart cards ────────────────────────────────────────────── */
.chart-card, .data-card {
    background: var(--card);
    border-radius: 4px;
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    margin-bottom: 22px;
}
.chart-card h3, .data-card h3 {
    font-family: 'Oswald', sans-serif;
    color: var(--navy);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-card h3 i, .data-card h3 i { color: var(--gold); }

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 22px;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: var(--navy);
    color: #fff;
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    white-space: nowrap;
}
.data-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(184,146,42,.04); }
.data-table .muted { color: var(--muted); font-size: 12px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    text-decoration: none;
    transition: all .18s;
    letter-spacing: .3px;
    line-height: 1;
    white-space: nowrap;
}
.btn-primary  { background: var(--navy);  color: #fff; }
.btn-primary:hover  { background: var(--navy2); }
.btn-gold    { background: var(--gold);  color: #fff; }
.btn-gold:hover    { background: var(--gold-l); color: #fff; }
.btn-danger  { background: #c82333; color: #fff; }
.btn-danger:hover  { background: #a71d2a; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 11px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    color: var(--muted);
}
.form-label .required { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    background: #fff;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184,146,42,.12);
}
textarea.form-control { resize: vertical; min-height: 110px; font-family: monospace; }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ── Section card ───────────────────────────────────────────── */
.section-card {
    background: var(--card);
    border-radius: 4px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    margin-bottom: 24px;
    overflow: hidden;
}
.section-card-head {
    background: var(--navy);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.section-card-head h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-card-head h3 i { color: var(--gold); }
.section-card-body { padding: 22px; }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    gap: 0;
    overflow-x: auto;
}
.tab-btn {
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    transition: all .15s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active {
    color: var(--navy);
    border-bottom-color: var(--gold);
    font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 3px;
    margin-bottom: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: #b1dfbb; }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border-color: #f1aeb5; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: #9eeaf9; }

/* ── Counters page ──────────────────────────────────────────── */
.counter-list { }
.counter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    gap: 20px;
}
.counter-row:last-child { border-bottom: none; }
.counter-meta { flex: 1; }
.counter-name { font-weight: 600; font-size: 15px; color: var(--navy); margin-bottom: 3px; }
.counter-detail { font-size: 11px; color: var(--muted); }
.counter-count {
    font-size: 42px;
    font-weight: 700;
    font-family: 'Oswald', sans-serif;
    color: var(--gold);
    min-width: 80px;
    text-align: right;
    line-height: 1;
}
.counter-actions { display: flex; gap: 8px; }

/* ── Filter bar ─────────────────────────────────────────────── */
.filter-bar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 120px; }

/* ── Login ──────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(28,58,110,.6) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(140,28,44,.3) 0%, transparent 60%);
}
.login-card {
    background: var(--card);
    border-radius: 6px;
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 25px 60px rgba(0,0,0,.45);
}
.login-logo {
    font-family: 'Oswald', sans-serif;
    font-size: 36px;
    font-weight: 700;
    color: var(--navy);
    text-align: center;
    letter-spacing: 4px;
    margin-bottom: 6px;
}
.login-logo span { color: var(--gold); }
.login-subtitle { text-align: center; color: var(--muted); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 28px; }
.login-card .form-control { width: 100%; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: 14px; margin-top: 4px; }
.login-footer { text-align: center; margin-top: 20px; font-size: 11px; color: var(--muted); }

/* ── Install page ───────────────────────────────────────────── */
.install-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
}
.install-card {
    background: var(--card);
    border-radius: 4px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 680px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    overflow: hidden;
}
.install-card-head {
    background: var(--navy);
    color: #fff;
    padding: 20px 28px;
}
.install-card-head h1 { font-family: 'Oswald', sans-serif; font-size: 22px; letter-spacing: 2px; text-transform: uppercase; }
.install-card-body { padding: 28px; }
.step { margin-bottom: 18px; padding: 14px 18px; border-radius: 3px; border: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.step.ok  { border-color: #b1dfbb; background: #eafaf0; }
.step.err { border-color: #f1aeb5; background: #fdf0f1; }
.step i.fa-check { color: var(--success); }
.step i.fa-times  { color: var(--danger); }
.step-text { flex: 1; font-size: 13px; }
.credentials-box {
    background: var(--navy);
    color: #fff;
    border-radius: 4px;
    padding: 20px;
    margin: 16px 0;
    font-family: monospace;
    font-size: 15px;
    border-left: 4px solid var(--gold);
}
.credentials-box .cred-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.5); margin-bottom: 4px; }
.credentials-box .cred-val { font-size: 20px; color: var(--gold-l); font-weight: bold; }

/* ── Badge ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.badge-gold   { background: rgba(184,146,42,.15); color: var(--gold); }
.badge-navy   { background: rgba(20,40,74,.12);   color: var(--navy); }
.badge-green  { background: rgba(40,167,69,.15);  color: #1e7e34; }
.badge-red    { background: rgba(220,53,69,.15);  color: #a71d2a; }

/* ── Misc ───────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.text-muted { color: var(--muted); }
.text-gold  { color: var(--gold); }
.mt-0  { margin-top: 0 !important; }
.mb-0  { margin-bottom: 0 !important; }
.mb-20 { margin-bottom: 20px; }
.flex  { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-10 { gap: 10px; }


/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .admin-layout { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: -260px; z-index: 200; transition: left .25s; height: 100vh; }
    .sidebar.open { left: 0; }
    .mobile-toggle { display: flex; align-items: center; gap: 8px; }
    .charts-row { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
@media (min-width: 901px) {
    .mobile-toggle { display: none; }
}
