﻿/* ===== CSS Variables & Reset ===== */
:root {
    --bg-color: #0d1117;
    --text-color: #e6edf3;
    --hint-color: #8b949e;
    --link-color: #2f81f7;
    --button-color: #f37021;
    --button-text-color: #ffffff;
    --success-color: #238636;
    --secondary-bg-color: #161b22;

    /* Glass effect colors - dark theme */
    --glass-bg: rgba(22, 27, 34, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-hover: rgba(255, 255, 255, 0.1);
    --glass-active: rgba(243, 112, 33, 0.15);
    --glass-active-border: rgba(243, 112, 33, 0.5);

    /* Glow effects */
    --glow-color: rgba(47, 129, 247, 0.4);
    --glow-soft: 0 0 20px rgba(243, 112, 33, 0.3);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Border radius */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
}

/* ===== Light Theme Support ===== */
body.light-theme {
    /* РЈР»СѓС‡С€РµРЅРЅС‹Р№ РєРѕРЅС‚СЂР°СЃС‚ РґР»СЏ СЃРІРµС‚Р»РѕР№ С‚РµРјС‹ */
    --hint-color: #64748b; /* slate-500 РІРјРµСЃС‚Рѕ gray - Р»СѓС‡С€Рµ С‡РёС‚Р°РµС‚СЃСЏ */
    --glass-bg: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-hover: rgba(0, 0, 0, 0.06);
    --glass-active: rgba(108, 92, 231, 0.12);
    --glass-active-border: rgba(108, 92, 231, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);

    /* РўРµРєСЃС‚ РІ РІС‹Р±СЂР°РЅРЅРѕРј СЃРѕСЃС‚РѕСЏРЅРёРё */
    --selected-text-color: #1e1b4b; /* РўС‘РјРЅС‹Р№ С„РёРѕР»РµС‚РѕРІС‹Р№ РґР»СЏ РєРѕРЅС‚СЂР°СЃС‚Р° */
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Quiz Container ===== */
.quiz-container {
    max-width: 100%;
    padding: 16px;
    padding-bottom: 24px;
    min-height: 100vh;
}

/* ===== Progress Bar ===== */
.progress-bar {
    height: 4px;
    background-color: var(--glass-bg);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
    backdrop-filter: blur(4px);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--button-color), #22D3EE);
    border-radius: 2px;
    width: 25%;
    transition: width var(--transition-slow);
    box-shadow: 0 0 12px var(--glow-color);
}

.step-indicator {
    font-size: 13px;
    color: var(--hint-color);
    text-align: center;
    margin-bottom: 24px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ===== Steps ===== */
.step {
    animation: slideUp var(--transition-slow) ease-out;
}

.step.hidden {
    display: none;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.step h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-color), var(--hint-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.step h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-color);
    opacity: 0.9;
}

/* ===== Options Grid ===== */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ===== Option Cards (Glass Effect) ===== */
.option-card {
    display: block;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.option-card input[type="radio"],
.option-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 12px;
    min-height: 130px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Subtle gradient overlay */
.option-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.option-card:hover .option-content {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Light theme: С‚С‘РјРЅС‹Рµ РіСЂР°РЅРёС†С‹ РїСЂРё hover */
body.light-theme .option-card:hover .option-content {
    border-color: rgba(0, 0, 0, 0.15);
}

body.light-theme .option-content::before {
    background: linear-gradient(180deg, rgba(0,0,0,0.02) 0%, transparent 100%);
}

.option-card:active .option-content {
    transform: scale(0.97);
    transition: transform 100ms ease;
}

.option-card input:checked + .option-content {
    background: var(--glass-active);
    border-color: var(--glass-active-border);
    box-shadow: var(--glow-soft), var(--shadow-md);
}

/* Icon styling */
.option-icon {
    font-size: 40px;
    margin-bottom: 10px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    transition: transform var(--transition-normal);
}

.option-card:hover .option-icon {
    transform: scale(1.1);
}

.option-card input:checked + .option-content .option-icon {
    transform: scale(1.15);
}

/* Text styling */
.option-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.3;
    transition: color var(--transition-fast);
}

.option-hint {
    font-size: 11px;
    color: var(--hint-color);
    margin-top: 4px;
    line-height: 1.3;
    opacity: 0.8;
}

.option-card input:checked + .option-content .option-text {
    color: #fff;
}

.option-card input:checked + .option-content .option-hint {
    color: rgba(255, 255, 255, 0.85);
    opacity: 1;
}

/* Light theme: С‚С‘РјРЅС‹Р№ С‚РµРєСЃС‚ РЅР° РІС‹Р±СЂР°РЅРЅС‹С… РєР°СЂС‚РѕС‡РєР°С… */
body.light-theme .option-card input:checked + .option-content .option-text {
    color: var(--selected-text-color, #1e1b4b);
}

body.light-theme .option-card input:checked + .option-content .option-hint {
    color: #4c1d95;
    opacity: 0.9;
}

/* ===== Compact Option Cards ===== */
.option-card.compact .option-content {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 14px 18px;
    min-height: auto;
    text-align: left;
}

.option-card.compact .option-content::before {
    display: none;
}

.option-card.compact .option-icon {
    font-size: 20px;
    margin-bottom: 0;
    margin-right: 14px;
}

.option-card.compact:hover .option-icon {
    transform: none;
}

/* ===== Checkbox Cards (Step 2 multi-select) ===== */
.option-card.checkbox-card .option-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    min-height: auto;
    text-align: left;
}

.option-card.checkbox-card .option-content::before {
    display: none;
}

.option-card.checkbox-card .option-text {
    flex: 1;
    padding-right: 12px;
    font-size: 14px;
}

/* Checkbox indicator - inline on the right */
.option-card.checkbox-card .checkbox-indicator {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 2px solid var(--hint-color);
    border-radius: 6px;
    transition: all var(--transition-fast);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-card.checkbox-card input:checked + .option-content .checkbox-indicator {
    background: var(--button-color);
    border-color: var(--button-color);
    box-shadow: 0 0 12px var(--glow-color);
}

.option-card.checkbox-card .checkbox-indicator svg {
    width: 14px;
    height: 14px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.option-card.checkbox-card input:checked + .option-content .checkbox-indicator svg {
    opacity: 1;
}

/* ===== Form Groups ===== */
.form-group {
    margin-bottom: 24px;
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
    opacity: 0.9;
}

.required {
    color: #ff6b6b;
}

.text-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    color: var(--text-color);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all var(--transition-fast);
    -webkit-appearance: none;
}

.text-input:focus {
    border-color: var(--button-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2), var(--shadow-sm);
    background: var(--glass-hover);
}

.text-input::placeholder {
    color: var(--hint-color);
    opacity: 0.7;
}

.text-input.textarea {
    min-height: 110px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

.text-input.error {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2);
}

/* Other input wrapper */
.other-input {
    margin-top: 16px;
    animation: fadeIn var(--transition-normal);
}

.other-input.hidden {
    display: none;
}

/* ===== Navigation - СѓРґР°Р»РµРЅРѕ, РёСЃРїРѕР»СЊР·СѓРµРј РЅР°С‚РёРІРЅС‹Рµ TWA РєРЅРѕРїРєРё ===== */

/* ===== Success Screen ===== */
.success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 20px;
}

.success-icon {
    font-size: 80px;
    margin-bottom: 24px;
    animation: successPop var(--transition-bounce);
    filter: drop-shadow(0 4px 20px rgba(52, 199, 89, 0.4));
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-content h2 {
    font-size: 32px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #34c759, #30d158);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.success-content p {
    font-size: 16px;
    color: var(--hint-color);
    line-height: 1.6;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn var(--transition-fast);
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--button-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
    box-shadow: 0 0 20px var(--glow-color);
}

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

.loading-overlay p {
    font-size: 16px;
    color: var(--hint-color);
    font-weight: 500;
}

/* ===== Staggered Animation for Cards ===== */
.options-grid .option-card {
    animation: scaleIn var(--transition-normal) ease-out backwards;
}

.options-grid .option-card:nth-child(1) { animation-delay: 0ms; }
.options-grid .option-card:nth-child(2) { animation-delay: 50ms; }
.options-grid .option-card:nth-child(3) { animation-delay: 100ms; }
.options-grid .option-card:nth-child(4) { animation-delay: 150ms; }
.options-grid .option-card:nth-child(5) { animation-delay: 200ms; }
.options-grid .option-card:nth-child(6) { animation-delay: 250ms; }

.options-list .option-card {
    animation: slideUp var(--transition-normal) ease-out backwards;
}

.options-list .option-card:nth-child(1) { animation-delay: 0ms; }
.options-list .option-card:nth-child(2) { animation-delay: 40ms; }
.options-list .option-card:nth-child(3) { animation-delay: 80ms; }
.options-list .option-card:nth-child(4) { animation-delay: 120ms; }
.options-list .option-card:nth-child(5) { animation-delay: 160ms; }

/* ===== Full-width last option (for "Р”СЂСѓРіРѕРµ") ===== */
.option-card.full-width {
    grid-column: 1 / -1;
}

.option-card.full-width .option-content {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 16px 20px;
    min-height: auto;
    gap: 10px;
}

.option-card.full-width .option-content::before {
    display: none;
}

.option-card.full-width .option-icon {
    font-size: 24px;
    margin-bottom: 0;
}

/* ===== Responsive ===== */
@media (max-width: 340px) {
    .options-grid {
        grid-template-columns: 1fr;
    }

    .option-content {
        min-height: 100px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Safe area for iPhone X+ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .quiz-container {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* Deploy trigger */
.web-next-btn { width: 100%; padding: 16px; border-radius: var(--radius-md); background-color: var(--button-color); color: var(--button-text-color); border: none; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 20px; transition: var(--transition-fast); } .web-next-btn:active { transform: scale(0.98); } .web-next-btn.hidden { display: none !important; }

.option-icon svg { width: 32px; height: 32px; stroke: var(--button-color); stroke-width: 1.5; margin-bottom: 8px; }
