/* ==========================================================================
   Estilos principales: Test de agudeza visual y astigmatismo (Fijate Tools)
   ========================================================================== */

:root {
  --primary: #ff8507;
  --primary-hover: #e07400;
  --primary-light: rgba(255, 133, 7, 0.12);
  --primary-glow: rgba(255, 133, 7, 0.35);

  --duo-red: #dc2626;
  --duo-green: #16a34a;

  --bg-main: #0b0f17;
  --bg-card: #131b26;
  --bg-card-hover: #1a2434;
  --bg-input: #0e1520;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 133, 7, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-optotype: 'Arial', sans-serif;
}

[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f8fafc;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(255, 133, 7, 0.6);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Cabecera estándar de la aplicación */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

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

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

.btn-back-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-back-tools:hover {
  color: var(--text-main);
  border-color: var(--primary);
  transform: translateX(-2px);
}

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

.brand-logo-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #fbbf24);
  color: #0b0f17;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  margin: 0;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Contenedor principal */
.main-wrapper {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* Hero */
.tool-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.tool-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(255, 133, 7, 0.25);
}

.tool-hero h2 {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.tool-hero p {
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
  font-size: 0.98rem;
}

/* Tarjetas de pasos */
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  margin-bottom: 2rem;
  animation: fadeIn 0.3s ease;
}

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

.step-card-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.step-card-header h3 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.step-card-header p {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Calibración */
.calibration-box {
  text-align: center;
  max-width: 520px;
  margin: 0 auto 2rem;
}

.credit-card-mock {
  width: 320px;
  height: 200px;
  margin: 1.5rem auto;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid var(--primary);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  position: relative;
  transition: width 0.1s ease;
}

.credit-card-chip {
  width: 38px;
  height: 28px;
  background: #fbbf24;
  border-radius: 4px;
}

.credit-card-text {
  font-size: 0.8rem;
  color: #94a3b8;
}

/* Escenario de Optotipo */
.optotype-stage {
  text-align: center;
  padding: 1.5rem 0;
}

.optotype-box {
  width: 260px;
  height: 260px;
  margin: 0 auto 1.5rem;
  background: #ffffff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.optotype-letter {
  font-family: var(--font-optotype);
  font-weight: 900;
  color: #000000;
  line-height: 1;
  user-select: none;
  display: inline-block;
  transition: all 0.2s ease;
}

.directions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  max-width: 480px;
  margin: 1.5rem auto 0;
}

.btn-dir {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-dir:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.btn-dir .arrow {
  font-size: 1.4rem;
  color: var(--primary);
}

/* Astigmatismo */
.astigmatism-box {
  text-align: center;
  padding: 1rem 0;
}

.astigmatism-svg {
  width: 100%;
  max-width: 340px;
  height: auto;
  margin: 0 auto 1.5rem;
  display: block;
}

/* Test Duocromo */
.duochrome-split-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 520px;
  height: 240px;
  margin: 1.5rem auto;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.duo-half {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #000000;
  user-select: none;
}

.duo-red { background-color: var(--duo-red); }
.duo-green { background-color: var(--duo-green); }

.duo-letters {
  font-family: var(--font-optotype);
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
  color: #000000;
  letter-spacing: 0.15em;
}

/* Resultados */
.results-grid-vision {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.res-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  text-align: center;
}

.res-pill .val {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.res-pill .lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Botones principales */
.results-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.btn-primary-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  background: var(--primary);
  color: #0b0f17 !important;
  font-weight: 700;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  background: transparent;
  color: var(--text-main);
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Sección educativa */
.edu-section {
  margin-top: 3rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.edu-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
}

.edu-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.edu-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 800px) {
  .results-grid-vision, .edu-section {
    grid-template-columns: 1fr;
  }
}

/* @media print */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-header, .results-actions, .fijate-footer, .edu-section {
    display: none !important;
  }
  .step-card {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .res-pill {
    border: 1px solid #cccccc;
    background: #ffffff;
    color: #000000;
  }
}
