/* ==========================================================================
   Danak AI design tokens
   --------------------------------------------------------------------------
   Single source of truth for colour, radius and type. Templates reference
   these instead of hard-coding hex values, so the palette can change in one
   place - which is what makes a real light theme possible.

   Values here are the ones already in use across the templates; this file
   named them, it did not change them.

   Loaded after Bootstrap in base.html. It deliberately sets no element-level
   styles yet: Bootstrap still supplies the reset and font stack, and
   overriding those here would shift the rendering of every page.
   ========================================================================== */

:root {
    /* --- Brand ------------------------------------------------------------
       Exposed as raw channels so alpha washes below can be derived from one
       value rather than repeating the literal in a dozen rgba() calls. */
    --accent-rgb: 0, 212, 255;
    --accent: rgb(var(--accent-rgb));
    --accent-bright: #33DDFF;                /* hover state for solid accent */
    --accent-alt: #7B61FF;                   /* gradient partner, never solo */
    --accent-gradient: linear-gradient(90deg, var(--accent), var(--accent-alt));

    /* --- Surfaces, darkest first ----------------------------------------- */
    --bg: #060B16;                           /* page */
    --bg-footer: #080D1A;
    --surface-sunken: #0A1020;               /* inputs, sidebar */
    --surface: #0C1221;                      /* cards, panels */

    /* --- Text, brightest first -------------------------------------------- */
    --text: #E8EDF2;                         /* headings, body */
    --text-secondary: #C8D8E4;               /* card body copy */
    --text-label: #8FA3B1;                   /* form labels */
    --text-muted: #6B7E8F;                   /* supporting copy */
    --text-dim: #4A5D6E;                     /* disabled, footer */

    /* --- Status ------------------------------------------------------------ */
    --danger: #FF6B6B;
    --danger-text: #FF8A8A;
    --danger-bg: rgba(255, 107, 107, 0.1);
    --danger-border: rgba(255, 107, 107, 0.25);
    --success: #4ECBA0;
    --success-bg: rgba(29, 158, 117, 0.15);
    --success-border: rgba(29, 158, 117, 0.3);
    --warning: #ca8a04;
    --warning-bg: rgba(202, 138, 4, 0.1);
    --warning-border: rgba(202, 138, 4, 0.3);

    /* --- Accent washes, weakest first --------------------------------------
       Borders and fills are the same hue at different alphas. Named by role
       so a template says what it means; the numeric drift that existed
       before (0.12 vs 0.15 borders on identical cards) collapses here. */
    --fill-subtle: rgba(var(--accent-rgb), 0.08);
    --fill: rgba(var(--accent-rgb), 0.12);
    --fill-hover: rgba(var(--accent-rgb), 0.2);
    --border-soft: rgba(var(--accent-rgb), 0.12);
    --border: rgba(var(--accent-rgb), 0.15);
    --border-strong: rgba(var(--accent-rgb), 0.3);
    --border-focus: rgba(var(--accent-rgb), 0.5);
    --overlay-hover: rgba(255, 255, 255, 0.06);

    /* --- Effects ----------------------------------------------------------- */
    --focus-ring: 0 0 0 3px rgba(var(--accent-rgb), 0.08);
    --glow: 0 0 16px rgba(var(--accent-rgb), 0.2);
    --transition: 0.2s;

    /* --- Radius ------------------------------------------------------------ */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 14px;

    /* --- Type --------------------------------------------------------------
       This is Bootstrap's stack, copied verbatim. Nothing applies it yet, so
       recording it here means dropping Bootstrap later will not change a
       single glyph. */
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
        "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji",
        "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --font-mono: "Fira Code", "Consolas", monospace;
}


/* ==========================================================================
   Components
   --------------------------------------------------------------------------
   One definition per widget, replacing the per-page copies that had drifted
   apart (cards with three different border alphas, four sizes of the same
   ghost button). Pages supply layout - width, placement, grid - and leave
   the skin to these classes.
   ========================================================================== */

/* --- Card ----------------------------------------------------------------
   Padding is a default, not a rule: a login panel and a settings row are
   the same surface at different sizes, so pages override just that. */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

/* For cards that are themselves a link or otherwise clickable. */
.card--interactive {
    transition: border-color var(--transition), transform var(--transition);
}

.card--interactive:hover {
    border-color: var(--border-strong);
    transform: translateY(-3px);
}


/* --- Form fields ---------------------------------------------------------- */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field > label {
    font-size: 0.85rem;
    color: var(--text-label);
    letter-spacing: 0.03em;
}

.input,
.field input,
.field select,
.field textarea {
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.65rem 0.9rem;
    outline: none;
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--border-focus);
    box-shadow: var(--focus-ring);
}

.field-error {
    font-size: 0.8rem;
    color: var(--danger);
}

.field-help {
    font-size: 0.78rem;
    color: var(--text-muted);
}


/* --- Buttons --------------------------------------------------------------
   .btn is the accent ghost button - by far the most common. The others are
   modifiers rather than separate classes so every button shares one set of
   sizing, focus and disabled behaviour. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--fill);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--accent);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    padding: 0.6rem 1.25rem;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition),
        color var(--transition), border-color var(--transition);
}

.btn:hover:not(:disabled) {
    background: var(--fill-hover);
    box-shadow: var(--glow);
    color: var(--accent);
}

.btn:focus-visible {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--focus-ring);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.45;
    cursor: default;
    box-shadow: none;
}

.btn--sm {
    font-size: 0.8rem;
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-sm);
}

.btn--lg {
    font-size: 0.95rem;
    padding: 0.7rem 1.75rem;
}

.btn--block {
    width: 100%;
}

/* Solid accent: the page's single strongest call to action. */
.btn--solid {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 600;
}

.btn--solid:hover:not(:disabled) {
    background: var(--accent-bright);
    border-color: var(--accent-bright);
    box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.35);
    color: var(--bg);
}

/* Solid call-to-action. Dark text on the brand gradient. */
.btn--gradient {
    background: var(--accent-gradient);
    border-color: transparent;
    color: var(--bg);
    font-weight: 600;
}

.btn--gradient:hover:not(:disabled) {
    background: var(--accent-gradient);
    color: var(--bg);
}

/* Toolbar / icon button: no chrome until hovered. */
.btn--quiet {
    background: none;
    border-color: transparent;
    color: var(--text-muted);
}

.btn--quiet:hover:not(:disabled) {
    background: var(--overlay-hover);
    box-shadow: none;
    color: var(--text);
}

.btn--danger {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}

.btn--danger:hover:not(:disabled) {
    background: rgba(255, 107, 107, 0.16);
    box-shadow: none;
    color: var(--danger-text);
}


/* --- Inline notices -------------------------------------------------------
   Form-level feedback rendered inside a card, as opposed to the global
   toast in templates/inc/messages.html. */
.notice {
    font-size: 0.85rem;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    text-align: center;
}

.notice--success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
}

.notice--danger,
.notice--warning {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}


/* --- Link ----------------------------------------------------------------- */
.link {
    color: var(--accent);
    text-decoration: none;
}

.link:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* --- Site aurora ----------------------------------------------------------
   One slow wash behind every page. The center vignette keeps type readable.
   Light theme uses dim, cool source colors so the page-wide invert stays soft. */
.site-aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.site-aurora::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, color-mix(in srgb, var(--bg) 50%, transparent) 0%, transparent 70%);
}

.site-aurora-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(96px);
}

.site-aurora-blob--a,
.site-aurora-blob--b,
.site-aurora-blob--c {
    animation-timing-function: cubic-bezier(0.45, 0.05, 0.55, 0.95);
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

.site-aurora-blob--a {
    width: 46vmax;
    height: 46vmax;
    left: -8%;
    top: 6%;
    background: rgba(0, 212, 255, 0.18);
    animation-name: site-aurora-a;
    animation-duration: 42s;
}

.site-aurora-blob--b {
    width: 40vmax;
    height: 40vmax;
    right: -10%;
    bottom: -8%;
    background: rgba(123, 97, 255, 0.14);
    animation-name: site-aurora-b;
    animation-duration: 56s;
}

.site-aurora-blob--c {
    width: 28vmax;
    height: 28vmax;
    left: 38%;
    top: 46%;
    background: rgba(80, 190, 230, 0.09);
    animation-name: site-aurora-c;
    animation-duration: 68s;
}

.site-aurora-blob--cursor {
    width: 220px;
    height: 220px;
    margin: -110px 0 0 -110px;
    left: 0;
    top: 0;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.2) 0%, rgba(123, 97, 255, 0.07) 46%, transparent 72%);
    filter: blur(40px);
    opacity: 0.85;
}

html.site-aurora-paused .site-aurora-blob {
    animation-play-state: paused;
}

html[data-resolved-theme="light"] .site-aurora-blob {
    filter: blur(120px);
}

html[data-resolved-theme="light"] .site-aurora-blob--a {
    background: rgba(28, 52, 72, 0.36);
}

html[data-resolved-theme="light"] .site-aurora-blob--b {
    background: rgba(42, 48, 78, 0.28);
}

html[data-resolved-theme="light"] .site-aurora-blob--c {
    background: rgba(36, 64, 86, 0.22);
}

html[data-resolved-theme="light"] .site-aurora-blob--cursor {
    background: radial-gradient(circle, rgba(40, 70, 96, 0.28) 0%, transparent 70%);
    opacity: 0.4;
    filter: blur(52px);
}

main.container-fluid,
.site-footer {
    position: relative;
    z-index: 1;
}

@keyframes site-aurora-a {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(5%, 6%, 0) scale(1.05); }
}

@keyframes site-aurora-b {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(-6%, -4%, 0) scale(1.04); }
}

@keyframes site-aurora-c {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(-4%, 5%, 0) scale(0.96); }
}

@media (prefers-reduced-motion: reduce) {
    .site-aurora-blob { animation: none; }
    .site-aurora-blob--cursor { display: none; }
}

@media (pointer: coarse) {
    .site-aurora-blob--cursor { display: none; }
}
