/**
 * Calculadora de exposición equivalente y filtros ND
 * Estilos canónicos adaptativos (claro / oscuro / responsive)
 */

:root,
[data-theme="dark"] {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-page: #0b0f17;
  --bg-card: #131b2a;
  --bg-card-header: #192438;
  --bg-input: #1a253a;
  --bg-input-hover: #22304a;
  --border-color: #24344d;
  --border-focus: #3b82f6;

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

  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.15);

  --accent-color: #ff8507;
  --accent-hover: #e07200;
  --accent-light: rgba(255, 133, 7, 0.15);

  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-header: #f1f5f9;
  --bg-input: #ffffff;
  --bg-input-hover: #f8fafc;
  --border-color: #e2e8f0;
  --border-focus: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;

  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.08);

  --accent-color: #ff8507;
  --accent-hover: #e07200;
  --accent-light: rgba(255, 133, 7, 0.12);

  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Reset y estructura canónica */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  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, .brand-title, .card-title, .faq-title {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
}

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

/* Layout canónico */
.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%;
}

/* Pestañas de modo */
.tool-tabs-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
  overflow-x: auto;
}

.tool-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: 1px solid transparent;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

.tool-tab-btn.active {
  color: var(--primary-color);
  background: var(--bg-card);
  border-color: var(--border-color) var(--border-color) transparent;
  border-bottom-color: var(--primary-color);
}

.tool-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Tarjetas */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.card-header-clean {
  margin-bottom: 1.25rem;
}

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

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

.title-with-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-accent {
  background: var(--accent-light);
  color: var(--accent-color);
  border: 1px solid rgba(255, 133, 7, 0.3);
}

.badge-bulb {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-color);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-bulb.is-running {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-color);
  border-color: rgba(239, 68, 68, 0.3);
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Formularios y selects */
.grid-form-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

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

.form-label-xs {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field-hint {
  font-size: 0.74rem;
  color: var(--text-subtle);
}

.select-wrapper {
  position: relative;
  width: 100%;
}

.form-select, .form-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 2.25rem 0 0.85rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.92rem;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.select-wrapper::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
}

.form-select:focus, .form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

select {
  cursor: pointer;
  color-scheme: dark light;
}

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

.form-input-sm {
  height: 34px;
  padding: 0 0.5rem;
  font-size: 0.85rem;
}

/* Filtros apilables */
.grid-filters-stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.filter-slot-card {
  background: var(--bg-card-header);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.filter-slot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.filter-slot-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.filter-slot-ev {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--primary-color);
  font-weight: 600;
}

.custom-ev-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

/* Chips de acceso rápido */
.presets-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
  flex-wrap: wrap;
}

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

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

.chip-btn {
  padding: 0.35rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.chip-btn:hover {
  color: var(--text-main);
  border-color: var(--primary-color);
}

.chip-btn.active {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Tarjeta hero de resultado */
.highlight-card {
  border-color: rgba(59, 130, 246, 0.35);
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(59, 130, 246, 0.04) 100%);
}

.result-hero-box {
  text-align: center;
  padding: 1.25rem 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.result-hero-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.5rem;
}

.result-hero-time {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 0.4rem;
  letter-spacing: -0.02em;
}

.result-hero-desc {
  font-size: 0.95rem;
  color: var(--primary-color);
  font-weight: 500;
}

.metrics-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.metric-card {
  background: var(--bg-card-header);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

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

.metric-sub {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

/* Banner de efecto visual */
.effect-advice-banner {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  align-items: center;
}

.advice-icon {
  flex-shrink: 0;
  color: var(--success-color);
}

.advice-content strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.advice-content p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0;
}

/* Temporizador Bulb */
.bulb-card {
  border-color: rgba(255, 133, 7, 0.3);
}

.bulb-display-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 1rem 0;
}

.bulb-progress-ring-box {
  position: relative;
  width: 170px;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bulb-svg-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 8;
}

.ring-bar {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 439.82; /* 2 * PI * 70 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.1s linear;
}

.bulb-time-center {
  position: absolute;
  text-align: center;
}

.bulb-countdown {
  display: block;
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.bulb-target {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.25rem;
}

.bulb-controls-area {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1 1 320px;
  min-width: 280px;
}

.bulb-buttons-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Regla estricta: botones con fondo naranja llevan texto e icono en NEGRO (#000000) */
.btn-action-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.5rem;
  background-color: var(--accent-color);
  color: #000000;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}

.btn-action-primary svg {
  stroke: #000000;
  fill: #000000;
}

.btn-action-primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
  color: #000000;
}

.btn-action-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-action-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 1.15rem;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-action-secondary:hover:not(:disabled) {
  background-color: var(--bg-input-hover);
  border-color: var(--text-muted);
}

.btn-action-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bulb-options-row {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
}

.toggle-control input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 38px;
  height: 22px;
  background-color: var(--border-color);
  border-radius: 999px;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-control input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

.toggle-control input:checked + .toggle-slider::after {
  transform: translateX(16px);
}

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

/* ==================== PESTAÑA 2: TRIÁNGULO ==================== */
.equiv-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.form-group-compact {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.form-select-sm {
  height: 36px;
  padding: 0 1.85rem 0 0.65rem;
  font-size: 0.82rem;
}

.radio-lock-group {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.radio-chip {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.radio-chip input {
  display: none;
}

.radio-chip span {
  padding: 0.4rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s;
}

.radio-chip input:checked + span {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.triangle-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.triangle-col-card {
  background: var(--bg-card-header);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.triangle-col-card.is-locked {
  border-color: rgba(255, 133, 7, 0.4);
  background: linear-gradient(180deg, var(--bg-card-header) 0%, rgba(255, 133, 7, 0.05) 100%);
}

.triangle-col-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.col-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.col-effect {
  font-size: 0.74rem;
  color: var(--text-subtle);
}

.slider-val-box {
  text-align: center;
  padding: 0.5rem 0;
}

.slider-main-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-color);
}

.form-range {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  outline: none;
  appearance: none;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slider-scale-limits {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-subtle);
}

.ev-summary-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.ev-badge-box {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ev-badge-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.ev-badge-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent-color);
}

.ev-scene-description {
  flex: 1 1 240px;
  font-size: 0.88rem;
  color: var(--text-main);
}

/* Tablas responsive */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

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

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

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

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

.table-clean tr.is-selected {
  background: var(--primary-light);
  font-weight: 600;
}

/* SEO Article & FAQs */
.seo-article-card {
  margin-top: 2rem;
}

.seo-prose h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--text-main);
}

.seo-prose p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.seo-prose ul {
  padding-left: 1.25rem;
  margin-bottom: 1.25rem;
}

.seo-prose li {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

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

.faq-accordion-container {
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.faq-title {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  list-style: none;
}

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

.faq-arrow {
  color: var(--text-subtle);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.faq-item[open] .faq-arrow {
  transform: rotate(180deg);
  color: var(--primary-color);
}

.faq-answer {
  padding: 0 0 1rem;
}

.faq-answer p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Media queries y adaptación móvil estricta */
@media (max-width: 900px) {
  .grid-form-3,
  .grid-filters-stack,
  .triangle-grid-3 {
    grid-template-columns: 1fr;
  }

  .metrics-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .equiv-top-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 580px) {
  .metrics-grid-4 {
    grid-template-columns: 1fr;
  }

  .bulb-display-container {
    flex-direction: column;
    align-items: center;
  }

  .bulb-buttons-group {
    width: 100%;
  }

  .btn-action-primary,
  .btn-action-secondary {
    flex: 1 1 auto;
    width: 100%;
  }

  .presets-chips {
    width: 100%;
  }

  .chip-btn {
    flex: 1 1 calc(50% - 0.4rem);
    text-align: center;
  }
}
