/* ============================================================================
   MORESCO-1 Admin — shared "Aurora Control Room" theme
   ----------------------------------------------------------------------------
   Loaded AFTER each page's inline <style>, so equal-specificity rules here win
   and every admin page is upgraded at once (they all share the same class
   names). This file only enhances visuals + fixes the content scroll; it never
   restructures layout (no changes to display/flex/width on .sidebar/.main).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&display=swap');

/* ---- Design tokens (override the per-page :root) ------------------------- */
:root {
    --primary: #6d6afc;
    --primary-light: #9b8cff;
    --bg: #070b18;
    --sidebar: rgba(13, 18, 33, 0.72);
    --surface: rgba(22, 29, 48, 0.66);
    --surface-2: rgba(9, 13, 24, 0.85);
    --text: #f3f5fc;
    --text-muted: #9aa6c4;
    --text-dim: #647093;
    --text-secondary: #9aa6c4;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);
    --success: #2ee6a6;
    --warning: #fbbf24;
    --danger: #fb6f7a;
    --info: #45c9ff;

    --grad-primary: linear-gradient(135deg, #6d6afc 0%, #8b5cf6 55%, #22d3ee 130%);
    --grad-text: linear-gradient(120deg, #c7c4ff 0%, #8b9cff 45%, #5ce0ff 100%);
    --ring: 0 0 0 3px rgba(109, 106, 252, 0.28);
    --shadow-card: 0 18px 40px -22px rgba(0, 0, 0, 0.85);
    --display: 'Bricolage Grotesque', 'Plus Jakarta Sans', sans-serif;
}

/* ---- Atmosphere: aurora field behind everything ------------------------- */
html { scroll-behavior: smooth; }
body {
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(55% 45% at 12% 8%, rgba(109, 106, 252, 0.20), transparent 60%),
        radial-gradient(45% 45% at 92% 4%, rgba(69, 201, 255, 0.14), transparent 58%),
        radial-gradient(60% 55% at 82% 92%, rgba(139, 92, 246, 0.16), transparent 62%),
        var(--bg);
}
/* faint grid texture for the "control room" feel */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 75%);
}

/* ---- Typography --------------------------------------------------------- */
.page-title h1,
.sidebar-logo,
.section-title,
.logs-header h2,
.table-head h2,
.stat-value {
    font-family: var(--display);
    letter-spacing: -0.02em;
}
.page-title h1 { font-weight: 700; }
.page-title p { color: var(--text-muted); }

/* ---- Sidebar ------------------------------------------------------------ */
.sidebar {
    background: linear-gradient(180deg, rgba(14, 19, 36, 0.92), rgba(8, 11, 22, 0.86));
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    border-right: 1px solid var(--border);
}
.sidebar-logo {
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.45rem;
    font-weight: 800;
}
.nav-link {
    position: relative;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); transform: translateX(3px); }
.nav-link .icon { transition: transform 0.2s ease; }
.nav-link:hover .icon { transform: scale(1.08); }
.nav-link.active {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: 0 10px 26px -8px rgba(109, 106, 252, 0.7);
}
.nav-link.active .icon { color: #fff; }
.logout-btn { transition: background 0.2s ease, transform 0.2s ease; }
.logout-btn:hover { transform: translateX(3px); }

/* ---- Glass surfaces (cards, panels, bars) ------------------------------- */
.stat-card,
.section-card,
.method-card,
.table-card,
.logs-container,
.chart-card,
.sparkline-card,
.filter-bar,
.qr-box,
.install-info {
    background: var(--surface);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}
/* keep the QR backdrop readable (it needs a light field for scanning) */
.qr-box { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; }

.stat-card { transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease; }
.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.9);
}
.section-card, .table-card, .chart-card, .logs-container { transition: border-color 0.22s ease; }

/* ---- Buttons ------------------------------------------------------------ */
.btn-primary,
.btn-submit,
.copy-btn,
.btn.save {
    background: var(--grad-primary);
    border: none;
    color: #fff;
    box-shadow: 0 8px 20px -8px rgba(109, 106, 252, 0.6);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.btn-primary:hover,
.btn-submit:hover,
.copy-btn:hover,
.btn.save:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -8px rgba(109, 106, 252, 0.72);
    filter: brightness(1.06);
}
.btn-ghost { transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.04); }

/* ---- Inputs / selects / textareas --------------------------------------- */
input, select, textarea,
.filter-field input, .filter-field select, .msg-input {
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
input:focus, select:focus, textarea:focus,
.filter-field input:focus, .filter-field select:focus, .msg-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: var(--ring);
    background: rgba(9, 13, 24, 0.95);
}
select option { background: #0c1222; color: var(--text); }

/* ---- Tables / rows ------------------------------------------------------ */
th { color: var(--text-muted); letter-spacing: 0.06em; }
tbody tr, .log-row { transition: background 0.15s ease; }
tbody tr:hover, .log-row:hover {
    background: linear-gradient(90deg, rgba(109, 106, 252, 0.08), rgba(109, 106, 252, 0.02));
}

/* ---- Badges / pills get a touch more pop -------------------------------- */
.badge, .level-badge, .ev-badge, .st, .pill { backdrop-filter: blur(4px); }

/* ---- Content scroll fix (some pages lacked it) + page reveal ------------ */
.main-content {
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    animation: amFadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
    scroll-padding-top: 1rem;
}
/* staggered entrance for the primary blocks */
.stats-strip, .stats-grid,
.section-card, .table-card, .chart-card, .sparkline-card,
.filter-bar, .logs-container {
    animation: amFadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.stats-strip { animation-delay: 0.04s; }
.sparkline-card, .chart-card { animation-delay: 0.10s; }
.filter-bar { animation-delay: 0.14s; }
.table-card, .logs-container { animation-delay: 0.18s; }
.stat-card { animation: amPop 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.20s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }

@keyframes amFadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
@keyframes amPop {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, .main-content, .stat-card { animation: none !important; transition: none !important; }
}

/* ---- Custom scrollbar + selection --------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: rgba(109, 106, 252, 0.55) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #6d6afc, #8b5cf6);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #8b8aff, #a78bfa); background-clip: padding-box; }
::selection { background: rgba(109, 106, 252, 0.38); color: #fff; }

/* ---- Login page (scoped to .login-card so it can't affect dashboards) --- */
.login-card {
    background: var(--surface);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    animation: amPop 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.login-card .logo,
.login-card h1 {
    font-family: var(--display);
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.login-card button {
    background: var(--grad-primary);
    box-shadow: 0 8px 20px -8px rgba(109, 106, 252, 0.6);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.login-card button:hover { transform: translateY(-2px); filter: brightness(1.08); opacity: 1; }
.login-card button:disabled { filter: grayscale(0.3) brightness(0.8); transform: none; }
