/* ============================================
   NGAJI DASHBOARD - Global Styles
   Aesthetic: Islamic-inspired modern geometric
   Palette: Deep teal, gold, warm off-white
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
    --primary: #0a4f5c;
    --primary-light: #0e6b7c;
    --primary-dark: #062f38;
    --accent: #c9a84c;
    --accent-light: #e4c170;
    --accent-muted: #f5e8c0;
    --surface: #f8f5ef;
    --surface-card: #ffffff;
    --surface-alt: #f0ece2;
    --text-primary: #1a1a1a;
    --text-secondary: #5a5a5a;
    --text-muted: #9a9a9a;
    --border: #e0d8c8;
    --danger: #c0392b;
    --success: #1a7a55;
    --warning: #d4820a;
    --info: #1a5f8a;
    --shadow-sm: 0 2px 8px rgba(10,79,92,0.08);
    --shadow-md: 0 4px 20px rgba(10,79,92,0.12);
    --shadow-lg: 0 8px 40px rgba(10,79,92,0.16);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 18px;
    --font-display: 'Playfair Display', serif;
    --font-body: 'DM Sans', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
}

/* ---- Layout ---- */
.dash-wrapper {
    display: flex;
    min-height: 100vh;
}

.dash-sidebar {
    width: 240px;
    background: var(--primary-dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width 0.3s ease;
}

.dash-sidebar .brand {
    padding: 28px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.dash-sidebar .brand-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-light);
    line-height: 1.2;
}

.dash-sidebar .brand-sub {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}

.dash-sidebar .brand-motif {
    width: 36px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), transparent);
    margin-bottom: 10px;
    border-radius: 2px;
}

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

.nav-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255,255,255,0.3);
    padding: 12px 20px 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 400;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: white;
    border-left-color: rgba(201,168,76,0.4);
}

.sidebar-nav a.active {
    background: rgba(201,168,76,0.12);
    color: var(--accent-light);
    border-left-color: var(--accent);
    font-weight: 500;
}

.sidebar-nav a .nav-icon {
    width: 20px;
    text-align: center;
    opacity: 0.8;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
}

.dash-main {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dash-topbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.dash-topbar .page-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary);
}

.dash-topbar .page-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

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

/* ---- Cards ---- */
.card-dash {
    background: var(--surface-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.card-dash:hover { box-shadow: var(--shadow-md); }

.card-dash .card-header-dash {
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(10,79,92,0.03), rgba(201,168,76,0.04));
}

.card-dash .card-title-dash {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

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

/* ---- Stat Tiles ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-tile {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.stat-tile.teal::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-tile.gold::before { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.stat-tile.green::before { background: linear-gradient(90deg, var(--success), #2ecc71); }
.stat-tile.red::before { background: linear-gradient(90deg, var(--danger), #e74c3c); }
.stat-tile.blue::before { background: linear-gradient(90deg, var(--info), #2980b9); }
.stat-tile.purple::before { background: linear-gradient(90deg, #6c3483, #9b59b6); }

.stat-tile .stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-tile .stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-tile .stat-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.stat-tile .stat-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.4rem;
    opacity: 0.08;
}

/* ---- Badge / Pill ---- */
.badge-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.badge-teal   { background: rgba(10,79,92,0.1);  color: var(--primary); }
.badge-gold   { background: rgba(201,168,76,0.15); color: #7a5c00; }
.badge-green  { background: rgba(26,122,85,0.1);  color: var(--success); }
.badge-red    { background: rgba(192,57,43,0.1);  color: var(--danger); }
.badge-blue   { background: rgba(26,95,138,0.1);  color: var(--info); }
.badge-purple { background: rgba(108,52,131,0.1); color: #6c3483; }
.badge-gray   { background: rgba(0,0,0,0.07);     color: var(--text-secondary); }

/* ---- Filters ---- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}

.filter-bar label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0;
}

.filter-bar select,
.filter-bar input {
    font-family: var(--font-body);
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px;
    color: var(--text-primary);
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.filter-bar select:focus,
.filter-bar input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(10,79,92,0.1);
}

/* ---- Table ---- */
.table-dash {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}

.table-dash thead tr th {
    background: rgba(10,79,92,0.05);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.table-dash tbody tr td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.table-dash tbody tr:hover td { background: rgba(10,79,92,0.025); }
.table-dash tbody tr:last-child td { border-bottom: none; }

/* ---- Chart container ---- */
.chart-container {
    position: relative;
    width: 100%;
}

/* ---- Progress bar ---- */
.prog-bar-wrap {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.prog-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ---- Section header ---- */
.section-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.section-header .section-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- Ornament ---- */
.ornament-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.ornament-bar span {
    display: block;
    height: 3px;
    border-radius: 2px;
}

.ornament-bar .o1 { width: 24px; background: var(--accent); }
.ornament-bar .o2 { width: 12px; background: rgba(201,168,76,0.4); }
.ornament-bar .o3 { width: 6px;  background: rgba(201,168,76,0.2); }

/* ---- Two-column chart layout ---- */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 20px;
}

.chart-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 18px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .chart-row, .chart-row-3 { grid-template-columns: 1fr; }
    .dash-sidebar { width: 60px; }
    .dash-main { margin-left: 60px; }
    .dash-sidebar .brand-title,
    .dash-sidebar .brand-sub,
    .nav-section-label,
    .sidebar-nav a span:last-child { display: none; }
}

/* ---- Loading spinner ---- */
.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    gap: 10px;
}

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

.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.88rem; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Tooltip-like info ---- */
.info-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--accent-muted);
    color: #7a5c00;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 500;
}
