/**
 * Estilos visuales del Oráculo interactivo de cafeomancia
 * Temas claro y oscuro nativos, porcelana otomana y diseño responsive
 * fijate.com/tools/oraculo-cafeomancia-lectura-cafe/
 */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tema oscuro por defecto (Midnight Slate & Oro Otomano) */
  --bg-page: #0b0f17;
  --bg-surface: #111827;
  --bg-surface-elevated: #1a2234;
  --bg-surface-card: #151d2d;
  --border-subtle: #243048;
  --border-focus: #c59b27;

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

  --accent-gold: #d4af37;
  --accent-gold-hover: #e5c158;
  --accent-gold-bg: rgba(212, 175, 55, 0.12);
  --accent-amber: #f59e0b;
  --accent-amber-bg: rgba(245, 158, 11, 0.12);

  --coffee-dark: #23120b;
  --coffee-medium: #3d1f0e;
  --coffee-light: #5a2e16;

  --badge-fav-bg: rgba(16, 185, 129, 0.14);
  --badge-fav-border: #10b981;
  --badge-fav-text: #34d399;

  --badge-adv-bg: rgba(239, 68, 68, 0.14);
  --badge-adv-border: #ef4444;
  --badge-adv-text: #f87171;

  --badge-neu-bg: rgba(148, 163, 184, 0.14);
  --badge-neu-border: #64748b;
  --badge-neu-text: #cbd5e1;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-card: #ffffff;
  --border-subtle: #e2e8f0;
  --border-focus: #b45309;

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

  --accent-gold: #b45309;
  --accent-gold-hover: #92400e;
  --accent-gold-bg: rgba(180, 83, 9, 0.08);
  --accent-amber: #d97706;
  --accent-amber-bg: rgba(217, 119, 6, 0.08);

  --coffee-dark: #3a1e11;
  --coffee-medium: #542b18;
  --coffee-light: #703920;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.08);
}

/* Base de contención de página */
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout canónico */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Utilidades */
.hidden {
  display: none !important;
}

/* Barra superior de herramientas e introducción */
.oracle-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.oracle-badge-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  background: var(--accent-gold-bg);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.oracle-actions-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 38px;
}

.btn-secondary-action:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* Contenedor de tarjeta de la herramienta */
.oracle-card-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.oracle-intro-heading {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.oracle-intro-sub {
  margin-top: 0;
  margin-bottom: 1.75rem;
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 720px;
}

/* ===================================================
   FASE 1: INTENCIÓN Y SELECCIÓN DE ÁMBITO
   =================================================== */
.ritual-step-container {
  transition: opacity 0.3s ease;
}

.form-group-block {
  margin-bottom: 1.5rem;
}

.form-label-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

/* Selector de categorías en mosaico */
.category-radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.category-radio-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.category-radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cat-card-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

.cat-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
  flex-shrink: 0;
}

.cat-card-text {
  display: flex;
  flex-direction: column;
}

.cat-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
}

.cat-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.category-radio-card input:checked + .cat-card-inner {
  border-color: var(--accent-gold);
  background: var(--accent-gold-bg);
  box-shadow: 0 0 0 1px var(--accent-gold);
}

/* Campo de pregunta */
.question-textarea-wrapper {
  position: relative;
  margin-bottom: 0.75rem;
}

.oracle-textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 95px;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 1rem;
  resize: vertical;
  transition: border-color 0.2s ease;
}

.oracle-textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px var(--accent-gold-bg);
}

/* Chips de preguntas rápidas */
.example-chips-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.example-chips-title {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-weight: 500;
}

.example-chip {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.example-chip:hover {
  border-color: var(--accent-gold);
  color: var(--text-main);
  background: var(--accent-gold-bg);
}

/* Botón primario de acción */
.btn-primary-oracle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.95rem 1.5rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #c59b27 0%, #e5c158 100%);
  color: #111827;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(197, 155, 39, 0.35);
  min-height: 48px;
}

.btn-primary-oracle:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(197, 155, 39, 0.45);
}

/* ===================================================
   FASE 2: REMOCIÓN Y TAZA HUMEANTE
   =================================================== */
.stir-stage-wrapper {
  text-align: center;
  padding: 1.5rem 0;
}

.stir-guide-text {
  font-size: 1.15rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  font-family: var(--font-heading);
}

.stir-sub-guide {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 2rem;
}

.cup-stir-visual-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 2rem;
}

.cup-ceramic-preview {
  position: relative;
  width: 220px;
  height: 220px;
  cursor: pointer;
  transition: transform 0.4s ease;
}

.cup-ceramic-preview:hover {
  transform: scale(1.03);
}

/* Animación de giro de remoción */
.cup-ceramic-preview.anim-swirl {
  animation: cupSwirlAnimation 0.65s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes cupSwirlAnimation {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.06); }
  100% { transform: rotate(360deg) scale(1); }
}

.stir-actions-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 380px;
  margin: 0 auto;
}

.stir-badge-pill {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
}

/* ===================================================
   FASE 3: VOLCADO Y SECADO TÉRMICO
   =================================================== */
.drying-stage-box {
  text-align: center;
  padding: 2.5rem 1rem;
  max-width: 540px;
  margin: 0 auto;
}

.drying-icon-pulse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
  margin-bottom: 1.5rem;
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 16px rgba(212, 175, 55, 0); }
}

.drying-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.drying-status-p {
  color: var(--text-muted);
  font-size: 0.95rem;
  min-height: 48px;
  margin-bottom: 1.5rem;
}

.drying-progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.drying-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c59b27, #f59e0b);
  border-radius: 9999px;
  transition: width 0.05s linear;
}

/* ===================================================
   FASE 4: REVELADO Y EXAMEN DE LA TAZA
   =================================================== */
.reading-header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}

.reading-meta-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.reading-question-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
}

.reading-category-badge {
  font-size: 0.82rem;
  color: var(--accent-gold);
  font-weight: 500;
}

/* Cuadrícula interactiva: Canvas a la izquierda, detalle a la derecha */
.oracle-interactive-grid {
  display: grid;
  grid-template-columns: minmax(320px, 560px) 1fr;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.canvas-viewport-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.canvas-frame-box {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(26, 34, 52, 0.6) 0%, rgba(11, 15, 23, 0.95) 100%);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  padding: 0.5rem;
  box-sizing: border-box;
}

#cafe-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
}

.canvas-hint-caption {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.75rem;
}

/* Filtro por zonas en píldoras */
.zone-filters-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: center;
}

.zone-filter-pill {
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.zone-filter-pill:hover,
.zone-filter-pill.is-active {
  border-color: var(--accent-gold);
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
}

/* Tarjeta de detalle de figura */
.symbol-detail-card-box {
  background: var(--bg-surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.symbol-header-box {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.zone-pill-tag {
  font-size: 0.78rem;
  color: var(--accent-gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
}

.symbol-title {
  margin: 0.25rem 0 0;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.symbol-zone-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-favorable {
  background: var(--badge-fav-bg);
  border: 1px solid var(--badge-fav-border);
  color: var(--badge-fav-text);
}

.badge-advertencia {
  background: var(--badge-adv-bg);
  border: 1px solid var(--badge-adv-border);
  color: var(--badge-adv-text);
}

.badge-neutro {
  background: var(--badge-neu-bg);
  border: 1px solid var(--badge-neu-border);
  color: var(--badge-neu-text);
}

.symbol-reading-card,
.symbol-aspect-box,
.symbol-advice-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.symbol-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-gold);
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.symbol-reading-text,
.symbol-aspect-text,
.symbol-advice-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.55;
}

/* ===================================================
   SÍNTESIS GLOBAL Y CRONOLOGÍA
   =================================================== */
.verdict-card {
  background: var(--bg-surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.verdict-title {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--text-main);
}

.verdict-summary-p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.chronology-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.chrono-col {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chrono-col:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

.chrono-zone-label {
  display: block;
  font-size: 0.75rem;
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.chrono-symbol-name {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.chrono-time-tag {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.65rem;
}

.chrono-msg {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.plate-alivio-box {
  background: var(--accent-gold-bg);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 1.5rem;
}

.plate-alivio-p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.55;
}

.key-advice-banner {
  background: var(--bg-surface-elevated);
  border-left: 4px solid var(--accent-gold);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.95rem;
  color: var(--text-main);
}

/* Barra inferior de acciones (Copiar y Nueva tirada) */
.reading-bottom-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ===================================================
   MODALES ACCESIBLES (Cero alerts de JS)
   =================================================== */
.custom-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.custom-modal.is-active {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-card-dialog {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-sizing: border-box;
  color: var(--text-main);
}

.modal-title-h3 {
  margin-top: 0;
  margin-bottom: 0.85rem;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--text-main);
}

.modal-body-p {
  margin-top: 0;
  margin-bottom: 1.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal-actions-right {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ===================================================
   RESPONSIVE DESIGN (Mobile First & Tablet)
   =================================================== */
@media (max-width: 1024px) {
  .oracle-interactive-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .oracle-card-box {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
  }

  .oracle-intro-heading {
    font-size: 1.5rem;
  }

  .category-radio-grid {
    grid-template-columns: 1fr;
  }

  .btn-primary-oracle {
    font-size: 1rem;
    padding: 0.85rem 1.25rem;
  }

  .reading-bottom-actions {
    flex-direction: column;
  }

  .reading-bottom-actions button {
    width: 100%;
  }

  .chronology-grid {
    grid-template-columns: 1fr;
  }
}
