/**
 * Estilos canónicos: Calculadora de distancia de una tormenta por el rayo
 * Fijate Tools (fijate.com)
 */

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

  /* Tema oscuro por defecto */
  --bg-page: #080c14;
  --bg-surface: #0f172a;
  --bg-card: #141e33;
  --bg-card-hover: #1a2742;
  --bg-input: #0b1120;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-focus: #38bdf8;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #38bdf8;
  --accent-amber: #f59e0b;
  --accent-yellow: #facc15;
  --accent-red: #ef4444;
  --accent-green: #10b981;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.25);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --bg-input: #ffffff;
  --border-color: rgba(0, 0, 0, 0.09);
  --border-subtle: rgba(0, 0, 0, 0.05);
  --border-focus: #0284c7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent-blue: #0284c7;
  --accent-amber: #d97706;
  --accent-yellow: #ca8a04;
  --accent-red: #dc2626;
  --accent-green: #059669;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.07), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 15px rgba(2, 132, 199, 0.2);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout institucional */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
  flex: 1;
}

.tool-with-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
}

@media (min-width: 1536px) {
  .tool-with-sidebar {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

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

/* Destello de relámpago en pantalla completa */
.flash-overlay {
  position: fixed;
  inset: 0;
  background-color: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 99999;
  transition: opacity 0.05s ease-out;
}

.flash-overlay.active {
  animation: lightning-flash 0.4s ease-out forwards;
}

@keyframes lightning-flash {
  0% { opacity: 0.75; }
  25% { opacity: 0.1; }
  45% { opacity: 0.65; }
  100% { opacity: 0; }
}

/* Tarjeta principal */
.card-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

@media (min-width: 768px) {
  .card-main {
    padding: 2.25rem;
  }
}

.card-header {
  margin-bottom: 1.75rem;
}

.card-header h2 {
  font-family: var(--font-title);
  font-size: clamp(1.3rem, 2.8vw, 1.85rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-header h2 svg {
  color: var(--accent-yellow);
}

.card-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Selector de pestañas de modo */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: var(--bg-card);
  padding: 0.35rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.75rem;
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 0.5rem;
  min-height: 44px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.tab-btn svg {
  flex-shrink: 0;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .tab-btn.active {
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

@media (max-width: 640px) {
  .mode-tabs {
    grid-template-columns: 1fr;
  }
  .tab-btn {
    justify-content: flex-start;
    padding-left: 1rem;
  }
}

/* Paneles de modo */
.mode-panel {
  display: none;
}

/* Modo Cronómetro táctil */
.stopwatch-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 0 1.5rem;
}

.stopwatch-display-wrapper {
  text-align: center;
}

.stopwatch-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stopwatch-counter {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 9vw, 4.5rem);
  font-weight: 700;
  color: var(--accent-blue);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 25px rgba(56, 189, 248, 0.35);
}

/* Gran botón táctil dual */
.btn-trigger-strike {
  width: 100%;
  max-width: 480px;
  min-height: 84px;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-xl);
  border: 2px solid transparent;
  font-family: var(--font-body);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-card);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-trigger-strike .trigger-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.btn-trigger-strike .trigger-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.btn-trigger-strike .trigger-text strong {
  font-size: 1.15rem;
  font-weight: 700;
}

.btn-trigger-strike .trigger-text small {
  font-size: 0.82rem;
  opacity: 0.85;
}

/* Estado 1: Esperando relámpago (Listo) */
.btn-trigger-strike.state-idle {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0b0f19;
  border-color: #fbbf24;
}

.btn-trigger-strike.state-idle:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.4);
}

.btn-trigger-strike.state-idle:active {
  transform: scale(0.98);
}

/* Estado 2: Cronómetro corriendo (Esperando trueno) */
.btn-trigger-strike.state-running {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #38bdf8;
  animation: pulse-border 1.2s infinite;
}

.btn-trigger-strike.state-running:hover {
  box-shadow: 0 12px 28px rgba(2, 132, 199, 0.45);
}

.btn-trigger-strike.state-running:active {
  transform: scale(0.98);
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.6); }
  70% { box-shadow: 0 0 0 14px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

.stopwatch-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 440px;
}

.stopwatch-hint.pulse {
  color: var(--accent-amber);
  font-weight: 600;
}

.btn-secondary-link {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-secondary-link:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

/* Modo Micrófono */
.mic-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 0;
}

.mic-permission-card {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  max-width: 480px;
  width: 100%;
}

.mic-permission-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.btn-primary-action {
  background: var(--accent-blue);
  color: #080c14;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 48px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary-action:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-primary-action:active {
  transform: scale(0.98);
}

.mic-active-wrapper {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

/* Vúmetro de audio */
.vu-meter-box {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.vu-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.vu-meter-track {
  width: 100%;
  height: 12px;
  background: var(--bg-input);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.vu-meter-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981 0%, #eab308 70%, #ef4444 95%);
  transition: width 0.08s ease-out;
  border-radius: 6px;
}

.mic-sensitivity-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sensitivity-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Modo Entrada directa */
.direct-form-wrapper {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem 0;
}

.form-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.input-with-unit {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 48px;
}

.input-with-unit:focus-within {
  border-color: var(--border-focus);
}

.input-with-unit input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: none;
  padding: 0 1rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
}

.input-with-unit input:focus {
  outline: none;
}

.input-unit-suffix {
  padding: 0 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  user-select: none;
}

.slider-control {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-card);
  accent-color: var(--accent-blue);
  cursor: pointer;
}

/* Parámetros ambientales y temperatura */
.ambient-settings-bar {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .ambient-settings-bar {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

.ambient-left {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ambient-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.temp-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.temp-input-box {
  width: 110px;
  height: 40px;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 0.5rem;
}

.temp-input-box input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  text-align: right;
  padding-right: 0.25rem;
}

.temp-input-box input:focus {
  outline: none;
}

.presets-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 9999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 28px;
}

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

.speed-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--accent-blue);
  white-space: nowrap;
}

.speed-badge strong {
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

/* ==========================================================================
   Panel de Resultados y Diagnóstico
   ========================================================================== */
.results-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 880px) {
  .results-section {
    grid-template-columns: 1fr 1fr;
  }
}

.result-card-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.result-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.result-title-label {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.safety-pill {
  padding: 0.35rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.distance-primary-display {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.distance-num {
  font-family: var(--font-mono);
  font-size: clamp(2.8rem, 7vw, 4.2rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}

.distance-unit {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-blue);
}

.distance-sub-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.distance-sub-metrics span strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Tarjeta de Seguridad Regla 30-30 */
.safety-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border-left: 4px solid var(--accent-amber);
  margin-bottom: 1.5rem;
}

.safety-box h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.safety-box p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Comparativa didáctica fórmula vs regla popular */
.formula-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  border: 1px solid var(--border-subtle);
}

.comp-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.comp-label {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.comp-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.comp-diff {
  font-size: 0.78rem;
  font-weight: 600;
}

/* Radar visualizador */
.radar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.radar-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.radar-header h3 {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
}

.radar-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 420px;
  position: relative;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.4);
  border: 2px solid var(--border-color);
}

.radar-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.radar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ==========================================================================
   Historial de la Tormenta y Detector de Rumbo (LocalStorage)
   ========================================================================== */
.history-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

.history-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.history-header h3 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Banner de Tendencia */
.trend-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .trend-banner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.trend-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.trend-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.trend-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.trend-speed-badge {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.35rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Tabla de Historial */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.history-table th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.history-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.history-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.history-table .col-sec strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.history-table .dist-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  margin-right: 0.3rem;
}

.history-table .dist-val.text-danger {
  color: var(--accent-red);
}

.history-table .dist-m {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.risk-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid currentColor;
}

.badge-mode {
  font-size: 0.75rem;
  background: var(--bg-input);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: var(--text-muted);
}

.btn-delete-row {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-delete-row:hover {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

.history-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Modales Nativos (sin window.alert) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.modal-body {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

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

.btn-danger {
  background: var(--accent-red);
  color: #ffffff;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.btn-danger:hover {
  filter: brightness(1.1);
}

/* Toast de notificación */
.toast-box {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #38bdf8;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  transform: translateY(100px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10000;
}

.toast-box.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 640px) {
  .toast-box {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    text-align: center;
  }
}
