/* ==========================================================================
   Fijate Tools - Comprobador de mezclas de productos de limpieza
   Estilos corporativos canónicos, semáforo toxicológico y matriz de reactividad
   ========================================================================== */

:root {
  --bg-page: #0b0f17;
  --bg-card: #131b26;
  --bg-card-hover: #182230;
  --bg-input: #1a2434;
  --bg-pill: #1f2a3a;
  --border-color: #233044;
  --border-focus: #3b82f6;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #ef4444;
  --accent-light: rgba(239, 68, 68, 0.12);
  --accent-border: rgba(239, 68, 68, 0.35);
  --risk-letal: #ef4444;
  --risk-peligroso: #f97316;
  --risk-inutil: #eab308;
  --risk-seguro: #10b981;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="light"],
body.light-theme {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f1f5f9;
  --bg-pill: #e2e8f0;
  --border-color: #cbd5e1;
  --border-focus: #2563eb;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #dc2626;
  --accent-light: rgba(220, 38, 38, 0.08);
  --accent-border: rgba(220, 38, 38, 0.25);
  --risk-letal: #dc2626;
  --risk-peligroso: #ea580c;
  --risk-inutil: #ca8a04;
  --risk-seguro: #059669;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
}

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

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

.mono-num {
  font-family: var(--font-mono);
}

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

.tool-with-sidebar {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

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

/* ==========================================================================
   SELECTOR DUAL DE QUÍMICOS
   ========================================================================== */

.mix-checker-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mix-dual-selectors-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.selector-box {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.selector-box-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.selector-box-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.plus-divider-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-muted);
}

.chem-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0.5rem 2.2rem 0.5rem 0.85rem;
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-sans);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.chem-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

/* ==========================================================================
   PANEL DE RESULTADO TOXICOLÓGICO (SEMÁFORO)
   ========================================================================== */

.hazard-result-panel {
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all 0.3s ease;
}

/* Variantes semafóricas */
.hazard-result-panel.risk-letal {
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid var(--risk-letal);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.hazard-result-panel.risk-peligroso {
  background: rgba(249, 115, 22, 0.1);
  border: 2px solid var(--risk-peligroso);
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.15);
}

.hazard-result-panel.risk-inutil {
  background: rgba(234, 179, 8, 0.08);
  border: 2px solid var(--risk-inutil);
}

.hazard-result-panel.risk-seguro {
  background: rgba(16, 185, 129, 0.08);
  border: 2px solid var(--risk-seguro);
}

.hazard-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.hazard-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.hazard-titles {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hazard-badge {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  width: fit-content;
}

.risk-letal .hazard-badge {
  background: var(--risk-letal);
  color: #ffffff;
}

.risk-peligroso .hazard-badge {
  background: var(--risk-peligroso);
  color: #ffffff;
}

.risk-inutil .hazard-badge {
  background: var(--risk-inutil);
  color: #000000;
}

.risk-seguro .hazard-badge {
  background: var(--risk-seguro);
  color: #ffffff;
}

.hazard-headline {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
}

.risk-letal .hazard-headline { color: var(--risk-letal); }
.risk-peligroso .hazard-headline { color: var(--risk-peligroso); }
.risk-inutil .hazard-headline { color: var(--risk-inutil); }
.risk-seguro .hazard-headline { color: var(--risk-seguro); }

/* Detalles científicos */
.hazard-details-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  background: var(--bg-card);
  padding: 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.detail-row .k {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.detail-row .v {
  color: var(--text-primary);
  line-height: 1.45;
}

.detail-row .v.formula {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
}

/* Banner de Emergencia Médica Toxicológica */
.emergency-hotline-box {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.hotline-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hotline-icon-svg {
  color: var(--accent);
  flex-shrink: 0;
}

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

.hotline-text strong {
  color: var(--text-primary);
  display: block;
}

.hotline-number-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #dc2626;
  color: #ffffff;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
  transition: all 0.2s ease;
}

.hotline-number-link:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/* ==========================================================================
   MATRIZ DE COMPATIBILIDAD RÁPIDA (CUADRÍCULA DE SEGURIDAD)
   ========================================================================== */

.matrix-quick-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.matrix-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: center;
}

.matrix-table th,
.matrix-table td {
  padding: 0.65rem 0.5rem;
  border: 1px solid var(--border-color);
}

.matrix-table th {
  background: var(--bg-input);
  color: var(--text-primary);
  font-weight: 700;
  white-space: nowrap;
}

.matrix-table th.col-hdr {
  text-align: left;
  padding-left: 0.85rem;
}

.matrix-badge-cell {
  font-weight: 800;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.matrix-badge-cell:hover {
  opacity: 0.8;
}

.cell-letal { background: rgba(239, 68, 68, 0.25); color: #f87171; }
.cell-peligro { background: rgba(249, 115, 22, 0.25); color: #fb923c; }
.cell-inutil { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.cell-seguro { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.cell-same { background: var(--bg-input); color: var(--text-muted); }

/* ==========================================================================
   GUÍA DIDÁCTICA Y SEO (2 COLUMNAS CANÓNICAS)
   ========================================================================== */

.chem-seo-guide {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
}

.chem-seo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.chem-seo-card h2,
.chem-seo-card h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
}

.chem-seo-card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}

.chem-seo-card ul,
.chem-seo-card ol {
  padding-left: 1.2rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ==========================================================================
   RESPONSIVIDAD MÓVIL
   ========================================================================== */

@media (max-width: 768px) {
  .tool-layout {
    padding: 0 0.75rem;
    margin: 1rem auto 2rem;
  }

  .mix-dual-selectors-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .plus-divider-circle {
    margin: 0 auto;
  }

  .emergency-hotline-box {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .hotline-info {
    flex-direction: column;
  }

  .hotline-number-link {
    justify-content: center;
  }

  .chem-seo-guide {
    grid-template-columns: 1fr;
  }
}
