/* ── Design Tokens ──────────────────────────────────────────── */
:root {
    --primary: #1a56db;
    --primary-hover: #1e40af;
    --primary-light: #e8f0fe;
    --primary-gradient: linear-gradient(135deg, #1a56db 0%, #3b82f6 100%);
    --success: #0d9488;
    --success-light: #d1fae5;
    --warning: #eab308;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.08);
    --transition: .2s ease;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 50%, #f9fafb 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 20px 80px;
    animation: fadeInUp .5s ease both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ───────────────────────────────────────────────── */
.header {
    text-align: center;
    padding: 32px 0 20px;
}

.header .logo-icon {
    width: 68px; height: 68px;
    margin: 0 auto 16px;
    background: var(--primary-gradient);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 34px; color: #fff;
    box-shadow: 0 8px 24px rgba(26,86,219,.25);
}

.header h1 {
    font-size: 26px; font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.header .subtitle {
    color: var(--gray-500); font-size: 15px; margin-top: 6px;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 32px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
    font-size: 18px; font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-100);
}

/* ── Progress ─────────────────────────────────────────────── */
.progress-wrap { margin-bottom: 24px; }

.progress-info {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: var(--gray-500); margin-bottom: 8px;
    font-weight: 600;
}

.progress-bar {
    width: 100%; height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* ── Form ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block; font-weight: 600; font-size: 14px;
    color: var(--gray-700); margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 15px; font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none; background: var(--gray-50);
    color: var(--gray-800);
}

.form-group input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

.form-group input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}

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

.form-group input.error + .error-msg { display: block; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px 20px;
    background: var(--primary-gradient);
    color: #fff; border: none; border-radius: var(--radius-sm);
    font-size: 16px; font-weight: 700; cursor: pointer;
    transition: transform .15s, box-shadow .2s, opacity .2s;
    box-shadow: 0 4px 14px rgba(26,86,219,.3);
    text-align: center; text-decoration: none;
    font-family: inherit;
    position: relative; overflow: hidden;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26,86,219,.4);
}

.btn:active { transform: translateY(0); }

.btn:disabled {
    opacity: .6; cursor: not-allowed; transform: none;
    box-shadow: none;
}

.btn-outline {
    background: #fff; color: var(--primary);
    border: 2px solid var(--primary); box-shadow: none;
}

.btn-outline:hover { background: var(--primary-light); box-shadow: none; }

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #ef4444);
    box-shadow: 0 4px 14px rgba(220,38,38,.25);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #14b8a6);
    box-shadow: 0 4px 14px rgba(13,148,136,.25);
}

/* Loading spinner inside button */
.btn .spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text { opacity: .7; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Question Item ────────────────────────────────────────── */
.q-item {
    padding: 18px 0;
    border-bottom: 1px solid var(--gray-100);
    animation: fadeInUp .35s ease both;
}

.q-item:last-child { border-bottom: none; }

.q-header {
    display: flex; align-items: flex-start; gap: 10px;
}

.q-number {
    flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    background: var(--primary-light); color: var(--primary);
    border-radius: 50%;
    font-size: 13px; font-weight: 700;
    margin-top: 2px;
}

.q-text {
    font-weight: 600; font-size: 15px; color: var(--gray-800);
    line-height: 1.5;
}

.q-options {
    margin-top: 10px; margin-left: 40px;
    display: flex; gap: 16px;
}

.q-options label {
    cursor: pointer; font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 8px;
    padding: 8px 20px; border-radius: var(--radius-sm);
    border: 2px solid var(--gray-200);
    transition: all var(--transition);
    user-select: none;
}

.q-options label:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
}

.q-options input[type="radio"] {
    accent-color: var(--primary);
    width: 16px; height: 16px;
}

.q-options label:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    font-weight: 700;
    box-shadow: 0 0 0 3px rgba(26,86,219,.10);
}

/* ── Result Page ──────────────────────────────────────────── */
.result-hero { text-align: center; }

.result-label {
    font-size: 13px; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.result-score {
    font-size: 80px; font-weight: 900;
    line-height: 1; letter-spacing: -3px;
    animation: scaleIn .6s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes scaleIn {
    from { transform: scale(.5); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.result-badge {
    display: inline-block; padding: 8px 24px;
    border-radius: var(--radius-full);
    font-size: 14px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    margin-top: 12px;
}

.badge-green  { background: var(--success-light); color: #065f46; }
.badge-yellow { background: var(--warning-light); color: #92400e; }
.badge-red    { background: var(--danger-light); color: #991b1b; }
.badge-blue   { background: var(--primary-light); color: var(--primary); }

/* Stat cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.stat-card {
    background: var(--gray-50);
    padding: 18px 16px; border-radius: var(--radius);
    text-align: center;
    transition: transform var(--transition);
}

.stat-card:hover { transform: translateY(-2px); }

.stat-value {
    font-size: 28px; font-weight: 800;
    line-height: 1;
}

.stat-label {
    font-size: 12px; color: var(--gray-500);
    margin-top: 4px; font-weight: 600; text-transform: uppercase;
}

/* ── Details / Accordion ──────────────────────────────────── */
details.card { cursor: pointer; }
details.card summary {
    font-weight: 700; color: var(--primary);
    font-size: 15px; list-style: none;
    display: flex; align-items: center; gap: 8px;
}

details.card summary::-webkit-details-marker { display: none; }

details.card ul {
    margin-top: 14px; padding-left: 20px;
}

details.card li {
    margin-bottom: 8px; font-size: 14px;
    color: var(--gray-700); line-height: 1.5;
}

/* ── Footer ───────────────────────────────────────────────── */
.coach-footer {
    text-align: center; margin-top: 32px;
    padding: 24px 20px;
    border-top: 2px solid var(--gray-200);
}

.coach-footer .cta {
    font-size: 16px; color: var(--primary); font-weight: 600;
}

.coach-footer .contact {
    font-size: 18px; color: var(--danger); font-weight: 700;
    margin-top: 8px;
}

/* ── Admin Table ──────────────────────────────────────────── */
.result-row {
    background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px 24px; margin-bottom: 16px;
    position: relative;
    transition: box-shadow var(--transition);
}

.result-row:hover { box-shadow: var(--shadow); }

.result-row .delete-btn {
    position: absolute; top: 18px; right: 18px;
    color: var(--danger); text-decoration: none;
    font-weight: 700; font-size: 20px;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: background var(--transition);
}

.result-row .delete-btn:hover {
    background: var(--danger-light);
}

.result-row .meta {
    color: var(--gray-500); font-size: 13px;
}

.result-row .badge {
    display: inline-block; padding: 3px 12px;
    border-radius: var(--radius-full);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    padding: 14px 18px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; margin-bottom: 16px;
    display: flex; align-items: center; gap: 10px;
}

.alert-error {
    background: var(--danger-light); color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: var(--warning-light); color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: var(--primary-light); color: #1e40af;
    border-left: 4px solid var(--primary);
}

/* ── Navigation ───────────────────────────────────────────── */
.btn-nav {
    display: flex; gap: 12px; margin-top: 20px;
}

.btn-nav .btn { flex: 1; }

.page-indicator {
    text-align: center; font-size: 13px;
    color: var(--gray-500); margin-top: 12px; font-weight: 600;
}

/* ── Confetti ─────────────────────────────────────────────── */
@keyframes confetti-fall {
    0%   { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
    position: fixed; top: -10px;
    width: 10px; height: 10px;
    animation: confetti-fall 3s linear forwards;
    pointer-events: none; z-index: 9999;
}

/* ── Dark Mode ────────────────────────────────────────────── */
body.dark {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    color: #e2e8f0;
}

body.dark .card {
    background: #1e293b;
    border-color: #334155;
}

body.dark .card:hover { box-shadow: 0 8px 30px rgba(0,0,0,.4); }

body.dark .header h1 { color: #f1f5f9; }
body.dark .header .subtitle { color: #94a3b8; }
body.dark .q-text { color: #e2e8f0; }
body.dark .q-number { background: #1e40af; color: #93c5fd; }
body.dark .q-item { border-color: #334155; }
body.dark .q-options label { border-color: #475569; color: #cbd5e1; }
body.dark .q-options label:hover { background: #1e3a5f; border-color: #3b82f6; }
body.dark .q-options label:has(input:checked) { background: #1e3a5f; border-color: #3b82f6; }

body.dark .form-group input {
    background: #1e293b; border-color: #475569; color: #e2e8f0;
}
body.dark .form-group input:focus { border-color: #3b82f6; }
body.dark .form-group label { color: #cbd5e1; }
body.dark .btn-outline { background: #1e293b; color: #93c5fd; border-color: #3b82f6; }
body.dark .btn-outline:hover { background: #1e3a5f; }

body.dark .stat-card { background: #0f172a; }
body.dark .stat-label { color: #94a3b8; }
body.dark .coach-footer { border-color: #334155; }
body.dark .coach-footer .cta { color: #93c5fd; }

body.dark .result-row { background: #1e293b; border: 1px solid #334155; }
body.dark .result-row .meta { color: #94a3b8; }
body.dark .card-header { border-color: #334155; }
body.dark .progress-bar { background: #334155; }
body.dark details.card summary { color: #93c5fd; }

/* Theme toggle */
.theme-toggle {
    position: fixed; top: 16px; right: 16px;
    width: 44px; height: 44px; border-radius: 50%;
    background: #fff; border: 2px solid var(--gray-200);
    cursor: pointer; font-size: 20px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    z-index: 100;
}

.theme-toggle:hover { transform: scale(1.1); box-shadow: var(--shadow); }

body.dark .theme-toggle {
    background: #334155; border-color: #475569;
}

/* ── CTA Card ──────────────────────────────────────────────── */
.cta-card {
    background: linear-gradient(135deg, #1a56db 0%, #1e40af 100%);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    margin-bottom: 20px;
    color: #fff;
    text-align: center;
    box-shadow: 0 8px 30px rgba(26,86,219,.35);
    position: relative;
    overflow: hidden;
}

.cta-card::before {
    content: '';
    position: absolute; top: -40px; right: -40px;
    width: 120px; height: 120px;
    background: rgba(255,255,255,.06);
    border-radius: 50%;
}

.cta-card::after {
    content: '';
    position: absolute; bottom: -30px; left: -30px;
    width: 100px; height: 100px;
    background: rgba(255,255,255,.04);
    border-radius: 50%;
}

.cta-card h2 {
    font-size: 22px; font-weight: 800;
    margin: 0 0 8px; color: #fff;
    position: relative; z-index: 1;
}

.cta-card .cta-subtitle {
    font-size: 15px; opacity: .9;
    margin-bottom: 20px;
    position: relative; z-index: 1;
}

.cta-benefit-list {
    list-style: none; padding: 0; margin: 0 0 24px;
    text-align: left; display: inline-block;
    position: relative; z-index: 1;
}

.cta-benefit-list li {
    padding: 6px 0; font-size: 14px;
    display: flex; align-items: center; gap: 10px;
}

.cta-benefit-list li::before {
    content: '✅'; flex-shrink: 0;
}

.cta-btn {
    display: inline-block;
    padding: 16px 48px;
    background: #fff;
    color: #1a56db;
    font-size: 18px; font-weight: 800;
    border-radius: var(--radius-full);
    text-decoration: none;
    box-shadow: 0 6px 24px rgba(0,0,0,.2);
    transition: all .25s ease;
    position: relative; z-index: 1;
    animation: ctaPulse 2.5s ease-in-out infinite;
}

.cta-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 32px rgba(0,0,0,.3);
    color: #1e40af;
}

@keyframes ctaPulse {
    0%, 100% { box-shadow: 0 6px 24px rgba(0,0,0,.2); }
    50%      { box-shadow: 0 6px 36px rgba(255,255,255,.35), 0 0 0 8px rgba(255,255,255,.08); }
}

.cta-urgency {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    font-size: 12px; font-weight: 700;
    padding: 4px 14px; border-radius: var(--radius-full);
    margin-bottom: 12px;
    text-transform: uppercase; letter-spacing: .5px;
    animation: fadeInUp .5s ease both;
    position: relative; z-index: 1;
}

.cta-social-proof {
    font-size: 13px; opacity: .8;
    margin-top: 14px;
    position: relative; z-index: 1;
}

.cta-guarantee {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 12px;
    font-size: 13px; opacity: .75;
    position: relative; z-index: 1;
}

/* Light CTA variant (non-gradient) */
.cta-card-light {
    background: #fff;
    border: 2px solid #1a56db;
    box-shadow: 0 4px 20px rgba(26,86,219,.10);
    color: var(--gray-800);
}

.cta-card-light h2 { color: #1a56db; }
.cta-card-light .cta-subtitle { color: var(--gray-600); }
.cta-card-light .cta-btn {
    background: linear-gradient(135deg, #1a56db, #3b82f6);
    color: #fff;
}

/* Dark mode */
body.dark .cta-card-light {
    background: #1e293b;
    border-color: #3b82f6;
}
body.dark .cta-card-light h2 { color: #93c5fd; }
body.dark .cta-card-light .cta-subtitle { color: #94a3b8; }

/* ── Back to top ──────────────────────────────────────────── */
.back-to-top {
    position: fixed; bottom: 24px; right: 24px;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff; border: none; cursor: pointer;
    font-size: 20px; display: none; align-items: center; justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition);
    z-index: 100;
}

.back-to-top.visible { display: flex; }
.back-to-top:hover { transform: translateY(-3px); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .container { padding: 16px 12px 60px; }
    .card { padding: 20px 16px; }
    .header h1 { font-size: 22px; }
    .header .logo-icon { width: 56px; height: 56px; font-size: 28px; }
    .q-options { flex-direction: column; gap: 8px; }
    .q-options label { justify-content: center; }
    .result-score { font-size: 60px; }
    .btn-nav { flex-direction: column; }
    .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .stat-card { padding: 12px 8px; }
    .stat-value { font-size: 22px; }
    .theme-toggle { top: 8px; right: 8px; width: 38px; height: 38px; }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
    .btn, .theme-toggle, .back-to-top, .delete-btn { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
