/* =====================================================================
   G-Haan Hub — Admin Dashboard Styles (single source of truth)
   ===================================================================== */
:root {
    --ink: #0a1628;
    --slate: #1b2a41;
    --signal: #17c3b2;
    --signal-dark: #0e9e90;
    --pulse: #2f6fed;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --mist: #f8fafc;
    --light: #f1f5f9;
    --line: #e2e8f0;
    --muted: #64748b;
    --text: #1e293b;
    --text-light: #475569;
    --white: #ffffff;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.04);
    --shadow-lg: 0 20px 25px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.04);
    --font-display: "Space Grotesk", system-ui, sans-serif;
    --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--mist); color: var(--text); line-height: 1.6; }
a { color: var(--pulse); text-decoration: none; transition: all .2s; }
a:hover { color: var(--signal); }
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 700; color: var(--ink); line-height: 1.25; }
img { max-width: 100%; height: auto; display: block; }

/* ---------- AUTH (login) ---------- */
.auth-wrap {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--ink) 0%, var(--slate) 100%);
    padding: 2rem;
}
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow-lg);
}
.auth-card .logo {
    display: block;
    font-family: var(--font-display); font-weight: 800; font-size: 1.5rem;
    color: var(--ink); margin-bottom: .35rem;
}
.auth-card .sub { color: var(--muted); font-size: .95rem; margin-bottom: 2rem; }

/* ---------- LAYOUT SHELL ---------- */
.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px; flex-shrink: 0;
    background: var(--ink); color: #cbd5e1;
    position: fixed; top: 0; bottom: 0; left: 0;
    overflow-y: auto; z-index: 99;
}
.sidebar .brand {
    padding: 1.5rem;
    font-family: var(--font-display); font-weight: 800; font-size: 1.05rem;
    color: var(--white);
    border-bottom: 1px solid var(--slate);
    letter-spacing: .02em;
}
.sidebar .brand span { color: var(--signal); }
.sidebar nav { padding: 1rem 0 2rem; }
.sidebar nav a {
    display: flex; align-items: center; gap: .75rem;
    padding: .8rem 1.5rem;
    color: #94a3b8; font-size: .92rem; font-weight: 500;
    border-left: 3px solid transparent;
    transition: all .2s;
}
.sidebar nav a:hover { background: var(--slate); color: var(--white); }
.sidebar nav a.active { background: var(--slate); color: var(--white); border-left-color: var(--signal); }
.sidebar nav .divider {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
    color: #475569; padding: 1.25rem 1.5rem .5rem; font-weight: 700;
}

.main { flex: 1; margin-left: 260px; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--line);
    padding: 1.1rem 2rem;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow-xs);
}
.topbar h1 { font-size: 1.25rem; margin: 0; }
.topbar .user { display: flex; align-items: center; gap: 1rem; }

.content { flex: 1; padding: 2rem; }

/* ---------- PAGE HEADER ---------- */
.admin-header { margin-bottom: 2rem; }
.admin-header h1 { font-size: 1.7rem; margin-bottom: .35rem; }
.admin-header p { color: var(--text-light); margin: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- STAT CARDS ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem; margin-bottom: 2rem;
}
.stat-box {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.5rem;
    transition: all .2s;
}
.stat-box:hover { border-color: var(--signal); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-box .label {
    font-size: .72rem; color: var(--muted); margin-bottom: .6rem;
    font-family: var(--font-display); text-transform: uppercase;
    letter-spacing: .06em; font-weight: 700;
}
.stat-box .value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--ink); line-height: 1; }
.stat-box .change { font-size: .8rem; margin-top: .5rem; color: var(--success); }

/* ---------- PANELS ---------- */
.panel {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); margin-bottom: 1.5rem;
    overflow: hidden; box-shadow: var(--shadow-xs);
}
.panel-head {
    padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    background: var(--mist); flex-wrap: wrap;
}
.panel-head h3 { font-size: 1.05rem; margin: 0; }
.panel-body { padding: 1.5rem; }

/* ---------- TABLES ---------- */
.table-responsive { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th {
    text-align: left; padding: .9rem 1rem; background: var(--mist);
    color: var(--ink); font-family: var(--font-display); font-weight: 700;
    font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
    border-bottom: 2px solid var(--line); white-space: nowrap;
}
table.data td { padding: .9rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--text); }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--mist); }

/* ---------- FORMS ---------- */
.form-group { margin-bottom: 1.5rem; }
.form-group > label { display: block; margin-bottom: .5rem; font-weight: 600; color: var(--ink); font-size: .92rem; }
.form-control {
    width: 100%; padding: .8rem 1rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    font-family: var(--font-body); font-size: .95rem; color: var(--text);
    background: var(--white); transition: all .2s;
}
.form-control:focus {
    outline: none; border-color: var(--signal);
    box-shadow: 0 0 0 3px rgba(23,195,178,.12);
}
textarea.form-control { resize: vertical; min-height: 120px; line-height: 1.6; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }
.form-help, .form-hint { font-size: .82rem; color: var(--muted); margin-top: .35rem; display: block; }
.error-message { color: var(--error); font-size: .82rem; margin-top: .35rem; }
input[type="file"].form-control { padding: .55rem .75rem; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--signal); }

/* ---------- ALERTS ---------- */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.5rem; border-left: 4px solid; font-size: .92rem; }
.alert-success { background: rgba(16,185,129,.1); border-left-color: var(--success); color: #065f46; }
.alert-error { background: rgba(239,68,68,.1); border-left-color: var(--error); color: #7f1d1d; }
.alert-warning { background: rgba(245,158,11,.1); border-left-color: var(--warning); color: #78350f; }
.alert-info { background: rgba(47,110,237,.1); border-left-color: var(--pulse); color: #1e3a8a; }

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font-family: var(--font-display); font-weight: 700; font-size: .92rem;
    padding: .7rem 1.4rem; border: none; border-radius: var(--radius);
    cursor: pointer; transition: all .2s; white-space: nowrap; text-decoration: none;
}
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: var(--slate); box-shadow: var(--shadow-md); transform: translateY(-1px); color: var(--white); }
.btn-accent { background: var(--signal); color: var(--white); }
.btn-accent:hover { background: var(--signal-dark); box-shadow: var(--shadow-md); color: var(--white); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--mist); border-color: var(--muted); }
.btn-danger { background: var(--error); color: var(--white); }
.btn-danger:hover { background: #dc2626; color: var(--white); }
.btn-block { width: 100%; }
.btn-sm { padding: .5rem 1rem; font-size: .82rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- BADGES / PILLS ---------- */
.badge { display: inline-block; padding: .3rem .7rem; border-radius: 9999px; font-size: .72rem; font-weight: 700; }
.badge-teal { background: rgba(23,195,178,.12); color: var(--signal-dark); }
.badge-green { background: rgba(16,185,129,.12); color: #065f46; }
.badge-gray { background: var(--light); color: var(--muted); }
.badge-amber { background: rgba(245,158,11,.12); color: #92400e; }
.pill { display: inline-block; padding: .3rem .75rem; border-radius: 9999px; font-size: .78rem; font-weight: 600; background: var(--light); color: var(--text-light); }

/* ---------- DROPDOWN ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-btn {
    background: transparent; border: 1px solid var(--line); padding: .5rem 1rem;
    cursor: pointer; font-size: .9rem; color: var(--text);
    font-family: var(--font-body); border-radius: var(--radius); transition: all .2s;
    display: flex; align-items: center; gap: .5rem;
}
.dropdown-btn:hover { background: var(--mist); }
.dropdown-menu {
    position: absolute; top: 100%; right: 0;
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-md);
    min-width: 190px; z-index: 100; display: none;
    margin-top: .5rem; overflow: hidden; padding: .35rem 0;
}
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-logout {
    display: block; width: 100%; padding: .6rem 1rem;
    color: var(--text); font-size: .88rem; background: none; border: none;
    text-align: left; cursor: pointer; transition: all .15s; font-family: var(--font-body);
}
.dropdown-menu a:hover, .dropdown-logout:hover { background: var(--mist); color: var(--signal-dark); }
.dropdown-menu hr { border: none; border-top: 1px solid var(--line); margin: .35rem 0; }
.inline-form { margin: 0; }

/* ---------- EMPTY STATE ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .es-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { color: var(--ink); margin-bottom: .5rem; }

/* ---------- UTILITIES ---------- */
.mb-2 { margin-bottom: 1rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.thumb-sm { width: 56px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1024px) {
    .sidebar { width: 72px; }
    .sidebar nav a { justify-content: center; padding: .85rem 0; }
    .sidebar nav a span.txt { display: none; }
    .sidebar nav .divider { display: none; }
    .main { margin-left: 72px; }
}
@media (max-width: 640px) {
    .content { padding: 1.25rem; }
    .topbar { padding: 1rem 1.25rem; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .panel-head { flex-direction: column; align-items: flex-start; }
    table.data { font-size: .82rem; }
    table.data th, table.data td { padding: .65rem .6rem; }
}
@media (max-width: 420px) {
    .stat-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 2rem 1.5rem; }
}

/* Missing badge variants + legacy empty class */
.badge-blue { background: rgba(47,110,237,.12); color: #1e3a8a; }
.badge-red { background: rgba(239,68,68,.12); color: #7f1d1d; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty a { color: var(--signal-dark); font-weight: 600; }

/* Brand logo in sidebar */
.brand-logo { height: 34px; width: auto; border-radius: 6px; display: inline-block; vertical-align: middle; }
.sidebar .brand { display: flex; align-items: center; gap: .6rem; }
@media (max-width: 1024px) {
    .sidebar .brand .txt { display: none; }
    .sidebar .brand { justify-content: center; font-size: inherit; padding: 1.25rem 0; }
}
