/**
 * Estilos específicos de Calculadora de distancia de tiro y tamaño de pantalla para proyectores
 * Fijate Tools
 */

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

  /* Paleta cromática en tema claro */
  --bg-primary: #f8fafc;
  --bg-card: #ffffff;
  --bg-subcard: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-accent: #2563eb;

  /* Tonos temáticos cinemáticos / proyector */
  --accent-cyan: #0284c7;
  --accent-amber: #d97706;
  --accent-purple: #7c3aed;
  --badge-good-bg: #dcfce7;
  --badge-good-text: #166534;
  --badge-warn-bg: #fef3c7;
  --badge-warn-text: #92400e;
  --badge-bad-bg: #fee2e2;
  --badge-bad-text: #991b1b;

  /* Canvas SVG */
  --svg-bg: #090d16;
  --svg-wall: #1e293b;
  --svg-screen: #f8fafc;
  --svg-beam: rgba(56, 189, 248, 0.22);
  --svg-beam-stroke: rgba(56, 189, 248, 0.7);
  --svg-seat: #334155;
  --svg-dimension: #38bdf8;
  --svg-dimension-text: #e0f2fe;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

/* Tema oscuro */
[data-theme="dark"] {
  --bg-primary: #0b0f17;
  --bg-card: #131b2a;
  --bg-subcard: #1a2538;
  --bg-input: #0f172a;
  --border-color: #24324a;
  --border-focus: #60a5fa;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-accent: #38bdf8;

  --badge-good-bg: rgba(34, 197, 94, 0.18);
  --badge-good-text: #4ade80;
  --badge-warn-bg: rgba(234, 179, 8, 0.18);
  --badge-warn-text: #facc15;
  --badge-bad-bg: rgba(239, 68, 68, 0.18);
  --badge-bad-text: #f87171;

  --svg-bg: #060911;
  --svg-wall: #162033;
  --svg-screen: #ffffff;
  --svg-beam: rgba(56, 189, 248, 0.26);
  --svg-beam-stroke: rgba(56, 189, 248, 0.85);
  --svg-seat: #223049;
  --svg-dimension: #38bdf8;
  --svg-dimension-text: #e0f2fe;
}

/* Estilos de contención canónicos */
body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.main-wrapper.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.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%;
}

/* Tarjeta principal */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

/* Barra de selección de modo */
.calc-mode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.mode-bar-label {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-subcard);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.btn-seg {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-seg:hover {
  color: var(--text-main);
}

.btn-seg.active {
  background: var(--bg-card);
  color: var(--text-accent);
  box-shadow: var(--shadow-sm);
}

/* Barra de Presets */
.presets-section {
  background: var(--bg-subcard);
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.presets-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-label-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.preset-select {
  flex: 1 1 300px;
  min-width: 250px;
}

/* Rejilla de controles de 3 columnas */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
  .controls-grid {
    grid-template-columns: 1fr;
  }
}

.control-box {
  background: var(--bg-subcard);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
}

.box-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.box-title svg {
  color: var(--text-accent);
  flex-shrink: 0;
}

/* Campos de formulario */
.form-group {
  margin-bottom: 0.9rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.label-with-val {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.val-pill {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-accent);
}

.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 2.2rem 0 0.75rem;
  font-family: var(--font-main);
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

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

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

.form-input {
  width: 100%;
  height: 42px;
  min-height: 42px;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 0.75rem;
  font-family: var(--font-main);
  font-size: 0.92rem;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

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

.slider-input-pair {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.form-range {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 6px;
  accent-color: var(--text-accent);
  cursor: pointer;
}

.input-unit-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 110px;
}

.input-unit-wrapper .num-field {
  padding-right: 2.2rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  text-align: right;
}

.input-unit-wrapper .unit-tag {
  position: absolute;
  right: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  pointer-events: none;
}

.form-row-pair {
  display: flex;
  gap: 0.75rem;
}

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

/* Chips de tamaños rápidos */
.quick-chips-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.chips-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.btn-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 28px;
}

.btn-chip:hover {
  border-color: var(--border-focus);
}

.btn-chip.active {
  background: var(--text-accent);
  color: #ffffff;
  border-color: var(--text-accent);
}

/* Píldora de feedback de óptica */
.ratio-feedback-pill {
  margin-top: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bullet-sep {
  color: var(--border-color);
}

/* Rejilla de KPIs */
.results-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
  .results-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .results-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-subcard);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card.highlight-card {
  border-color: var(--text-accent);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), transparent 70%), var(--bg-subcard);
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.kpi-val-group {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.highlight-card .kpi-value {
  color: var(--text-accent);
}

.kpi-subtag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.kpi-desc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.kpi-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.badge-good {
  background: var(--badge-good-bg);
  color: var(--badge-good-text);
}

.badge-warn {
  background: var(--badge-warn-bg);
  color: var(--badge-warn-text);
}

.badge-bad {
  background: var(--badge-bad-bg);
  color: var(--badge-bad-text);
}

/* Visualizador interactivo 2D */
.schematic-container {
  background: var(--svg-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

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

.schematic-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #ffffff;
}

.schematic-title-group h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
}

.schematic-title-group svg {
  color: var(--text-accent);
}

.schematic-view-controls {
  display: flex;
  gap: 0.4rem;
}

.btn-view-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 36px;
}

.btn-view-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.btn-view-toggle.active {
  background: var(--text-accent);
  border-color: var(--text-accent);
  color: #ffffff;
}

.svg-canvas-wrapper {
  width: 100%;
  aspect-ratio: 2 / 1;
  max-height: 480px;
  background: radial-gradient(circle at 80% 30%, rgba(56, 189, 248, 0.06), transparent 60%), #070b13;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#schematic-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.schematic-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  color: #94a3b8;
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-projector {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.dot-beam {
  background: rgba(56, 189, 248, 0.45);
}

.dot-screen {
  background: #f8fafc;
}

.dot-viewer {
  background: #a855f7;
}

.dot-dimension {
  background: #f59e0b;
}

/* Tabla de instalación y exportación */
.install-data-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

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

.install-header h4 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

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

.btn-action-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-subcard);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 36px;
}

.btn-action-sm:hover {
  background: var(--bg-card);
  border-color: var(--border-focus);
  color: var(--text-accent);
}

.specs-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

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

.specs-table th {
  background: var(--bg-subcard);
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.specs-table td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.specs-table tr:last-child td {
  border-bottom: none;
}

.specs-table tr:hover td {
  background-color: var(--bg-subcard);
}

/* Guía SEO y acordeón */
.seo-guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
}

.seo-guide-header {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.seo-guide-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 0.5rem;
}

.seo-guide-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.seo-guide-content h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1.5rem 0 0.6rem;
}

.seo-guide-content p,
.seo-guide-content ul {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0 0 1rem;
}

.seo-guide-content strong {
  color: var(--text-main);
}

.seo-guide-content code {
  font-family: var(--font-mono);
  background: var(--bg-subcard);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  color: var(--text-accent);
  font-size: 0.88rem;
}

/* Acordeón FAQ */
.seo-faq-accordion {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.seo-faq-item {
  background: var(--bg-subcard);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.seo-faq-item[open] {
  border-color: var(--border-focus);
}

.seo-faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-main);
  user-select: none;
  list-style: none;
}

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

.seo-faq-icon {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 0.75rem;
}

.seo-faq-item[open] .seo-faq-icon {
  transform: rotate(180deg);
  color: var(--text-accent);
}

.seo-faq-answer {
  padding: 0 1.25rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.seo-faq-answer p {
  margin: 0;
}

/* Modal accesible */
.custom-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.custom-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

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

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

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

.modal-body {
  padding: 1.25rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.55;
}

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

.btn-primary {
  background: var(--text-accent);
  color: #ffffff;
  border: none;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 40px;
  transition: opacity 0.2s ease;
}

.btn-primary:hover {
  opacity: 0.9;
}
