/* ═══════════════════════════════════════════════════════════════
   NEXUS DB  ·  style.css
   Theme: White-dominant · Electric neon accents · Space Mono
   ═══════════════════════════════════════════════════════════════ */

/* ── Custom properties ─────────────────────── */
:root {
    /* Core palette */
    --bg          : steelblue;
    --surface     : rgba(70, 130, 180, 0.01);
    --surface-2   : #f0f1f8;
    --border      : rgba(60, 60, 120, 0.12);
    --border-focus: var(--cyan);

    /* Neon accents */
    --cyan        : #00e5ff;
    --lime        : #b6ff00;
    --violet      : #7c3aed;
    --hot-pink    : #ff2d78;
    --electric    : #3d5afe;

    /* Text */
    --text-primary  : #0d0d1a;
    --text-secondary: #ffffff;
    --text-muted    : #ffffff;

    /* Shadows / glows */
    --glow-cyan     : 0 0 18px rgba(0,229,255,.55), 0 0 40px rgba(0,229,255,.22);
    --glow-lime     : 0 0 18px rgba(182,255,0,.5),  0 0 40px rgba(182,255,0,.18);
    --glow-pink     : 0 0 18px rgba(255,45,120,.5),  0 0 40px rgba(255,45,120,.5);
    --shadow-card   : 0 8px 48px rgba(60,60,140,.5), 0 2px 8px rgba(60,60,140,.5);

    /* Typography */
    --font-mono     : 'Space Mono', monospace;
    --font-display  : 'Syne', sans-serif;

    /* Sizes */
    --radius        : 16px;
    --radius-sm     : 8px;
    --radius-pill   : 999px;
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }

body {
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* ── Background grid ───────────────────────── */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
            linear-gradient(rgba(0,229,255,.06) 1px, transparent 1px),
            linear-gradient(90deg, rgba(0,229,255,.06) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}

/* ── Neon orbs ─────────────────────────────── */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
    animation: float 12s ease-in-out infinite;
}
.bg-orb--a {
    width: 520px; height: 520px;
    top: -160px; left: -160px;
    background: radial-gradient(circle, rgba(0,229,255,.22) 0%, transparent 70%);
    animation-duration: 14s;
}
.bg-orb--b {
    width: 420px; height: 420px;
    bottom: -120px; right: -120px;
    background: radial-gradient(circle, rgba(182,255,0,.18) 0%, transparent 70%);
    animation-duration: 11s;
    animation-delay: -4s;
}

@keyframes float {
    0%,100% { transform: translateY(0)  translateX(0); }
    33%      { transform: translateY(-28px) translateX(16px); }
    66%      { transform: translateY(18px)  translateX(-12px); }
}

/* ── Stage / layout ────────────────────────── */
.stage {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    padding: 24px 16px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* ── Header ────────────────────────────────── */
.header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo__mark {
    font-size: 22px;
    color: var(--cyan);
    filter: drop-shadow(var(--glow-cyan));
    animation: spin-hex 18s linear infinite;
}

@keyframes spin-hex {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.logo__name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}
.logo__name em {
    font-style: normal;
    color: var(--cyan);
    text-shadow: var(--glow-cyan);
}

/* Status bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 5px 14px;
    box-shadow: 0 1px 6px rgba(0,0,0,.05);
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background .3s, box-shadow .3s;
}
.status-dot--idle      { background: var(--text-muted); }
.status-dot--loading   {
    background: var(--cyan);
    box-shadow: var(--glow-cyan);
    animation: blink .8s ease-in-out infinite;
}
.status-dot--connected { background: var(--lime);   box-shadow: var(--glow-lime); }
.status-dot--error     { background: var(--hot-pink); box-shadow: var(--glow-pink); }

@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:.3; } }

.status-label {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    letter-spacing: .05em;
}

/* ── Card ──────────────────────────────────── */
.card {
    width: 100%;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 32px 28px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    transition: box-shadow .4s;
}

/* Neon top-edge accent line */
.card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--cyan), var(--lime), var(--cyan));
    background-size: 200%;
    animation: slide-gradient 4s linear infinite;
    border-radius: var(--radius) var(--radius) 0 0;
}

@keyframes slide-gradient {
    0%   { background-position: 0%; }
    100% { background-position: 200%; }
}

.card--pulse {
    animation: card-pulse .5s ease;
}
@keyframes card-pulse {
    0%   { box-shadow: var(--shadow-card); }
    40%  { box-shadow: var(--shadow-card), 0 0 0 6px rgba(0,229,255,.15); }
    100% { box-shadow: var(--shadow-card); }
}

.card__header { margin-bottom: 28px; }

.card__title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.1;
}

.card__sub {
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: .03em;
}

/* ── Field groups ──────────────────────────── */
.field-group {
    margin-bottom: 22px;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    cursor: default;
}
.field-label__icon { color: var(--cyan); font-size: 13px; }

.charcount {
    margin-left: auto;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: .04em;
    color: var(--text-muted);
    transition: color .2s;
}
.charcount--warn { color: var(--hot-pink); }

.field-wrap {
    position: relative;
}

.field-input {
    width: 100%;
    padding: 13px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 14px;
    color: black;
    outline: none;
    transition: border-color .2s, background .2s, box-shadow .2s;
    caret-color: var(--cyan);
}

.field-input::placeholder { color: grey; }

.field-input:focus {
    border-color: var(--cyan);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,229,255,.14);
}

/* Animated bottom border on focus */
.field-border {
    position: absolute;
    left: 4px; right: 4px; bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--cyan), var(--lime));
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.field-input:focus ~ .field-border { transform: scaleX(1); }

.field-input:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.field-hint {
    display: block;
    margin-top: 5px;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: .03em;
}

/* ── Buttons ───────────────────────────────── */
.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.btn {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    cursor: pointer;
    transition: opacity .15s, transform .15s, box-shadow .2s;
    flex: 1;
    white-space: nowrap;
    user-select: none;
}

.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Primary — cyan */
.btn--primary {
    background: linear-gradient(135deg, #00e5ff 0%, #00b8d4 100%);
    color: #001a1f;
    box-shadow: 0 3px 14px rgba(0,229,255,.35);
}
.btn--primary:hover:not(:disabled) {
    box-shadow: var(--glow-cyan), 0 3px 14px rgba(0,229,255,.35);
}

/* Accent — lime */
.btn--accent {
    background: linear-gradient(135deg, #c6ff00 0%, #8fbc00 100%);
    color: #0d1a00;
    box-shadow: 0 3px 14px rgba(182,255,0,.30);
}
.btn--accent:hover:not(:disabled) {
    box-shadow: var(--glow-lime), 0 3px 14px rgba(182,255,0,.30);
}

/* Ghost — outlined */
.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    flex: 0 0 auto;
    padding: 13px 16px;
}
.btn--ghost:hover:not(:disabled) {
    border-color: var(--hot-pink);
    color: var(--hot-pink);
    box-shadow: 0 0 0 3px rgba(255,45,120,.10);
}

.btn-icon {
    font-size: 15px;
    line-height: 1;
}

/* Ripple */
.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.35);
    width: 6px; height: 6px;
    transform: translate(-50%, -50%) scale(0);
    animation: ripple .55s ease-out forwards;
    pointer-events: none;
}
@keyframes ripple {
    to { transform: translate(-50%,-50%) scale(30); opacity: 0; }
}

/* ── Keyboard hints ────────────────────────── */
.kbd-hints {
    margin-top: 18px;
    text-align: left;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: .04em;
}
kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: gray;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* ── Footer ────────────────────────────────── */
.footer {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: .05em;
    opacity: .7;
}

/* ═══════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════ */
.toast-stack {
    position: fixed;
    bottom: 28px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
    max-width: 360px;
    width: calc(100vw - 48px);
}

.toast {
    pointer-events: all;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    font-size: 13px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    transform: translateX(calc(100% + 32px));
    opacity: 0;
    transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .3s;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 2px 0 0 2px;
}

.toast--visible {
    transform: translateX(0);
    opacity: 1;
}

.toast--out {
    transform: translateX(calc(100% + 32px));
    opacity: 0;
}

.toast--success::before { background: var(--lime); }
.toast--error::before   { background: var(--hot-pink); }
.toast--info::before    { background: var(--cyan); }
.toast--warning::before { background: #ffb300; }

.toast__icon {
    flex-shrink: 0;
    font-size: 14px;
    margin-top: 1px;
}
.toast--success .toast__icon { color: var(--lime); }
.toast--error   .toast__icon { color: var(--hot-pink); }
.toast--info    .toast__icon { color: var(--cyan); }
.toast--warning .toast__icon { color: #ffb300; }

.toast__msg {
    flex: 1;
    line-height: 1.5;
}
.toast__msg strong { font-weight: 700; }

.toast__close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 11px;
    padding: 0 0 0 6px;
    line-height: 1;
    transition: color .15s;
    align-self: flex-start;
}
.toast__close:hover { color: var(--hot-pink); }

/* Progress bar on toast (decorative) */
.toast::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--cyan), var(--lime));
    width: 100%;
    transform-origin: left;
    animation: toast-progress 3.8s linear forwards;
}
.toast--error::after   { background: var(--hot-pink); animation-duration: 5s; }
.toast--warning::after { background: #ffb300; }

@keyframes toast-progress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 500px) {
    .card { padding: 28px 20px 22px; }
    .btn-row { flex-wrap: wrap; }
    .btn--ghost { flex: 1 1 100%; }
}

/* ── Selection colors ──────────────────────── */
::selection {
    background: rgba(0,229,255,.25);
    color: var(--text-primary);
}