/* ==========================================================================
   AquaDongle — Futuristic UI theme
   Shared by the public pages (access gate, file manager, error pages)
   and the admin login. Loaded AFTER Bootstrap so it can restyle it.
   ========================================================================== */

:root {
    --bg-0: #03050c;
    --bg-1: #070b18;
    --bg-2: #0c1226;
    --panel: rgba(13, 20, 42, 0.62);
    --panel-solid: #0d142a;
    --panel-hi: rgba(22, 33, 66, 0.72);
    --line: rgba(120, 160, 255, 0.14);
    --line-strong: rgba(120, 180, 255, 0.28);

    --text: #e6edff;
    --text-dim: #93a1c4;
    --text-faint: #5d6a8c;

    --cyan: #22e3ff;
    --cyan-rgb: 34, 227, 255;
    --violet: #9b6bff;
    --violet-rgb: 155, 107, 255;
    --magenta: #ff3cac;
    --green: #2dffb3;
    --green-rgb: 45, 255, 179;
    --amber: #ffb547;
    --amber-rgb: 255, 181, 71;
    --red: #ff4d6d;
    --red-rgb: 255, 77, 109;

    --grad-accent: linear-gradient(120deg, var(--cyan) 0%, var(--violet) 55%, var(--magenta) 100%);
    --grad-btn: linear-gradient(120deg, #18c8ff 0%, #7c5cff 100%);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;

    --font-display: 'Orbitron', 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', 'SFMono-Regular', monospace;

    --glow-cyan: 0 0 0 1px rgba(var(--cyan-rgb), .35), 0 0 24px rgba(var(--cyan-rgb), .25);
    --shadow-panel: 0 30px 80px -30px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .04);

    --text-strong: #ffffff;
    --accent-text: #8ff1ff;
    --surface-1: rgba(255, 255, 255, .02);
    --surface-2: rgba(255, 255, 255, .045);
    --input-bg: rgba(3, 6, 16, .6);
    --track: rgba(255, 255, 255, .06);
    --menu-bg: rgba(10, 16, 34, .95);
    --topbar-bg: rgba(3, 5, 12, .7);
    --grid-line: rgba(var(--cyan-rgb), .16);
    --scanline: rgba(255, 255, 255, .018);
    --orb-opacity: .35;
    --err-text: #ffc2cd;
    --ok-text: #b9ffe6;
    --warn-text: #ffe2b3;

    color-scheme: dark;
}

/* ---------- Light theme (toggle stored per visitor, see assets/js/theme.js) ---------- */
:root[data-theme="light"] {
    --bg-0: #eef2fa;
    --bg-1: #f8faff;
    --bg-2: #e3e9f6;
    --panel: rgba(255, 255, 255, .74);
    --panel-solid: #ffffff;
    --panel-hi: rgba(255, 255, 255, .92);
    --line: rgba(30, 60, 140, .13);
    --line-strong: rgba(30, 60, 140, .24);

    --text: #0c1430;
    --text-dim: #46547a;
    --text-faint: #6f7c9e;
    --text-strong: #050a1c;

    --cyan: #0891b2;
    --cyan-rgb: 8, 145, 178;
    --violet: #6d3df5;
    --violet-rgb: 109, 61, 245;
    --magenta: #d1207a;
    --green: #059669;
    --green-rgb: 5, 150, 105;
    --amber: #b45309;
    --amber-rgb: 180, 83, 9;
    --red: #e11d48;
    --red-rgb: 225, 29, 72;

    --grad-btn: linear-gradient(120deg, #0aa8db 0%, #6a4bff 100%);
    --glow-cyan: 0 0 0 1px rgba(var(--cyan-rgb), .3), 0 6px 18px rgba(var(--cyan-rgb), .15);
    --shadow-panel: 0 24px 60px -30px rgba(30, 50, 110, .35), inset 0 1px 0 rgba(255, 255, 255, .7);

    --accent-text: #0e7490;
    --surface-1: rgba(20, 40, 100, .035);
    --surface-2: rgba(20, 40, 100, .06);
    --input-bg: #ffffff;
    --track: rgba(20, 40, 100, .09);
    --menu-bg: rgba(255, 255, 255, .97);
    --topbar-bg: rgba(248, 250, 255, .8);
    --grid-line: rgba(8, 145, 178, .13);
    --scanline: transparent;
    --orb-opacity: .16;
    --err-text: #9f1239;
    --ok-text: #065f46;
    --warn-text: #92400e;

    color-scheme: light;
}

/* Bootstrap variable bridge so stock components inherit the theme */
:root,
[data-bs-theme] {
    --bs-body-bg: var(--bg-0);
    --bs-body-color: var(--text);
    --bs-secondary-color: var(--text-dim);
    --bs-tertiary-color: var(--text-faint);
    --bs-border-color: var(--line);
    --bs-emphasis-color: var(--text-strong);
    --bs-link-color: var(--cyan);
    --bs-link-hover-color: var(--accent-text);
    --bs-link-color-rgb: var(--cyan-rgb);
    --bs-primary: var(--cyan);
    --bs-primary-rgb: var(--cyan-rgb);
    --bs-font-sans-serif: var(--font-body);
    --bs-font-monospace: var(--font-mono);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

::selection { background: rgba(var(--cyan-rgb), .35); color: #fff; }

a { color: var(--cyan); }
a:hover { color: var(--accent-text); }

:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ---------- Ambient background -------------------------------------- */
.fx-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background:
        radial-gradient(1200px 700px at 85% -10%, rgba(var(--violet-rgb), .22), transparent 60%),
        radial-gradient(900px 600px at -10% 110%, rgba(var(--cyan-rgb), .16), transparent 60%),
        linear-gradient(180deg, var(--bg-1), var(--bg-0) 70%);
}
.fx-bg::before {           /* perspective grid floor */
    content: '';
    position: absolute;
    left: -50%;
    right: -50%;
    bottom: -10%;
    height: 70%;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 64px 64px;
    transform: perspective(600px) rotateX(62deg);
    transform-origin: center bottom;
    mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 85%);
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 85%);
    animation: grid-drift 14s linear infinite;
}
.fx-bg::after {            /* scanlines + noise */
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, var(--scanline) 0 1px, transparent 1px 3px);
}
.fx-orb {
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: var(--orb-opacity);
    animation: orb-float 18s ease-in-out infinite alternate;
}
.fx-orb.one { background: var(--violet); top: 8%; left: 60%; }
.fx-orb.two { background: var(--cyan); top: 55%; left: 5%; animation-delay: -6s; opacity: calc(var(--orb-opacity) * .65); }

@keyframes grid-drift { to { background-position: 0 64px, 0 0; } }
@keyframes orb-float {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(-60px, 40px) scale(1.15); }
}

/* ---------- Typography helpers -------------------------------------- */
.font-display { font-family: var(--font-display); letter-spacing: .04em; }
.font-mono { font-family: var(--font-mono); }
.text-dim { color: var(--text-dim) !important; }
.text-faint { color: var(--text-faint) !important; }
.text-grad {
    background: var(--grad-accent);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--cyan);
    display: inline-flex;
    align-items: center;
    gap: .55rem;
}
.eyebrow::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Glass panel with HUD corners ---------------------------- */
.panel {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.panel::before {           /* gradient hairline border */
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(140deg, rgba(var(--cyan-rgb), .55), transparent 30%, transparent 70%, rgba(var(--violet-rgb), .55));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
.hud { position: relative; }
.hud > .hud-c {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid var(--cyan);
    opacity: .8;
    pointer-events: none;
}
.hud > .hud-c.tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.hud > .hud-c.tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.hud > .hud-c.bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.hud > .hud-c.br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

/* ---------- Buttons ------------------------------------------------- */
.btn-neo {
    --_bg: var(--grad-btn);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .85rem 1.4rem;
    border: 0;
    border-radius: 12px;
    background: var(--_bg);
    color: #fff;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: .02em;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 10px 30px -10px rgba(var(--cyan-rgb), .6), inset 0 1px 0 rgba(255,255,255,.25);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn-neo::after {          /* sheen sweep */
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform .7s ease;
    z-index: -1;
}
.btn-neo:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 16px 40px -12px rgba(var(--cyan-rgb), .8), inset 0 1px 0 rgba(255,255,255,.3);
}
.btn-neo:hover::after { transform: translateX(120%); }
.btn-neo:active { transform: translateY(0); }
.btn-neo:disabled,
.btn-neo.is-disabled {
    filter: grayscale(.8) brightness(.7);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-neo.btn-lg { padding: 1rem 1.6rem; font-size: 16px; }
.btn-neo.btn-sm { padding: .45rem .85rem; font-size: 13px; border-radius: 9px; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    padding: .75rem 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: var(--surface-1);
    color: var(--text-dim);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: all .2s ease;
}
.btn-ghost:hover {
    color: var(--text);
    border-color: rgba(var(--cyan-rgb), .6);
    background: rgba(var(--cyan-rgb), .06);
    box-shadow: var(--glow-cyan);
}
.btn-ghost.btn-sm { padding: .4rem .7rem; font-size: 13px; border-radius: 9px; }
.btn-icon { width: 38px; height: 38px; padding: 0; }

/* ---------- Form controls ------------------------------------------- */
.input-neo {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    color: var(--text);
    padding: .7rem 1rem;
    font-family: var(--font-body);
    font-size: 14px;
    transition: border-color .2s, box-shadow .2s;
}
.input-neo::placeholder { color: var(--text-faint); }
.input-neo:focus {
    outline: none;
    border-color: rgba(var(--cyan-rgb), .7);
    box-shadow: 0 0 0 4px rgba(var(--cyan-rgb), .12);
}
.form-label-neo {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: .45rem;
}

/* ---------- Alerts -------------------------------------------------- */
.alert-neo {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    border: 1px solid;
    font-size: 14px;
    line-height: 1.5;
    animation: rise .4s ease both;
}
.alert-neo .alert-ico {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    font-size: 14px;
}
.alert-neo small { color: inherit; opacity: .8; }
.alert-neo.is-error   { background: rgba(var(--red-rgb), .08);   border-color: rgba(var(--red-rgb), .35);   color: var(--err-text); }
.alert-neo.is-error   .alert-ico { background: rgba(var(--red-rgb), .18); color: var(--red); }
.alert-neo.is-success { background: rgba(var(--green-rgb), .07); border-color: rgba(var(--green-rgb), .35); color: var(--ok-text); }
.alert-neo.is-success .alert-ico { background: rgba(var(--green-rgb), .16); color: var(--green); }
.alert-neo.is-warn    { background: rgba(var(--amber-rgb), .08); border-color: rgba(var(--amber-rgb), .35); color: var(--warn-text); }
.alert-neo.is-warn    .alert-ico { background: rgba(var(--amber-rgb), .16); color: var(--amber); }
.alert-neo .alert-close {
    margin-left: auto;
    background: none;
    border: 0;
    color: inherit;
    opacity: .6;
    cursor: pointer;
    padding: 2px 4px;
}
.alert-neo .alert-close:hover { opacity: 1; }

/* ---------- Progress / meters --------------------------------------- */
.meter {
    position: relative;
    height: 10px;
    border-radius: 99px;
    background: var(--track);
    border: 1px solid var(--line);
    overflow: hidden;
}
.meter > span {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--cyan), var(--violet));
    box-shadow: 0 0 16px rgba(var(--cyan-rgb), .6);
    transition: width 1s cubic-bezier(.2, .8, .2, 1);
}
.meter > span::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(115deg, rgba(255,255,255,.18) 0 8px, transparent 8px 16px);
    animation: stripes 1.2s linear infinite;
}
.meter.is-warn > span { background: linear-gradient(90deg, var(--amber), var(--magenta)); box-shadow: 0 0 16px rgba(var(--amber-rgb), .6); }
@keyframes stripes { to { background-position: 32px 0; } }

/* ---------- Chips / tags -------------------------------------------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .25rem .6rem;
    border-radius: 99px;
    border: 1px solid var(--line-strong);
    background: var(--surface-1);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .06em;
    color: var(--text-dim);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

/* ---------- Spinner ------------------------------------------------- */
.spinner-neo {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.25);
    border-top-color: #fff;
    animation: spin .8s linear infinite;
    display: inline-block;
    flex: 0 0 auto;
}
.spinner-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(var(--cyan-rgb), .15);
    border-top-color: var(--cyan);
    border-right-color: var(--violet);
    animation: spin 1s linear infinite;
    box-shadow: 0 0 30px rgba(var(--cyan-rgb), .3);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toasts -------------------------------------------------- */
.toast-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(380px, calc(100vw - 32px));
}
.toast-neo {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .85rem 1rem;
    border-radius: 12px;
    background: var(--menu-bg);
    border: 1px solid var(--line-strong);
    border-left: 3px solid var(--cyan);
    box-shadow: 0 20px 40px -15px rgba(0,0,0,.45);
    backdrop-filter: blur(12px);
    color: var(--text);
    font-size: 14px;
    animation: toast-in .35s cubic-bezier(.2,.8,.2,1) both;
}
.toast-neo.is-leaving { animation: toast-out .25s ease forwards; }
.toast-neo i.t-ico { margin-top: 3px; }
.toast-neo.success { border-left-color: var(--green); } .toast-neo.success i.t-ico { color: var(--green); }
.toast-neo.error   { border-left-color: var(--red); }   .toast-neo.error   i.t-ico { color: var(--red); }
.toast-neo.warning { border-left-color: var(--amber); } .toast-neo.warning i.t-ico { color: var(--amber); }
.toast-neo.info i.t-ico { color: var(--cyan); }
.toast-neo .t-close { margin-left: auto; background: none; border: 0; color: var(--text-faint); cursor: pointer; }
.toast-neo .t-close:hover { color: var(--text); }
@keyframes toast-in  { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(30px); } }

/* ---------- Theme switch ------------------------------------------- */
.theme-switch {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 11px;
    border: 1px solid var(--line-strong);
    background: var(--surface-1);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 15px;
    transition: color .2s, border-color .2s, box-shadow .2s, background .2s;
}
.theme-switch:hover { color: var(--cyan); border-color: rgba(var(--cyan-rgb), .6); box-shadow: var(--glow-cyan); }
.theme-switch .fa-sun { display: none; }
:root[data-theme="light"] .theme-switch .fa-sun { display: inline-block; }
:root[data-theme="light"] .theme-switch .fa-moon { display: none; }
.theme-switch.is-floating {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 1990;
    background: var(--menu-bg);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px -12px rgba(0,0,0,.5);
}
:root.theme-anim, :root.theme-anim * { transition: background-color .35s ease, color .35s ease, border-color .35s ease !important; }

/* ---------- Generic motion ------------------------------------------ */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.rise { animation: rise .6s cubic-bezier(.2,.8,.2,1) both; }
.rise.d1 { animation-delay: .08s; }
.rise.d2 { animation-delay: .16s; }
.rise.d3 { animation-delay: .24s; }
.rise.d4 { animation-delay: .32s; }

/* ---------- Scrollbar ----------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: rgba(var(--cyan-rgb), .35) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(var(--cyan-rgb), .25); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--cyan-rgb), .45); }

/* ---------- Accessibility ------------------------------------------- */
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

@media print {
    .fx-bg, .toast-stack, .no-print { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
    .panel { box-shadow: none !important; backdrop-filter: none !important; border: 1px solid #ccc !important; }
}
