﻿/* ===========================
   SURVEY UI — Blue Glass UI
   Glassmorphism + Blur Header
   Floating shapes + Dark mode
   =========================== */

:root {
    /* Light theme tokens */
    --bg1: #eef4ff;
    --bg2: #e0ecff;
    --card: rgba(255,255,255,.70);
    --card-solid: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: rgba(148,163,184,.35);
    --brand: #0b2545; /* deep navy */
    --brand-2: #133b6b; /* royal blue */
    --accent: #2563eb; /* primary blue */
    --accent-2: #3b82f6; /* lighter blue */
    --accent-soft: rgba(37, 99, 235, .18);
    --success: #0ea5a4;
    --danger: #ef4444;
    --radius: 22px;
    --shadow: 0 20px 60px rgba(15, 23, 42, .12);
    /* Blur intensity */
    --blur: 14px;
    /* Shape colors */
    --shape1: rgba(37,99,235,.18);
    --shape2: rgba(14,165,164,.16);
    --shape3: rgba(59,130,246,.14);
    /* Transition */
    --t: 220ms cubic-bezier(.2,.8,.2,1);
}

/* DARK THEME */
html[data-theme="dark"] {
    --bg1: #061226;
    --bg2: #0b1a33;
    --card: rgba(15,23,42,.62);
    --card-solid: #0b1220;
    --text: #e5e7eb;
    --muted: #a3b3c7;
    --border: rgba(148,163,184,.18);
    --brand: #cfe3ff;
    --brand-2: #9ec5ff;
    --accent: #60a5fa;
    --accent-2: #3b82f6;
    --accent-soft: rgba(96,165,250,.18);
    --shadow: 0 24px 80px rgba(0,0,0,.35);
    --shape1: rgba(96,165,250,.20);
    --shape2: rgba(45,212,191,.14);
    --shape3: rgba(59,130,246,.16);
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    color: var(--text);
    /* Animated background */
    background: linear-gradient(-45deg, var(--bg1), var(--bg2), rgba(248,251,255,.7), rgba(230,240,255,.7));
    background-size: 400% 400%;
    animation: gradientMove 18s ease infinite;
}

html[data-theme="dark"] body {
    background: linear-gradient(-45deg, var(--bg1), var(--bg2), rgba(2,6,23,.6), rgba(3,7,18,.6));
    background-size: 400% 400%;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ===========================
   Floating Shapes layer
   Add: <div class="sv-shapes" aria-hidden="true"></div>
   We'll auto-position it by .sv-shell
   =========================== */
.sv-shell {
    position: relative;
    padding: 44px 0;
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    isolation: isolate; /* ensures shapes stay behind card */
    overflow: hidden;
}

.sv-shapes {
    position: absolute;
    inset: -40px;
    z-index: -1;
    pointer-events: none;
    filter: blur(.2px);
}

    .sv-shapes::before,
    .sv-shapes::after {
        content: "";
        position: absolute;
        border-radius: 999px;
        background: radial-gradient(circle at 30% 30%, var(--shape1), transparent 60%), radial-gradient(circle at 70% 70%, var(--shape2), transparent 60%), radial-gradient(circle at 50% 20%, var(--shape3), transparent 55%);
        width: 520px;
        height: 520px;
        opacity: .9;
        transform: translate3d(0,0,0);
    }

    .sv-shapes::before {
        top: -140px;
        left: -160px;
        animation: floatA 14s ease-in-out infinite;
    }

    .sv-shapes::after {
        bottom: -180px;
        right: -180px;
        width: 620px;
        height: 620px;
        opacity: .8;
        animation: floatB 18s ease-in-out infinite;
    }

@keyframes floatA {
    0% {
        transform: translate(-10px, 0px) scale(1);
    }

    50% {
        transform: translate(40px, 30px) scale(1.06);
    }

    100% {
        transform: translate(-10px, 0px) scale(1);
    }
}

@keyframes floatB {
    0% {
        transform: translate(0px, 0px) scale(1);
    }

    50% {
        transform: translate(-40px, -30px) scale(1.05);
    }

    100% {
        transform: translate(0px, 0px) scale(1);
    }
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    body, .sv-shapes::before, .sv-shapes::after {
        animation: none !important;
    }

    .sv-card, .sv-step.active {
        animation: none !important;
    }
}

/* ===========================
   Card — Glassmorphism
   =========================== */
.sv-card {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    backdrop-filter: blur(var(--blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
    /* entry */
    animation: cardEntry .65s ease forwards;
    opacity: 0;
    transform: translateY(24px);
}

@keyframes cardEntry {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   Header — Blur + Gradient
   =========================== */
.sv-head {
    padding: 24px;
    position: relative;
    background: linear-gradient(135deg, rgba(11,37,69,.92), rgba(19,59,107,.82));
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.12);
    backdrop-filter: blur(calc(var(--blur) + 6px)) saturate(120%);
    -webkit-backdrop-filter: blur(calc(var(--blur) + 6px)) saturate(120%);
}

html[data-theme="dark"] .sv-head {
    background: linear-gradient(135deg, rgba(7,18,41,.90), rgba(10,26,51,.78));
    border-bottom: 1px solid rgba(255,255,255,.10);
}

.sv-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: .6px;
    color: rgba(255,255,255,.82);
    font-size: 13px;
    text-transform: uppercase;
}

.sv-dot {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 0 6px var(--accent-soft);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 var(--accent-soft);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(37, 99, 235, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.sv-title {
    margin-top: 10px;
    font-weight: 900;
    color: #fff;
}

.sv-sub {
    color: rgba(226, 232, 240, .95);
}

/* ===========================
   Progress
   =========================== */
.sv-progress {
    height: 10px;
    background: rgba(255,255,255,.18);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 16px;
}

.sv-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 999px;
    transition: width .55s cubic-bezier(.4,0,.2,1);
}

/* ===========================
   Body
   =========================== */
.sv-body {
    padding: 24px;
}

    .sv-body .sv-title {
        color: var(--brand);
    }

/* ===========================
   Steps + animations
   =========================== */
.sv-step {
    display: none;
    opacity: 0;
    transform: translateX(40px);
}

    .sv-step.active {
        display: block;
        animation: stepIn .45s ease forwards;
    }

@keyframes stepIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sv-step-counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

.sv-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .12);
    color: var(--text);
    font-weight: 900;
    border: 1px solid rgba(37, 99, 235, .18);
}

html[data-theme="dark"] .sv-chip {
    background: rgba(96,165,250,.12);
    border: 1px solid rgba(96,165,250,.18);
}

.sv-question-title {
    font-size: 20px;
    font-weight: 900;
    margin-bottom: 16px;
    color: var(--text);
}

/* ===========================
   Choices
   =========================== */
.sv-choice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: transform var(--t), box-shadow var(--t), border-color var(--t), background var(--t);
    margin-bottom: 12px;
    background: rgba(255,255,255,.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    will-change: transform;
}

html[data-theme="dark"] .sv-choice {
    background: rgba(15,23,42,.45);
}

.sv-choice:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 28px rgba(37, 99, 235, .14);
    border-color: rgba(37, 99, 235, .55);
}

.sv-choice input[type="radio"] {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
    margin-top: 4px;
}

.sv-choice.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
    transform: scale(1.02);
}

/* ===========================
   Alerts + errors
   =========================== */
.sv-alert {
    background: rgba(239, 68, 68, .08);
    border: 1px solid rgba(239, 68, 68, .30);
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 14px;
    font-weight: 700;
}

html[data-theme="dark"] .sv-alert {
    color: #fecaca;
    background: rgba(239, 68, 68, .10);
    border-color: rgba(239,68,68,.35);
}

.sv-error {
    color: var(--danger);
    font-weight: 800;
}

/* ===========================
   Buttons
   =========================== */
.sv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 14px;
    padding: 12px 16px;
    font-weight: 800;
    border: 1px solid transparent;
    transition: transform var(--t), box-shadow var(--t), filter var(--t), background var(--t), border-color var(--t);
    text-decoration: none;
    user-select: none;
}

    .sv-btn:active {
        transform: translateY(0) scale(.98);
    }

.btn-brand {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
}

    .btn-brand:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 30px rgba(11, 37, 69, .35);
        filter: saturate(1.06);
    }

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
}

    .btn-accent:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 30px rgba(37, 99, 235, .32);
        filter: saturate(1.06);
    }

.sv-btn-outline {
    border: 1px solid var(--border);
    background: rgba(255,255,255,.55);
    color: var(--text);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

html[data-theme="dark"] .sv-btn-outline {
    background: rgba(15,23,42,.45);
}

.sv-btn-outline:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, .35);
    box-shadow: 0 14px 30px rgba(2, 6, 23, .10);
}

/* Actions */
.sv-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-top: 18px;
}

    .sv-actions .sv-btn {
        flex: 1;
    }

/* ===========================
   Success
   =========================== */
.sv-success {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    margin: 0 auto 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(14, 165, 164, .10);
    border: 2px solid rgba(14, 165, 164, .35);
    animation: popIn .5s ease forwards;
    transform: scale(0);
}

@keyframes popIn {
    to {
        transform: scale(1);
    }
}

.sv-success span {
    font-size: 34px !important;
    line-height: 1;
    font-weight: 900;
    color: var(--success);
    animation: checkBounce .6s .3s ease forwards;
    opacity: 0;
}

@keyframes checkBounce {
    0% {
        opacity: 0;
        transform: scale(0);
    }

    70% {
        opacity: 1;
        transform: scale(1.3);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===========================
   Thanks page tweaks
   =========================== */
.sv-shell--thanks {
    padding: 34px 0;
}

.sv-card--thanks {
    max-width: 560px;
    margin: 0 auto;
}

.sv-thanks-body {
    padding: 26px 22px 22px;
}

.sv-btn-wide {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

/* ===========================
   Dark mode switch UI
   =========================== */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.92);
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform var(--t), background var(--t), border-color var(--t);
}

    .theme-toggle:hover {
        transform: translateY(-1px);
        border-color: rgba(255,255,255,.30);
    }

    .theme-toggle .knob {
        width: 44px;
        height: 24px;
        border-radius: 999px;
        background: rgba(255,255,255,.18);
        border: 1px solid rgba(255,255,255,.22);
        position: relative;
    }

        .theme-toggle .knob::after {
            content: "";
            position: absolute;
            top: 50%;
            left: 3px;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            transform: translateY(-50%);
            background: #fff;
            transition: left var(--t), background var(--t);
        }

html[data-theme="dark"] .theme-toggle .knob::after {
    left: 23px;
    background: #0b1220;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 576px) {
    .sv-body {
        padding: 18px;
    }

    .sv-head {
        padding: 18px;
    }

    .sv-question-title {
        font-size: 16px;
    }

    .sv-actions {
        flex-direction: column;
    }
}
