/* Temperament Test - Mobile-first responsive styles */

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

:root {
    --primary: #5c6bc0;
    --primary-dark: #3949ab;
    --secondary: #78909c;
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ffc107;
    --bg: #f5f5f5;
    --bg-white: #ffffff;
    --text: #212121;
    --text-light: #757575;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 12px;
    --max-width: 800px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 16px; width: 100%; }

/* Header */
.site-header { background: var(--bg-white); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; gap: 12px; }
.site-logo { text-decoration: none; color: var(--text); }
.site-logo h1 { font-size: 1.1rem; font-weight: 700; }
.site-nav { display: none; gap: 16px; }
.site-nav a { text-decoration: none; color: var(--text-light); font-size: 0.9rem; }
.site-nav a:hover { color: var(--primary); }
.lang-switch { background: var(--primary); color: white; padding: 4px 12px; border-radius: 20px; text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.lang-switch:hover { background: var(--primary-dark); }

.hamburger { display: flex; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 8px; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); transition: 0.3s; }

/* Main content */
main { flex: 1; padding: 20px 0; }

/* Buttons */
.btn { display: inline-block; padding: 10px 20px; border: none; border-radius: var(--radius); font-size: 1rem; cursor: pointer; text-decoration: none; text-align: center; transition: all 0.2s; font-weight: 500; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #ccc; }
.btn-large { padding: 14px 32px; font-size: 1.1rem; }
.btn-submit { background: var(--success); }
.btn-submit:hover { background: #388e3c; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Quiz landing */
.quiz-landing { text-align: center; padding: 40px 20px; }
.quiz-landing h2 { font-size: 1.8rem; margin-bottom: 16px; }
.quiz-landing p { color: var(--text-light); margin-bottom: 32px; max-width: 500px; margin-left: auto; margin-right: auto; }

/* Quiz Wizard */
.quiz-wizard { max-width: 600px; margin: 0 auto; }

/* Mode Toggle */
.quiz-mode-toggle { display: flex; justify-content: center; margin-top: 8px; margin-bottom: 16px; border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mode-btn { flex: 1; padding: 8px 16px; font-size: 0.9rem; border: none; background: var(--bg-white); color: var(--text-light); cursor: pointer; transition: all 0.2s; font-weight: 500; }
.mode-btn.active { background: var(--primary); color: white; }
.mode-btn:hover:not(.active) { background: rgba(92, 107, 192, 0.08); }

.quiz-progress { margin-bottom: 24px; }
.progress-bar { background: var(--border); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-fill { background: var(--primary); height: 100%; transition: width 0.3s ease; border-radius: 20px; }
.progress-text { display: block; text-align: center; margin-top: 8px; font-size: 0.85rem; color: var(--text-light); }

.question-card { background: var(--bg-white); border-radius: var(--radius); padding: 32px 24px; box-shadow: var(--shadow); text-align: center; min-height: 200px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 32px; }
.question-text { font-size: 1.2rem; line-height: 1.5; }

.answer-buttons { display: flex; gap: 16px; width: 100%; max-width: 300px; }
.btn-answer { flex: 1; padding: 16px; font-size: 1.1rem; border: 2px solid var(--border); border-radius: var(--radius); background: var(--bg-white); cursor: pointer; transition: all 0.2s; }
.btn-answer:hover { border-color: var(--primary); background: rgba(92, 107, 192, 0.05); }
.btn-answer.selected { background: var(--primary); color: white; border-color: var(--primary); }
.btn-answer.previously-selected { border-color: var(--primary); color: var(--primary); background: rgba(92, 107, 192, 0.08); }

.quiz-nav { display: flex; justify-content: space-between; margin-top: 20px; gap: 12px; }
.quiz-nav-all { text-align: center; margin-top: 20px; }

/* All-Questions Mode */
.all-questions-container { max-height: 70vh; overflow-y: auto; }
.all-q-item { background: var(--bg-white); border-radius: var(--radius); padding: 16px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.all-q-header { display: flex; gap: 8px; margin-bottom: 10px; }
.all-q-num { font-weight: 600; color: var(--text-light); min-width: 28px; }
.all-q-text { flex: 1; font-size: 0.95rem; line-height: 1.4; }
.all-q-buttons { display: flex; gap: 8px; }
.btn-answer-sm { flex: 1; padding: 8px 12px; font-size: 0.9rem; border: 2px solid var(--border); border-radius: 8px; background: var(--bg-white); cursor: pointer; transition: all 0.2s; }
.btn-answer-sm:hover { border-color: var(--primary); }
.btn-answer-sm.selected { background: var(--primary); color: white; border-color: var(--primary); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: rgba(92, 107, 192, 0.1); }
.btn-sm { padding: 4px 10px; font-size: 0.85rem; }

/* Answer Summary Panel (FR-024) */
.answer-summary-panel { background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 16px; max-height: 400px; overflow: hidden; display: flex; flex-direction: column; }
.summary-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.summary-header h3 { margin: 0; font-size: 1rem; }
.summary-list { overflow-y: auto; flex: 1; max-height: 340px; }
.summary-item { display: flex; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--border); cursor: pointer; gap: 8px; transition: background 0.15s; }
.summary-item:hover { background: rgba(92, 107, 192, 0.05); }
.summary-num { font-weight: 600; min-width: 28px; color: var(--text-light); font-size: 0.85rem; }
.summary-text { flex: 1; font-size: 0.85rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-answer { font-weight: 600; min-width: 40px; text-align: center; font-size: 0.85rem; }
.summary-answered .summary-answer { color: var(--primary); }
.summary-unanswered .summary-answer { color: var(--text-light); font-style: italic; }

/* Review Page (FR-025) */
.review-page { max-width: 600px; margin: 0 auto; }
.review-page h2 { text-align: center; margin-bottom: 8px; }
.review-page > p { text-align: center; color: var(--text-light); margin-bottom: 20px; }
.review-list { background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.review-item { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; gap: 10px; transition: background 0.15s; }
.review-item:last-child { border-bottom: none; }
.review-item:hover { background: rgba(92, 107, 192, 0.05); }
.review-num { font-weight: 600; min-width: 28px; color: var(--text-light); }
.review-text { flex: 1; font-size: 0.9rem; }
.review-answer { font-weight: 600; color: var(--primary); min-width: 36px; text-align: center; }
.review-edit { color: var(--text-light); font-size: 1.1rem; }
.review-item-highlight { background: rgba(92, 107, 192, 0.15); transition: background 1.5s ease-out; }
.review-actions { text-align: center; margin-top: 24px; margin-bottom: 24px; }

/* Ad containers */
.ad-banner-container { margin-top: 20px; text-align: center; min-height: 50px; }
.ad-interstitial-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.ad-interstitial-content { background: white; padding: 20px; border-radius: var(--radius); max-width: 400px; width: 90%; text-align: center; }
.ad-interstitial-close { margin-top: 12px; }

/* Result Page */
.result-page { max-width: 600px; margin: 0 auto; }
.result-type { text-align: center; margin-bottom: 32px; }
.result-type h2 { font-size: 1rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 1px; }
.type-name { font-size: 2.2rem; margin-top: 8px; }
.type-sanguine { color: #f9a825; }
.type-choleric { color: #e53935; }
.type-melancholic { color: #1e88e5; }
.type-phlegmatic { color: #43a047; }

.result-description { background: var(--bg-white); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.result-description h3 { margin-bottom: 12px; font-size: 1.1rem; }
.result-description p { color: var(--text-light); }

.result-chart { background: var(--bg-white); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.result-chart h3 { margin-bottom: 16px; text-align: center; }

.result-scores { background: var(--bg-white); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.result-scores h3 { margin-bottom: 16px; }
.score-grid { display: flex; flex-direction: column; gap: 12px; }
.score-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.score-label { color: var(--text-light); }
.score-value { font-weight: 600; }

/* Share section */
.share-section { margin-bottom: 24px; }
.share-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.share-btn { padding: 10px 16px; border-radius: var(--radius); color: white; text-decoration: none; font-size: 0.9rem; display: flex; align-items: center; gap: 6px; }
.share-btn-facebook { background: #1877f2; }
.share-btn-twitter { background: #1da1f2; }
.share-btn-whatsapp { background: #25d366; }
.share-btn-copy { background: var(--secondary); cursor: pointer; border: none; color: white; font-size: 0.9rem; }
.share-btn-copy.copied { background: var(--success); }

/* CTA */
.result-cta { text-align: center; padding: 32px; background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.result-cta h3 { margin-bottom: 16px; }

/* Compare */
.compare-form { max-width: 500px; margin: 0 auto; }
.compare-form h2 { text-align: center; margin-bottom: 8px; }
.compare-form p { text-align: center; color: var(--text-light); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-group input { width: 100%; padding: 12px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 1rem; }
.form-group input:focus { border-color: var(--primary); outline: none; }
.compare-how-to { margin-top: 16px; font-size: 0.85rem; color: var(--text-light); text-align: center; }

.compare-results { max-width: 700px; margin: 0 auto; }
.compare-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 24px; }
.compare-person { background: var(--bg-white); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.compare-person h3 { color: var(--text-light); font-size: 0.9rem; }
.compare-person .type-name { font-size: 1.6rem; }

.compare-chart { background: var(--bg-white); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.compare-summary { background: var(--bg-white); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.compare-summary h3 { margin-bottom: 12px; }
.compare-summary ul { list-style: none; padding: 0; }
.compare-summary li { padding: 8px 0; border-bottom: 1px solid var(--border); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-error { background: #ffebee; color: var(--danger); border: 1px solid #ffcdd2; }

/* Error pages */
.error-page { text-align: center; padding: 60px 20px; }
.error-page h1 { font-size: 2rem; margin-bottom: 12px; }
.error-page p { color: var(--text-light); margin-bottom: 24px; }

/* Cookie consent */
.cookie-consent { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-white); box-shadow: 0 -2px 10px rgba(0,0,0,0.1); z-index: 1000; }
.cookie-consent-inner { max-width: var(--max-width); margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.cookie-consent-inner p { font-size: 0.9rem; color: var(--text-light); }
.cookie-consent-buttons { display: flex; gap: 8px; }

/* Footer */
.site-footer { background: var(--bg-white); border-top: 1px solid var(--border); margin-top: auto; }
.footer-inner { padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-light); }
.footer-nav a { color: var(--text-light); text-decoration: none; }
.footer-nav a:hover { color: var(--primary); }

/* Tablet */
@media (min-width: 768px) {
    .site-nav { display: flex; }
    .hamburger { display: none; }
    .container { padding: 0 24px; }
    .header-inner { padding: 16px 24px; }
    .site-logo h1 { font-size: 1.25rem; }
    .site-nav a { font-size: 1rem; }
    .lang-switch { padding: 6px 16px; font-size: 0.9rem; }
    .compare-grid { grid-template-columns: 1fr 1fr; }
    .cookie-consent-inner { flex-direction: row; text-align: left; }
    .footer-inner { flex-direction: row; justify-content: space-between; }
}

/* Desktop */
@media (min-width: 1024px) {
    :root { --max-width: 900px; }
    .header-inner { padding: 20px 24px; gap: 24px; }
    .site-logo h1 { font-size: 1.4rem; }
    .site-nav { gap: 24px; }
    .site-nav a { font-size: 1.05rem; }
    .lang-switch { padding: 8px 20px; font-size: 0.95rem; }
    .question-text { font-size: 1.4rem; }
    .type-name { font-size: 2.8rem; }
}
