:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: rgba(37, 99, 235, 0.08);
    --primary-glow: rgba(37, 99, 235, 0.18);
    --bg: #f0f2f5;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --success: #10b981;
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.hidden { display: none !important; }

/* ========== HEADER ========== */
.header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: white;
    text-align: center;
    padding: 2.5rem 1rem 2rem;
}
.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}
.header p {
    font-size: 0.95rem;
    opacity: 0.85;
}
.header-results {
    background: linear-gradient(135deg, #064e3b 0%, #10b981 100%);
}

/* ========== PROGRESS BAR ========== */
.progress-bar-container {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 4px;
    transition: width 0.35s ease;
}
.progress-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 4rem;
    text-align: right;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

/* ========== SECTIONS ========== */
.section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.section-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--primary-light);
}
.section-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    flex-shrink: 0;
}
.icon-id   { background: #ede9fe; color: #7c3aed; }
.icon-loc  { background: #dbeafe; color: #2563eb; }
.icon-motiv { background: #d1fae5; color: #059669; }
.icon-big5 { background: #fef3c7; color: #d97706; }
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
}
.section-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ========== SCALE LEGEND ========== */
.scale-legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-bottom: 0.8rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}
.scale-legend .sep {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin: 0 1rem;
}

/* ========== QUESTION ROWS ========== */
.question {
    padding: 0.65rem 0.6rem;
    border-radius: 8px;
    transition: background 0.15s;
}
.question:hover { background: var(--primary-light); }
.question + .question { border-top: 1px solid #f1f5f9; }
.question-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.question-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-light);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s;
}
.question.answered .question-number {
    background: var(--primary);
    color: white;
}
.question-label {
    flex: 1;
    font-weight: 500;
    font-size: 0.92rem;
}

/* ========== LIKERT BUTTONS ========== */
.likert {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.likert label {
    display: block;
    cursor: pointer;
}
.likert input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.likert .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.8rem;
    height: 2.4rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    border: 2px solid transparent;
    transition: all 0.15s;
}
.likert label:first-child .btn { border-radius: 8px 0 0 8px; }
.likert label:last-child .btn  { border-radius: 0 8px 8px 0; }
.likert label:hover .btn {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.likert input[type="radio"]:checked + .btn {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 2px 10px var(--primary-glow);
}

/* ========== NAME INPUT ========== */
.name-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}
.name-field input {
    width: 100%;
    max-width: 420px;
    padding: 0.7rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.name-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ========== SUBMIT ========== */
.submit-section {
    text-align: center;
    margin-top: 1.5rem;
}
.submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.submit-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--primary-glow);
}
.submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.submit-btn:active:not(:disabled) { transform: translateY(0); }
.submit-hint {
    margin-top: 0.6rem;
    font-size: 0.82rem;
    color: var(--text-light);
}
.submit-hint.ready { color: var(--success); font-weight: 600; }

/* ========== RESULTS: SCORES GRID ========== */
.scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.8rem;
}
.score-card {
    background: var(--bg);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}
.score-card .score-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.3rem;
}
.score-card .score-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

/* ========== RESULTS: CHARTS ========== */
.chart-wrapper {
    max-width: 500px;
    margin: 0 auto;
    padding: 0.5rem 0;
}

/* ========== RESULTS: EXPORT BUTTONS ========== */
.export-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
    margin-top: 1.5rem;
}
.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.8rem;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.export-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--text-muted);
}
.btn-secondary:hover {
    background: var(--text);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
    .header { padding: 1.5rem 1rem; }
    .header h1 { font-size: 1.3rem; }
    .section { padding: 1rem; }
    .question-row { flex-wrap: wrap; gap: 0.4rem; }
    .question-label { width: 100%; }
    .likert { width: 100%; justify-content: center; }
    .likert .btn { width: 2.4rem; height: 2.2rem; font-size: 0.8rem; }
    .scores-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-wrapper { max-width: 100%; }
}
