/* ===== RESET & ROOT ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #FF9801;           /* Naranja corporativo */
  --primary-dark: #e08700;
  --primary-light: rgba(255,152,1,0.12);
  --accent:       #A9D4E8;           /* Azul claro corporativo */
  --blue:         #1F507E;           /* Azul oscuro corporativo */
  --blue-dark:    #163d61;
  --success:      #176375;           /* Teal corporativo */
  --warning:      #FF9801;
  --danger:       #fb4654;           /* Rojo corporativo */
  --bg:           #061422;           /* Fondo muy oscuro (azul profundo) */
  --bg2:          #0b1f30;
  --surface:      #0f2a3f;
  --surface2:     #153349;
  --border:       rgba(169,212,232,0.12);
  --text:         #ffffff;
  --text-muted:   rgba(169,212,232,0.65);
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0,0,0,0.5);
}

html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }

/* ===== SCREENS ===== */
.screen { display: none; min-height: 100vh; position: relative; }
.screen.active { display: block; }

/* ===== WELCOME ===== */
.welcome-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.bg-orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.35; }
.orb-1 { width: 500px; height: 500px; background: var(--primary);  top: -150px; right: -100px; animation: float 8s ease-in-out infinite; }
.orb-2 { width: 400px; height: 400px; background: var(--blue);    bottom: -100px; left: -100px; animation: float 10s ease-in-out infinite reverse; }
.orb-3 { width: 300px; height: 300px; background: var(--accent);  top: 50%; left: 50%; transform: translate(-50%,-50%); animation: float 12s ease-in-out infinite; }

@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-30px)} }

.welcome-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; min-height: 100vh; padding: 40px 20px; }

.logo-area { display: flex; align-items: center; gap: 10px; margin-bottom: 48px; align-self: flex-start; }
.logo-badge { width: 44px; height: 44px; background: linear-gradient(135deg, var(--primary), var(--blue)); border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.logo-text { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; color: var(--text); }



.welcome-tag { display: inline-block; background: var(--primary-light); color: var(--primary); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 14px; border-radius: 20px; margin-bottom: 20px; border: 1px solid rgba(255,152,1,0.3); }

.welcome-title { font-family: 'Outfit', sans-serif; font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; line-height: 1.1; margin-bottom: 20px; letter-spacing: -0.03em; }
.gradient-text { background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.welcome-card { background: rgba(11,31,48,0.75); backdrop-filter: blur(24px); border: 1px solid var(--border); border-radius: 24px; padding: 48px; max-width: 680px; width: 100%; }

.welcome-desc { color: var(--text-muted); font-size: 1.05rem; line-height: 1.7; margin-bottom: 32px; }

.welcome-stats { display: flex; align-items: center; gap: 0; background: var(--surface); border-radius: 14px; padding: 20px 24px; margin-bottom: 28px; }
.stat-item { flex: 1; text-align: center; }
.stat-num { display: block; font-family: 'Outfit', sans-serif; font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.stat-divider { width: 1px; height: 40px; background: var(--border); margin: 0 12px; }

.welcome-instructions { background: var(--surface); border-radius: 14px; padding: 20px 24px; margin-bottom: 28px; }
.welcome-instructions h3 { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.welcome-instructions ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.welcome-instructions li { font-size: 0.95rem; color: var(--text-muted); padding-left: 24px; position: relative; line-height: 1.5; }
.welcome-instructions li::before { content: '→'; position: absolute; left: 0; color: var(--primary); font-weight: 700; }
.welcome-instructions li strong { color: var(--text); }

/* ===== BUTTONS ===== */
.btn-primary { display: flex; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; font-family: 'Inter', sans-serif; font-size: 1rem; font-weight: 600; padding: 14px 28px; border: none; border-radius: 12px; cursor: pointer; transition: all 0.2s; width: 100%; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,152,1,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary { display: flex; align-items: center; gap: 8px; background: var(--surface2); color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.95rem; font-weight: 500; padding: 12px 20px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: all 0.2s; }
.btn-secondary:hover { background: var(--surface); border-color: rgba(255,255,255,0.15); }
.btn-secondary:disabled { opacity: 0.35; cursor: not-allowed; }

/* ===== APP HEADER ===== */
.app-header, .quiz-header, .results-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--border); background: var(--bg2); }
.header-logo { display: flex; align-items: center; gap: 8px; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1rem; color: var(--text); }
.header-title { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* ===== INFO SCREEN ===== */
.info-container { display: flex; justify-content: center; padding: 40px 20px; min-height: calc(100vh - 60px); align-items: flex-start; }

.info-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; max-width: 620px; width: 100%; margin-top: 20px; }
.info-icon { width: 56px; height: 56px; background: var(--primary-light); border-radius: 14px; display: flex; align-items: center; justify-content: center; color: var(--primary); margin-bottom: 16px; }
.info-card h2 { font-family: 'Outfit', sans-serif; font-size: 1.6rem; font-weight: 700; margin-bottom: 8px; }
.info-card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 28px; line-height: 1.6; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form-group input { background: var(--bg2); border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.95rem; transition: border-color 0.2s; outline: none; }
.form-group input:focus { border-color: var(--primary); }
.form-group input::placeholder { color: var(--text-muted); opacity: 0.6; }
.field-error { font-size: 0.8rem; color: var(--danger); min-height: 16px; }

.privacy-note { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); background: var(--bg2); border-radius: 10px; padding: 10px 14px; margin-bottom: 20px; }

/* ===== QUIZ SCREEN ===== */
.quiz-progress-bar { height: 4px; background: var(--surface2); position: sticky; top: 0; z-index: 10; }
.quiz-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #ffc04d); transition: width 0.4s ease; width: 0%; border-radius: 0 4px 4px 0; }

.quiz-counter { font-size: 0.85rem; font-weight: 600; color: var(--primary); }

.quiz-container { max-width: 720px; margin: 0 auto; padding: 40px 24px 120px; }

.question-section { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 36px; margin-bottom: 24px; }
.question-badge { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; font-weight: 700; font-size: 0.85rem; border-radius: 10px; margin-bottom: 16px; }
.question-text { font-family: 'Outfit', sans-serif; font-size: 1.15rem; font-weight: 600; line-height: 1.5; color: var(--text); margin-bottom: 28px; }

.options-container { display: flex; flex-direction: column; gap: 12px; }
.option-btn { display: flex; align-items: flex-start; gap: 14px; background: var(--bg2); border: 1.5px solid var(--border); border-radius: 14px; padding: 16px 18px; cursor: pointer; transition: all 0.2s; text-align: left; width: 100%; color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.95rem; line-height: 1.5; }
.option-btn:hover { border-color: var(--primary); background: rgba(255,152,1,0.07); transform: translateX(2px); }
.option-btn.selected { border-color: var(--primary); background: rgba(255,152,1,0.13); box-shadow: 0 0 0 3px rgba(255,152,1,0.13); }
.option-indicator { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; margin-top: 1px; transition: all 0.2s; }
.option-btn.selected .option-indicator { background: var(--primary); border-color: var(--primary); }
.option-btn.selected .option-indicator::after { content: ''; display: block; width: 8px; height: 8px; background: #fff; border-radius: 50%; }
.option-letter { font-weight: 700; color: var(--primary); font-size: 0.85rem; margin-right: 4px; }

.quiz-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.btn-next { display: flex; align-items: center; gap: 8px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; font-family: 'Inter', sans-serif; font-size: 0.95rem; font-weight: 600; padding: 12px 24px; border: none; border-radius: 12px; cursor: pointer; transition: all 0.2s; }
.btn-next:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,152,1,0.4); }
.btn-next:disabled { opacity: 0.4; cursor: not-allowed; }
.nav-dots { display: flex; gap: 4px; overflow: visible; max-width: 240px; flex-wrap: nowrap; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--surface2); flex-shrink: 0; transition: background 0.35s ease; }
.nav-dot.answered { background: var(--primary); }
.nav-dot.current { background: var(--accent); border: 1px solid var(--primary); }

/* ===== RESULTS SCREEN ===== */
.results-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.results-container { position: relative; z-index: 1; max-width: 780px; margin: 0 auto; padding: 32px 24px 60px; }

.results-intro { text-align: center; margin-bottom: 36px; }
.results-tag { display: inline-block; background: rgba(23,99,117,0.2); color: var(--accent); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 6px 16px; border-radius: 20px; margin-bottom: 12px; border: 1px solid rgba(169,212,232,0.3); }
.results-title { font-family: 'Outfit', sans-serif; font-size: 2rem; font-weight: 800; margin-bottom: 6px; }
.results-name { color: var(--text-muted); font-size: 1rem; }

/* ===== TOP 3 ===== */
.top3-section { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 16px; margin-bottom: 36px; }
.top3-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px 20px; text-align: center; position: relative; overflow: hidden; transition: transform 0.2s; }
.top3-card:hover { transform: translateY(-3px); }
.primary-card { background: linear-gradient(135deg, rgba(255,152,1,0.18), rgba(255,152,1,0.04)); border-color: rgba(255,152,1,0.45); }
.top3-rank { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.top3-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 12px; }
.top3-type-num { font-family: 'Outfit', sans-serif; font-size: 2.5rem; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 4px; }
.primary-card .top3-type-num { font-size: 3rem; }
.top3-type-name { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.top3-score { font-size: 0.75rem; color: var(--text-muted); background: var(--surface2); padding: 3px 10px; border-radius: 20px; display: inline-block; }

/* ===== CHART ===== */
.chart-section { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 32px; margin-bottom: 24px; }
.section-title { font-family: 'Outfit', sans-serif; font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; color: var(--text); }
.chart-wrapper { max-width: 420px; margin: 0 auto 20px; position: relative; min-height: 300px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ===== CONSISTENCY ===== */
.consistency-section { display: flex; align-items: flex-start; gap: 16px; border-radius: 16px; padding: 20px 24px; margin-bottom: 24px; border: 2px solid transparent; }
.valid-banner { background: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.35); }
.invalid-banner { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.5); box-shadow: 0 0 24px rgba(245,158,11,0.12); }
.consistency-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; margin-top: 2px; }
.consistency-icon.valid { background: rgba(34,197,94,0.18); color: var(--success); }
.consistency-icon.warning { background: rgba(245,158,11,0.2); color: var(--warning); font-size: 1.5rem; }
.consistency-text { display: flex; flex-direction: column; gap: 4px; }
.consistency-text strong { font-size: 1rem; }
.valid-banner .consistency-text strong { color: var(--success); }
.invalid-banner .consistency-text strong { color: var(--warning); font-size: 1.05rem; }
.consistency-text span { font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; }

/* ===== TYPE DESCRIPTION ===== */
.type-description-section { margin-bottom: 24px; }
.type-desc-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px; }
.type-desc-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.type-desc-num { font-family: 'Outfit', sans-serif; font-size: 1.8rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--primary), var(--blue)); width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.type-desc-name { font-family: 'Outfit', sans-serif; font-size: 1.2rem; font-weight: 700; }
.type-desc-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.type-desc-text { font-size: 0.95rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 16px; }
.type-desc-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.type-tag { font-size: 0.78rem; font-weight: 600; padding: 4px 12px; border-radius: 20px; background: rgba(255,152,1,0.12); color: var(--primary); border: 1px solid rgba(255,152,1,0.25); }

/* ===== SCORES GRID ===== */
.scores-table-section { margin-bottom: 32px; }
.scores-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.score-item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.score-item.top { border-color: rgba(255,152,1,0.45); background: rgba(255,152,1,0.08); }
.score-rank-badge { font-family: 'Outfit', sans-serif; font-size: 1.3rem; font-weight: 800; color: var(--primary); width: 36px; flex-shrink: 0; }
.score-info { flex: 1; }
.score-type-name { font-size: 0.78rem; font-weight: 600; color: var(--text); }
.score-bar-wrap { height: 4px; background: var(--surface2); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.score-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #ffc04d); border-radius: 4px; transition: width 0.8s ease; }
.score-pts { font-size: 0.85rem; font-weight: 700; color: var(--primary); flex-shrink: 0; }

/* ===== ACTIONS ===== */
.results-actions { display: flex; gap: 12px; margin-bottom: 32px; }
.results-actions .btn-primary { flex: 1; }
.results-actions .btn-secondary { flex: 1; justify-content: center; }
.results-footer { text-align: center; font-size: 0.8rem; color: var(--text-muted); padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== SAVE STATUS ===== */
.save-status { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; border-radius: 12px; padding: 12px 18px; margin-bottom: 16px; }
.save-pending { background: rgba(31,80,126,0.2); border: 1px solid rgba(169,212,232,0.25); color: var(--text-muted); }
.save-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.35); color: var(--success); }
.save-error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.35);  color: var(--danger); }
.save-icon { font-size: 1rem; flex-shrink: 0; }
.save-spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .welcome-card { padding: 28px 20px; }
  .form-row { grid-template-columns: 1fr; }
  .top3-section { grid-template-columns: 1fr; }
  .scores-grid { grid-template-columns: 1fr 1fr; }
  .results-actions { flex-direction: column; }
  .quiz-container { padding: 24px 16px 100px; }
  .question-section { padding: 24px 18px; }
}

@media print {
  .quiz-header, .results-header, .results-actions, .btn-retry, .btn-print, .save-status { display: none !important; }
  #screen-welcome, #screen-quiz { display: none !important; }
  #screen-results { display: block !important; }
  body { background: #fff; color: #000; }
  .results-container { max-width: 100%; border: none; padding: 0; box-shadow: none; background: #fff; }
  .chart-wrapper { width: 400px !important; height: 400px !important; margin: 0 auto; display: block !important; }
}
