/* ==========================================================================
   Buscador de Sanciones DGT y Radar Normativo BOE • Estilos Canónicos
   ========================================================================== */

:root {
  /* Paleta base en modo oscuro (predeterminado) */
  --bg-main: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-subtle: #1a243b;
  --bg-input: #101726;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;

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

  /* Estados y severidad vial */
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.3);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.3);

  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);
  --info-border: rgba(59, 130, 246, 0.3);

  --accent-dgt: #38bdf8;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: rgba(0, 0, 0, 0.1);
  --border-focus: #2563eb;

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

  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;

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

/* Reset y Contención */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.mono-font {
  font-family: 'JetBrains Mono', monospace;
}

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

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

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

/* Hero */
.tool-hero {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-subtle) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-card);
}

.tool-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-dgt);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.tool-hero h2 {
  font-size: 1.75rem;
  margin-bottom: 0.65rem;
  letter-spacing: -0.02em;
}

.tool-hero p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 850px;
}

/* Navegación por Pestañas (Tabs) */
.tool-nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  margin-bottom: 1.75rem;
}

.nav-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1 1 0%;
  min-width: 160px;
  height: 44px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-main);
  background: var(--bg-card-subtle);
}

.nav-tab.active {
  color: #ffffff;
  background: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

/* ==========================================================================
   PESTAÑA 1: BUSCADOR DE SANCIONES
   ========================================================================== */
.search-bar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 1rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-field {
  width: 100%;
  height: 48px;
  padding: 0 2.75rem 0 2.85rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-field:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.btn-clear-search {
  position: absolute;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-subtle);
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-clear-search:hover {
  color: var(--text-main);
  background: var(--border-color);
}

/* Filtros rápidos en pills (sin scroll, envueltos naturalmente) */
.filters-scroll-area {
  margin-bottom: 0.85rem;
}

.filters-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-pill {
  height: 40px;
  padding: 0 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
}

.filter-pill:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.filter-pill.active {
  background: var(--accent-dgt);
  color: #0b0f19;
  font-weight: 700;
  border-color: var(--accent-dgt);
}

.search-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

/* Grid de Infracciones */
.infractions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.sancion-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-card);
}

.sancion-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-focus);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5);
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.badge-gravity {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gravity-muy-grave {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.gravity-grave {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.gravity-leve {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.badge-points {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.points-6 {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.4);
}

.points-4 {
  background: rgba(234, 88, 12, 0.2);
  color: #fb923c;
  border: 1px solid rgba(234, 88, 12, 0.4);
}

.points-3 {
  background: rgba(217, 119, 6, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(217, 119, 6, 0.4);
}

.points-0 {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.badge-immob {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: rgba(147, 51, 234, 0.15);
  color: #c084fc;
  border: 1px solid rgba(147, 51, 234, 0.3);
}

.card-infraction-title {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.card-summary {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
}

.card-prices {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.price-full {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.price-discount {
  font-size: 0.8125rem;
  color: var(--success);
}

.card-article-ref {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 140px;
  text-align: right;
}

/* Estado vacío */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.5rem 1rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.6;
}

.empty-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.empty-sub {
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.btn-clear-all {
  height: 40px;
  padding: 0 1.5rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   PESTAÑA 2: CALCULADORA DE RADAR
   ========================================================================== */
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

.calc-header {
  margin-bottom: 1.5rem;
}

.calc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--warning);
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.calc-title {
  font-size: 1.45rem;
  margin-bottom: 0.35rem;
}

.calc-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

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

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 44px;
  padding: 0 0.85rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9375rem;
}

.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.input-speed-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 44px;
}

.form-input-speed {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 100%;
  padding: 0 0.85rem;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 700;
}

.form-input-speed:focus {
  outline: none;
}

.speed-unit {
  padding: 0 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-card-subtle);
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border-color);
}

.quick-speeds {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

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

.quick-speed-btn {
  height: 36px;
  padding: 0 0.75rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-speed-btn:hover {
  background: var(--border-color);
  color: var(--text-main);
}

/* Tarjeta de resultado del cálculo */
.calc-card-result {
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1.5px solid var(--border-color);
}

.calc-card-result.safe {
  background: var(--success-bg);
  border-color: var(--success-border);
}

.calc-card-result.warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.calc-card-result.danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

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

.result-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-safe {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.result-title {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}

.result-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.result-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.fig-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.fig-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.fig-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 800;
}

.fig-val-danger { color: var(--danger); }
.fig-val-success { color: var(--success); }

.penal-warning-box {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: #7f1d1d;
  color: #fef2f2;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.penal-warning-box svg {
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.penal-warning-box strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.penal-warning-box p {
  font-size: 0.875rem;
  opacity: 0.9;
}

.result-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
}

.breakdown-row strong {
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   PESTAÑA 3: RADAR DE CAMBIOS BOE
   ========================================================================== */
.boe-radar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

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

.boe-status-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--success);
}

.status-dot {
  width: 9px;
  height: 9px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.boe-meta-info {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.meta-sep {
  margin: 0 0.35rem;
}

.btn-refresh-boe {
  height: 40px;
  padding: 0 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-refresh-boe:hover {
  background: var(--border-color);
  border-color: var(--text-muted);
}

.boe-info-banner {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

.boe-info-banner strong {
  color: var(--text-main);
}

.boe-info-banner code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(59, 130, 246, 0.2);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  color: var(--text-main);
}

/* Timeline */
.timeline-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.timeline-list::before {
  content: '';
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 12px;
  width: 2px;
  background: var(--border-color);
}

.timeline-card {
  position: relative;
  display: flex;
  gap: 1.25rem;
  padding-left: 0.25rem;
}

.timeline-marker {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.timeline-dot {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--border-focus);
}

.timeline-card.highlight .timeline-dot {
  border-color: var(--accent-dgt);
  background: var(--accent-dgt);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
}

.timeline-content {
  flex: 1 1 0%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.timeline-card.highlight .timeline-content {
  border-color: rgba(56, 189, 248, 0.35);
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.timeline-badge-rel {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-dgt);
  background: rgba(56, 189, 248, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.timeline-efectos {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.badge-recent {
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  background: #0284c7;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.timeline-title {
  font-size: 1.1rem;
  margin-bottom: 0.45rem;
}

.timeline-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.85rem;
  line-height: 1.45;
}

.btn-boe-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-dgt);
  text-decoration: none;
  transition: color 0.15s;
}

.btn-boe-link:hover {
  text-decoration: underline;
  color: #ffffff;
}

/* Spinner */
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--border-focus);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   PESTAÑA 4: GUÍA LEGAL
   ========================================================================== */
.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.guide-main-title {
  font-size: 1.5rem;
  margin-bottom: 1.75rem;
  text-align: center;
}

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

.guide-block {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.guide-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.icon-success { background: var(--success-bg); color: var(--success); }
.icon-warning { background: var(--warning-bg); color: var(--warning); }
.icon-info { background: var(--info-bg); color: var(--info); }
.icon-danger { background: var(--danger-bg); color: var(--danger); }

.guide-block h4 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.guide-block p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.guide-consequences {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.guide-consequences strong {
  display: block;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.guide-consequences ul {
  padding-left: 1.2rem;
}

.guide-consequences li {
  margin-bottom: 0.3rem;
}

/* ==========================================================================
   MODAL ACCESIBLE
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.96);
  width: 90%;
  max-width: 580px;
  max-height: 88vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.modal-dialog.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.modal-backdrop.active,
.modal-dialog.active ~ .modal-backdrop,
.modal-dialog.active + .modal-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Cuando modal está activo, oscurecer backdrop */
.modal-dialog.active::before {
  content: '';
}

.modal-container {
  padding: 1.75rem;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.modal-badges-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-modal-close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-modal-close:hover {
  color: var(--text-main);
  background: var(--border-color);
}

.modal-title {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
  line-height: 1.35;
}

.modal-summary-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.price-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
}

.price-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.price-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 800;
}

.price-value-green {
  color: var(--success);
}

.modal-section {
  margin-bottom: 1.25rem;
}

.modal-section-title {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.modal-article-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--accent-dgt);
  background: rgba(56, 189, 248, 0.1);
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  display: inline-block;
}

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

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

.btn-copy-card {
  height: 42px;
  padding: 0 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy-card:hover {
  background: var(--border-color);
  border-color: var(--text-muted);
}

.modal-toast {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--success);
  color: #064e3b;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.modal-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   RESPONSIVIDAD Y CONTROLES TÁCTILES
   ========================================================================== */
@media (max-width: 768px) {
  .tool-layout {
    padding: 0 0.75rem;
    margin-top: 0.75rem;
  }

  .tool-hero {
    padding: 1.25rem;
  }

  .tool-hero h2 {
    font-size: 1.35rem;
  }

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

  .form-grid-radar {
    grid-template-columns: 1fr;
  }

  .result-figures {
    grid-template-columns: 1fr;
  }

  .modal-summary-prices {
    grid-template-columns: 1fr;
  }

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

  .btn-copy-card {
    width: 100%;
    justify-content: center;
  }
}
