/* ============================================================
   FamAPI Admin Theme — Canva-inspired with #a370fc purple
   ============================================================ */
:root {
    --canvas: #f9fafb;
    --ink: #000000;
    --body: #4b5563;
    --muted: #6b7280;
    --muted-soft: #9ca3af;
    --hairline: #e5e7eb;
    --hairline-soft: #f3f4f6;
    --border: #e5e7eb;
    --surface-hover: rgba(163, 112, 252, 0.08);
    --soft: rgba(163, 112, 252, 0.12);
    --surface-soft: #ffffff;
    --surface-strong: #f3f4f6;
    --surface-dark: #0a0a0a;
    --surface-dark-elevated: #1a1a1a;
    --primary: #a370fc;
    --primary-active: #8b5cf6;
    --primary-disabled: #d1d5db;
    --up: #10b981;
    --down: #ef4444;
    --yellow: #f59e0b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,.1);
    --shadow-soft: 0 4px 12px rgba(163,112,252,.15);
    --grad: linear-gradient(135deg, #a370fc 0%, #8b5cf6 100%);
    --brand: #a370fc;
}

body { 
    background: var(--canvas); 
    color: var(--body); 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(59,130,246,.35); color: #ffffff; }

/* ---------- Top Navbar ---------- */
.topnav {
    background: rgba(11, 19, 41, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--hairline);
    padding: 0.8rem 0;
}
.topnav .nav-logo { 
    color: var(--ink); 
    font-weight: 800;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.topnav .nav-logo .nav-logo-accent { 
    background: var(--grad); 
    -webkit-background-clip: text; 
    background-clip: text; 
    -webkit-text-fill-color: transparent; 
}
.logo-tag { 
    background: rgba(139,92,246,.18); 
    color: #c4b5fd; 
    border: 1px solid rgba(139,92,246,.3);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

/* ---------- Admin Header Topbar ---------- */
.admin-top {
    max-width: 1280px; 
    margin: 0 auto; 
    display: flex; 
    align-items: center;
    justify-content: space-between; 
    gap: 1rem; 
    flex-wrap: wrap;
    padding: 1.5rem 2rem 0.5rem;
}
.admin-top .brand { 
    color: var(--ink); 
    font-size: 1.3rem; 
    font-weight: 800;
    letter-spacing: -.3px; 
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.admin-top .brand .tag {
    background: var(--grad);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(59,130,246,.35);
}
.admin-top .user-box { 
    color: var(--muted); 
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.admin-top .user-box strong { color: var(--ink); }
.admin-top .user-box a { 
    color: #f8fafc; 
    font-weight: 600;
    background: rgba(255,255,255,0.06);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}
.admin-top .user-box a:hover {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
    border-color: rgba(239,68,68,0.3);
}

/* ---------- Nav Pills ---------- */
.admin-nav {
    max-width: 1280px; 
    margin: 0 auto; 
    padding: 1rem 2rem;
    display: flex; 
    gap: 0.5rem; 
    flex-wrap: wrap; 
    align-items: center;
}
.admin-nav a { 
    color: var(--body); 
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.6);
    padding: 0.55rem 1.25rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}
.admin-nav a:hover { 
    background: var(--surface-strong); 
    color: var(--ink); 
    transform: translateY(-2px); 
    border-color: rgba(59,130,246,0.3);
}
.admin-nav a.active {
    background: var(--grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(59,130,246,.4);
}
.admin-nav .logout { 
    color: var(--muted); 
    background: transparent;
}
.admin-nav .logout:hover {
    color: var(--down);
}

/* ---------- Admin Hero Band ---------- */
.admin-hero {
    background:
        radial-gradient(1000px 350px at 85% -20%, rgba(139,92,246,.25), transparent 65%),
        radial-gradient(800px 300px at 10% -30%, rgba(59,130,246,.3), transparent 65%),
        linear-gradient(135deg,#050811 0%,#0b1329 55%,#15102a 100%);
    border-bottom: 1px solid var(--hairline);
    padding: 2.2rem 2rem;
    position: relative;
    overflow: hidden;
}
.admin-hero-inner {
    max-width: 1280px; 
    margin: 0 auto; 
    display: flex; 
    align-items: flex-end;
    justify-content: space-between; 
    gap: 1.5rem; 
    flex-wrap: wrap;
}
.admin-hero h1 { 
    color: #ffffff; 
    font-size: 1.9rem; 
    font-weight: 800;
    letter-spacing: -.5px; 
    margin-bottom: 0.3rem;
}
.admin-hero p { 
    color: #94a3b8; 
    font-size: 0.95rem;
}

/* ---------- Stat Cards Grid ---------- */
.admin-wrap { 
    max-width: 1280px; 
    margin: 0 auto; 
    padding: 2rem 2rem 5rem; 
}
.stat-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); 
    gap: 1.25rem; 
    margin-bottom: 2rem; 
}
.stat-card {
    background: linear-gradient(165deg, rgba(15, 23, 42, 0.9), rgba(11, 19, 41, 0.9));
    border: 1px solid var(--hairline);
    border-radius: 16px;
    padding: 1.35rem;
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
    backdrop-filter: blur(8px);
}
.stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(240px 90px at 90% -10%, rgba(59,130,246,.15), transparent 70%);
    pointer-events: none;
}
.stat-card:hover { 
    transform: translateY(-4px); 
    border-color: rgba(96,165,250,.5); 
    box-shadow: 0 16px 36px rgba(5,8,17,.7); 
}
.stat-card.primary { 
    border-color: rgba(59,130,246,.45); 
    box-shadow: inset 0 0 0 1px rgba(59,130,246,.15), 0 12px 32px rgba(5,8,17,.6); 
}
.stat-label { 
    color: var(--text-muted, #94a3b8); 
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}
.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
    font-family: 'Space Grotesk', var(--font-sans);
    line-height: 1.2;
}
.stat-value.up { color: #10b981; }
.stat-value.down { color: #ef4444; }

.stat-desc {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.4rem;
}

/* ---------- Table & Cards ---------- */
.card {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.75rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}
.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
table.data-table th {
    text-align: left;
    padding: 0.9rem 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.4);
}
table.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    vertical-align: middle;
}
table.data-table tr:hover td {
    background: rgba(59, 130, 246, 0.04);
}
.badge-status {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.badge-status.success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-status.pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-status.failed { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

/* ---------- Form Controls ---------- */
.form-control, select.form-control {
    background: #0b1329;
    border: 1px solid var(--border);
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    outline: none;
    font-size: 0.9rem;
    width: 100%;
    transition: border-color 0.2s ease;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}