/* ==========================================================================
   Comprobador de reformas y homologación ITV - Estilos corporativos Fijate
   Paleta automotriz sobre Midnight Slate (oscuro) y marfil técnico (claro)
   ========================================================================== */

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

  /* Colores base para tema oscuro (predeterminado) */
  --bg-primary: #0b0f17;
  --bg-surface: #121824;
  --bg-surface-elevated: #1a2332;
  --bg-card: rgba(26, 35, 50, 0.7);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;

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

  /* Semáforo legal */
  --color-green: #10b981;
  --color-green-bg: rgba(16, 185, 129, 0.12);
  --color-green-border: rgba(16, 185, 129, 0.35);

  --color-amber: #f59e0b;
  --color-amber-bg: rgba(245, 158, 11, 0.12);
  --color-amber-border: rgba(245, 158, 11, 0.35);

  --color-red: #ef4444;
  --color-red-bg: rgba(239, 68, 68, 0.12);
  --color-red-border: rgba(239, 68, 68, 0.35);

  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-accent-glow: rgba(37, 99, 235, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px -4px rgba(0, 0, 0, 0.6);
}

/* Modo claro forzado por tema */
body.light-theme {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --border-subtle: rgba(0, 0, 0, 0.1);
  --border-focus: #2563eb;

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

  --color-green: #059669;
  --color-green-bg: rgba(16, 185, 129, 0.1);
  --color-green-border: rgba(16, 185, 129, 0.3);

  --color-amber: #d97706;
  --color-amber-bg: rgba(245, 158, 11, 0.1);
  --color-amber-border: rgba(245, 158, 11, 0.3);

  --color-red: #dc2626;
  --color-red-bg: rgba(239, 68, 68, 0.1);
  --color-red-border: rgba(239, 68, 68, 0.3);

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px -4px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  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,
.brand-title,
.section-title {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mono, code, .doc-code {
  font-family: var(--font-mono);
}

/* Layout institucional */
.main-wrapper.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1rem auto 3rem;
  padding: 0 1rem;
  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%;
}

/* Hero y bienvenida */
.tool-hero {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-surface-elevated) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.tool-hero::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.15), transparent 70%);
  pointer-events: none;
}

.hero-badge-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(37, 99, 235, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.hero-pill.pill-law {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}

.hero-title {
  font-size: 1.75rem;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 780px;
  line-height: 1.5;
}

/* Selector de modalidad (Tabs) */
.tool-nav-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: var(--bg-surface);
  padding: 0.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

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

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

.nav-tab-btn.active {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--color-accent-glow);
}

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

/* Buscador instantáneo */
.search-wrapper {
  margin-bottom: 1.5rem;
}

.search-input-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input-box svg {
  position: absolute;
  left: 1rem;
  color: var(--text-dim);
  pointer-events: none;
}

.search-main-input {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem 0.75rem 2.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-family: var(--font-main);
  font-size: 1rem;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.search-main-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
  background: var(--bg-surface);
}

.search-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
  align-items: center;
}

.quick-chips-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
  margin-right: 0.25rem;
}

.chip-btn {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.chip-btn:hover {
  color: var(--text-main);
  border-color: var(--color-accent);
  background: rgba(37, 99, 235, 0.1);
}

/* Cuadrícula de grupos y reformas */
.reforms-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.reform-card-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.reform-card-item:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: var(--shadow-card);
}

.reform-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.reform-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(37, 99, 235, 0.12);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.reform-card-title {
  font-size: 1rem;
  line-height: 1.35;
  color: var(--text-main);
}

.reform-card-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.reform-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
  font-size: 0.75rem;
}

.reform-code-badge {
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.reform-action-link {
  color: var(--color-accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Árbol interactivo (Wizard) */
.wizard-step-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.wizard-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.step-indicator {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #60a5fa;
  letter-spacing: 0.05em;
}

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

.wizard-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

.wizard-option-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  color: var(--text-main);
  text-align: left;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.wizard-option-btn:hover {
  border-color: var(--color-accent);
  background: rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

.wizard-option-btn.selected {
  border-color: var(--color-accent);
  background: rgba(37, 99, 235, 0.15);
  box-shadow: 0 0 0 2px var(--color-accent-glow);
}

.wizard-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: all 0.15s ease;
  min-height: 40px;
}

.wizard-back-btn:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

/* Panel de dictamen y resultado */
.verdict-panel {
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  border-width: 1px;
  border-style: solid;
}

.verdict-panel.verdict-green {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.02) 100%), var(--bg-surface);
  border-color: var(--color-green-border);
}

.verdict-panel.verdict-amber {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.02) 100%), var(--bg-surface);
  border-color: var(--color-amber-border);
}

.verdict-panel.verdict-red {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.02) 100%), var(--bg-surface);
  border-color: var(--color-red-border);
}

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.verdict-badge.badge-green {
  background: var(--color-green-bg);
  color: var(--color-green);
  border: 1px solid var(--color-green-border);
}

.verdict-badge.badge-amber {
  background: var(--color-amber-bg);
  color: var(--color-amber);
  border: 1px solid var(--color-amber-border);
}

.verdict-badge.badge-red {
  background: var(--color-red-bg);
  color: var(--color-red);
  border: 1px solid var(--color-red-border);
}

.verdict-title {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

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

/* Métricas KPI del trámite */
.verdict-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.kpi-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Bloques de requisitos y documentos */
.verdict-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.verdict-block-title {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.verdict-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.verdict-list li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.verdict-list li::before {
  content: '';
  position: absolute;
  left: 0.35rem;
  top: 0.45rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

.itv-tip-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid var(--color-amber-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1rem;
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.45;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.itv-tip-icon {
  color: var(--color-amber);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Acciones del dictamen */
.verdict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-primary-action {
  background: var(--color-accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  min-height: 44px;
}

.btn-primary-action:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.btn-secondary-action {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  min-height: 44px;
}

.btn-secondary-action:hover {
  border-color: var(--text-muted);
}

/* Checklist interactivo para la ITV */
.checklist-section {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 2rem;
}

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

.checklist-title {
  font-size: 1.2rem;
}

.checklist-items-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.checklist-item-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
}

.checklist-item-label:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

.checklist-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 0.2rem;
  accent-color: var(--color-accent);
  flex-shrink: 0;
  cursor: pointer;
}

.checklist-item-text {
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--text-main);
}

.checklist-item-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

/* Guía FAQ y acordeones SEO */
.faq-section {
  margin-top: 3rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 2rem;
}

.faq-title {
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}

.faq-details {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: all 0.2s ease;
}

.faq-summary {
  padding: 1rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  min-height: 48px;
}

.faq-summary::-webkit-details-marker {
  display: none;
}

.faq-summary::after {
  content: '+';
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

.faq-details[open] .faq-summary::after {
  content: '−';
}

.faq-content {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.faq-content p {
  margin-bottom: 0.75rem;
}

.faq-content p:last-child {
  margin-bottom: 0;
}

/* Modales corporativos accesibles */
.custom-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.custom-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.custom-modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 100%;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  transition: transform 0.2s ease;
}

.custom-modal-backdrop.active .custom-modal-box {
  transform: translateY(0);
}

.custom-modal-title {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

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

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

/* Toast de aviso copiado */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #10b981;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 10001;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
}

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

/* Estilos de impresión */
@media print {
  header, footer, .tools-ad-banner-section, .tool-ad-sidebar, .tool-nav-tabs, .search-wrapper, .verdict-actions, .affiliate-section, .faq-section {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .main-wrapper.tool-layout {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .card-main, .verdict-panel, .checklist-section {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }
}

/* Responsividad móvil */
@media (max-width: 768px) {
  .hero-title {
    font-size: 1.45rem;
  }

  .tool-nav-tabs {
    grid-template-columns: 1fr;
  }

  .card-main {
    padding: 1.25rem;
  }

  .verdict-actions {
    flex-direction: column;
  }

  .btn-primary-action, .btn-secondary-action {
    width: 100%;
    justify-content: center;
  }

  .toast-notice {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    text-align: center;
  }
}
