@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #09090f;
    --bg-2:      #0f0f1a;
    --card:      #13131e;
    --card-2:    #1a1a28;
    --border:    rgba(255,255,255,0.07);
    --border-2:  rgba(255,255,255,0.12);
    --accent:    #7c3aed;
    --accent-h:  #6d28d9;
    --accent-2:  #06b6d4;
    --text:      #f1f0f5;
    --text-soft: #8b8aa0;
    --radius:    14px;
    --success:   #10b981;
    --error:     #f43f5e;
    --header-bg: linear-gradient(160deg, #0c0c18 0%, #130920 50%, #0c0c18 100%);
}

[data-theme="light"] {
    --bg:        #f4f4f9;
    --bg-2:      #eaeaf3;
    --card:      #ffffff;
    --card-2:    #f0f0f8;
    --border:    rgba(0,0,0,0.07);
    --border-2:  rgba(0,0,0,0.13);
    --text:      #1a1726;
    --text-soft: #6b6888;
    --success:   #059669;
    --error:     #dc2626;
    --header-bg: linear-gradient(160deg, #ede9ff 0%, #f5f0ff 50%, #ede9ff 100%);
}
[data-theme="light"] .header { border-bottom-color: rgba(124,58,237,0.15); }
[data-theme="light"] .header::before { background: radial-gradient(ellipse, rgba(124,58,237,0.12) 0%, transparent 65%); }
[data-theme="light"] .header h1 { color: #1a1726; }
[data-theme="light"] .header-desc { color: #6b6888; }
[data-theme="light"] .header-meta { background: rgba(124,58,237,0.06); border-color: rgba(124,58,237,0.15); color: #6b6888; }
[data-theme="light"] .scale-legend { background: rgba(124,58,237,0.08); border-color: rgba(124,58,237,0.18); color: #7c3aed; }
[data-theme="light"] .likert { border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .likert label { border-right-color: rgba(0,0,0,0.07); }
[data-theme="light"] .likert label:hover { background: rgba(124,58,237,0.07); }
[data-theme="light"] .btn-theme { background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.12); color: #1a1726; }
[data-theme="light"] .btn-theme:hover { background: rgba(0,0,0,0.1); }
[data-theme="light"] .score-label { color: #7c3aed; }
[data-theme="light"] .score-band.active { background: #7c3aed; border-color: #6d28d9; color: #fff; }
[data-theme="light"] .btn-submit:disabled { background: #e5e5ef; color: var(--text-soft); border-color: var(--border-2); }
[data-theme="light"] .likert label:hover .likert-btn { color: #7c3aed; }
[data-theme="light"] .likert label:hover .likert-label { color: #7c3aed; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 0 0 80px;
}

/* ── Header ── */
.header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: 72px 32px 64px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.header::before {
    content: '';
    position: absolute;
    top: -120px; left: 50%;
    transform: translateX(-50%);
    width: 700px; height: 400px;
    background: radial-gradient(ellipse, rgba(124,58,237,0.2) 0%, transparent 65%);
    pointer-events: none;
}
.header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124,58,237,0.4), transparent);
}
.header-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--accent-2);
    background: rgba(6,182,212,0.08);
    border: 1px solid rgba(6,182,212,0.18);
    border-radius: 999px;
    padding: 6px 16px;
    margin-bottom: 28px;
}
.header-title-sub {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-soft);
    letter-spacing: 0.3px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.header h1 {
    font-size: clamp(32px, 6vw, 52px);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 24px;
    letter-spacing: -1px;
}
.header h1 span {
    background: linear-gradient(90deg, #a78bfa, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header-desc {
    font-size: 15px;
    color: var(--text-soft);
    max-width: 480px;
    margin: 0 auto 32px;
    line-height: 1.75;
}
.header-meta {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    font-size: 12.5px;
    color: var(--text-soft);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 20px;
}
.header-meta span { display: flex; align-items: center; gap: 6px; }
.header-meta-dot {
    width: 3px; height: 3px;
    background: var(--border-2);
    border-radius: 50%;
}

/* ── Layout ── */
.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Intro card ── */
.intro-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin: 28px 0 16px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.intro-icon {
    width: 38px; height: 38px;
    background: rgba(124,58,237,0.15);
    border: 1px solid rgba(124,58,237,0.25);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 17px;
}
.intro-card h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.intro-card p {
    font-size: 13.5px;
    color: var(--text-soft);
    line-height: 1.7;
}

/* ── Scale legend ── */
.scale-legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(124,58,237,0.12);
    border: 1px solid rgba(124,58,237,0.22);
    border-radius: var(--radius);
    padding: 12px 20px;
    margin-bottom: 16px;
    font-size: 12.5px;
    color: #c4b5fd;
}
.scale-values {
    display: flex;
    gap: 10px;
    font-size: 12px;
    opacity: 0.6;
}

/* ── Question card ── */
.question-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.question-card:focus-within {
    border-color: rgba(124,58,237,0.4);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.07);
}
.question-card.answered {
    border-color: rgba(6,182,212,0.3);
}

.q-header {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
    align-items: flex-start;
}
.q-num {
    background: rgba(124,58,237,0.18);
    color: #a78bfa;
    font-size: 11px;
    font-weight: 600;
    width: 26px; height: 26px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.q-text {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--text);
}

/* ── Likert row ── */
.likert {
    display: flex;
    gap: 0;
    background: var(--card-2);
    border: 1.5px solid var(--border-2);
    border-radius: 12px;
    overflow: hidden;
}
.likert label {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 14px 4px 12px;
    border-right: 1px solid var(--border);
    transition: background 0.18s, color 0.18s;
    position: relative;
}
.likert label:last-child { border-right: none; }
.likert label input[type="radio"] { display: none; }
.likert-btn {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-soft);
    line-height: 1;
    transition: color 0.18s, transform 0.18s;
}
.likert-label {
    font-size: 9px;
    color: var(--text-soft);
    text-align: center;
    line-height: 1.25;
    opacity: 0.55;
    transition: opacity 0.18s, color 0.18s;
    max-width: 72px;
}
/* Hover */
.likert label:hover {
    background: rgba(124,58,237,0.1);
}
.likert label:hover .likert-btn {
    color: #c4b5fd;
    transform: translateY(-1px);
}
.likert label:hover .likert-label {
    opacity: 0.8;
    color: #c4b5fd;
}
/* Selected */
.likert label:has(input:checked) {
    background: linear-gradient(160deg, #7c3aed 0%, #5b21b6 100%);
}
.likert label input:checked ~ .likert-btn {
    color: #fff;
    transform: scale(1.1);
}
.likert label:has(input:checked) .likert-label {
    color: rgba(255,255,255,0.75);
    opacity: 1;
}

/* ── Respondent fields ── */
.fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
@media (max-width: 500px) { .fields-grid { grid-template-columns: 1fr; } }

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label { font-size: 12.5px; color: var(--text-soft); font-weight: 500; }
.field-group input,
.field-group select {
    border: 1px solid var(--border-2);
    border-radius: 9px;
    padding: 10px 13px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: var(--card-2);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    appearance: auto;
    color-scheme: dark;
}
[data-theme="light"] .field-group input,
[data-theme="light"] .field-group select {
    color-scheme: light;
}
.field-group input:focus,
.field-group select:focus {
    border-color: rgba(124,58,237,0.5);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}
.field-group input::placeholder { color: var(--text-soft); }

.field-other {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
}
.field-other.visible {
    grid-template-rows: 1fr;
}
.field-other > div {
    overflow: hidden;
    min-height: 0;
}
.field-other input {
    margin-top: 8px;
}

/* ── Submit ── */
.submit-area {
    text-align: center;
    margin-top: 32px;
    padding-top: 8px;
}
.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 16px 52px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s;
    box-shadow: 0 4px 24px rgba(124,58,237,0.4), 0 0 0 1px rgba(124,58,237,0.2);
    letter-spacing: 0.1px;
    position: relative;
    overflow: hidden;
}
.btn-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
    pointer-events: none;
}
.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(124,58,237,0.55), 0 0 0 1px rgba(124,58,237,0.3);
}
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled {
    background: #1e1e2e;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    color: var(--text-soft);
    border: 1px solid var(--border);
}

/* ── Result panel ── */
#result {
    display: none;
    background: var(--card);
    border: 1px solid rgba(124,58,237,0.3);
    border-radius: var(--radius);
    padding: 36px 32px;
    margin-top: 24px;
    text-align: center;
    box-shadow: 0 0 40px rgba(124,58,237,0.08);
}
#result h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.score-circle {
    width: 120px; height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #06b6d4);
    color: white;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    margin: 20px auto;
    font-size: 38px;
    font-weight: 300;
    box-shadow: 0 0 40px rgba(124,58,237,0.4);
}
.score-circle small { font-size: 12px; opacity: 0.8; }
.score-label {
    font-size: 17px;
    font-weight: 600;
    color: #a78bfa;
    margin-bottom: 10px;
}
.score-desc {
    font-size: 13.5px;
    color: var(--text-soft);
    line-height: 1.7;
    max-width: 460px;
    margin: 0 auto 20px;
}
.score-breakdown {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 20px;
    font-size: 11.5px;
}
.score-band {
    padding: 10px 6px;
    border-radius: 9px;
    border: 1px solid var(--border);
    color: var(--text-soft);
}
.score-band.active {
    background: rgba(124,58,237,0.2);
    border-color: rgba(124,58,237,0.5);
    color: #c4b5fd;
}
.score-band-val { font-size: 9.5px; margin-top: 4px; opacity: 0.7; }

.error-msg {
    color: var(--error);
    font-size: 13px;
    margin-top: 12px;
    display: none;
}

.send-status {
    font-size: 13px;
    margin-top: 10px;
    display: none;
}
.send-status.ok  { color: var(--success); }
.send-status.err { color: var(--error); }

/* ── Footer ── */
.footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    margin-top: 48px;
    padding: 32px 20px 52px;
    text-align: center;
}
.footer-inner {
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.footer p {
    font-size: 13px;
    color: var(--text-soft);
}
.footer-sub {
    font-size: 11.5px;
    opacity: 0.6;
}
.footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.footer a:hover { text-decoration: underline; }

/* ── Progress bar ── */
.progress-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: var(--border-2);
    z-index: 100;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #7c3aed, #06b6d4);
    transition: width 0.4s cubic-bezier(0.2, 0, 0, 1);
    border-radius: 0 2px 2px 0;
}
.progress-label {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    border: 1px solid var(--border-2);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-soft);
    z-index: 101;
    pointer-events: none;
    transition: opacity 0.3s;
    white-space: nowrap;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.progress-label span { color: var(--accent); font-weight: 600; }

/* ── Scroll to top ── */
.btn-top {
    position: fixed;
    bottom: 28px;
    right: 20px;
    width: 40px; height: 40px;
    background: var(--card);
    border: 1px solid var(--border-2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-soft);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: opacity 0.25s, transform 0.25s, background 0.15s, color 0.15s;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    z-index: 102;
}
.btn-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.btn-top:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 4px 20px rgba(124,58,237,0.4);
}

/* ── Theme toggle ── */
.btn-theme {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border-2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 16px;
    z-index: 200;
    transition: background 0.2s, transform 0.2s;
    color: var(--text);
}
.btn-theme:hover { background: rgba(124,58,237,0.15); transform: rotate(20deg); }

/* ── Mobile ── */
@media (max-width: 520px) {

    /* Header */
    .header { padding: 52px 20px 40px; }
    .header h1 { font-size: 28px; letter-spacing: -0.5px; }
    .header-desc { font-size: 14px; margin-bottom: 20px; }
    .header-meta {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 12px;
        padding: 8px 16px;
        font-size: 12px;
    }
    .header-meta-dot { display: none; }

    /* Container */
    .container { padding: 0 12px; }

    /* Intro card */
    .intro-card { padding: 16px 16px; }

    /* Scale legend */
    .scale-legend {
        flex-direction: column;
        gap: 6px;
        text-align: center;
        font-size: 11.5px;
        padding: 10px 14px;
    }
    .scale-values { justify-content: center; }

    /* Question cards */
    .question-card { padding: 16px 14px; }
    .q-text { font-size: 13.5px; }

    /* Likert — ocultar etiquetas en móvil, ya están en la leyenda */
    .likert-label { display: none; }
    .likert label { padding: 14px 2px; }
    .likert-btn { font-size: 16px; }

    /* Fields */
    .fields-grid { grid-template-columns: 1fr; gap: 10px; }

    /* Submit */
    .btn-submit { width: 100%; justify-content: center; padding: 16px 24px; }

    /* Score breakdown */
    .score-breakdown { grid-template-columns: repeat(3, 1fr); }
    .score-breakdown .score-band:nth-child(4),
    .score-breakdown .score-band:nth-child(5) { grid-column: span 1; }

    /* Progress label */
    .progress-label { font-size: 10.5px; padding: 4px 12px; bottom: 8px; }

    /* Scroll top */
    .btn-top { bottom: 36px; right: 12px; width: 36px; height: 36px; }

    /* Footer */
    .footer { padding: 24px 16px 48px; }
}
