/* ==========================================================================
   Test de Cronotipo Horne-Östberg MEQ - Estilos Principales
   Fijate Tools 2026
   ========================================================================== */

:root {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #0f172a;
  --border-color: #334155;
  --border-focus: #38bdf8;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --color-primary: #38bdf8;
  --color-morning: #f59e0b;
  --color-intermediate: #10b981;
  --color-evening: #8b5cf6;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f8fafc;
  --border-color: #e2e8f0;
  --border-focus: #0284c7;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Cabecera */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-back-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.btn-back-tools:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo-box {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-morning);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: none !important;
}

.btn-icon {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Layout Principal con Sidebar */
.main-wrapper {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.tool-main-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

/* Hero */
.tool-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

.tool-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-full);
  color: var(--color-morning);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.tool-hero h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.tool-hero p {
  color: var(--text-muted);
  font-size: 0.975rem;
  max-width: 780px;
}

/* Tarjeta del Quiz */
.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.progress-container {
  margin-bottom: 1.75rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.progress-bar-track {
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #38bdf8);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Pregunta y Opciones */
.question-container {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.question-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: var(--transition);
}

.option-label:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  transform: translateX(4px);
}

.option-label.selected {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--color-primary);
}

.option-label input[type="radio"] {
  accent-color: var(--color-primary);
  width: 18px;
  height: 18px;
}

.option-text {
  font-size: 0.95rem;
  color: var(--text-main);
  flex: 1;
}

/* Navegación del Quiz */
.quiz-nav-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.btn-quiz {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

.btn-quiz-prev {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-quiz-prev:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
}

.btn-quiz-next {
  background: var(--color-primary);
  color: #0f172a;
}

.btn-quiz-next:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateX(3px);
}

.btn-quiz:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Tarjeta de Resultados */
.results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-card);
}

.result-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.badge-morning {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid var(--color-morning);
  color: var(--color-morning);
}

.badge-intermediate {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--color-intermediate);
  color: var(--color-intermediate);
}

.badge-evening {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid var(--color-evening);
  color: #c084fc;
}

.result-main-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.result-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 800px;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Desglose de Puntuación */
.score-breakdown-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.score-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.score-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.score-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary);
}

.score-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.score-scale-track {
  height: 14px;
  background: linear-gradient(90deg, #8b5cf6, #10b981, #f59e0b);
  border-radius: var(--radius-full);
  position: relative;
}

.score-marker {
  position: absolute;
  top: -6px;
  width: 26px;
  height: 26px;
  background: #ffffff;
  border: 3px solid #0f172a;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  transition: left 0.5s ease;
}

/* Gráfico Circadiano Canvas */
.circadian-chart-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.circadian-chart-box h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.canvas-wrapper {
  width: 100%;
  height: 240px;
}

#canvas-circadian {
  width: 100%;
  height: 100%;
  display: block;
}

/* Rutinas Óptimas */
.routine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.routine-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.routine-time {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-primary);
}

.routine-card h5 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.routine-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Consejos */
.chrono-tips-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.chrono-tips-box h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tips-list li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.tips-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--color-success);
  font-weight: bold;
}

.results-actions {
  display: flex;
  justify-content: center;
}

.btn-restart {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-restart:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Información Científica */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

.info-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
}

.info-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.info-categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.cat-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.cat-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.cat-card h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.cat-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0;
  line-height: 1.5;
}

/* Modales */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--color-primary);
  color: #0f172a;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  font-weight: 700;
  cursor: pointer;
}

/* Responsivo */
@media (max-width: 1024px) {
  .routine-grid {
    grid-template-columns: 1fr;
  }
  .info-categories-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .result-main-title {
    font-size: 1.5rem;
  }
  .quiz-card {
    padding: 1.25rem;
  }
  .results-card {
    padding: 1.5rem 1.25rem;
  }
}
