/**
 * GLOSS & GROWTH — CALCULADORA DE ROAS Y RENTABILIDAD PUBLICITARIA
 * Hoja de estilos editorial premium.
 * 
 * Paleta oficial:
 * - Borgoña: #8C2536
 * - Crema: #F2ECC2
 * - Rosa: #FDA4AF
 * - Marrón carbón: #352925
 */

:root {
  --calc-burgundy: #8C2536;
  --calc-burgundy-dark: #6E1B29;
  --calc-burgundy-light: #FBF1F2;
  --calc-cream: #F2ECC2;
  --calc-cream-light: #FAF8F2;
  --calc-pink: #FDA4AF;
  --calc-charcoal: #352925;
  --calc-charcoal-muted: #6B5E59;
  --calc-border: #E8E2D9;
  --calc-border-light: #F0ECE4;
  --calc-card-bg: #FFFFFF;
  --calc-loss-bg: #FDF2F2;
  --calc-loss-text: #991B1B;
  --calc-breakeven-bg: #F8F5E9;
  --calc-breakeven-text: #352925;
  --calc-profit-bg: #F0FDF4;
  --calc-profit-text: #166534;
}

/* Encabezado de la página */
.calc-page-hero {
  padding: 40px 0 32px;
  background: var(--calc-cream-light);
  border-bottom: 1px solid var(--calc-border);
}

.calc-page-hero .eyebrow {
  color: var(--calc-burgundy);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.calc-page-hero h1 {
  font-family: var(--font-serif, "Zodiak", Georgia, serif);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
  color: var(--calc-charcoal);
  margin-bottom: 14px;
}

.calc-page-hero h1 em {
  font-style: italic;
  color: var(--calc-burgundy);
}

.calc-page-hero p.lead {
  font-size: 17px;
  line-height: 1.55;
  color: var(--calc-charcoal-muted);
  max-width: 800px;
  margin-bottom: 24px;
}

/* Modos de uso principales (Planificar vs Analizar) */
.calc-mode-switcher {
  display: inline-flex;
  background: var(--calc-border-light);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--calc-border);
  margin-bottom: 16px;
  gap: 4px;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 680px) {
  .calc-mode-switcher {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    width: 100%;
  }
  .calc-mode-btn {
    width: 100%;
    justify-content: center;
    border-radius: 8px;
    text-align: center;
    padding: 10px 14px;
    font-size: 13px;
  }
}

.calc-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--calc-charcoal-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.calc-mode-btn:hover {
  color: var(--calc-charcoal);
}

.calc-mode-btn.active {
  background: var(--calc-burgundy);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(140, 37, 54, 0.2);
}

/* Barra de presets y ejemplos rápidos */
.calc-preset-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  background: #FFFFFF;
  border: 1px solid var(--calc-border);
  border-radius: 12px;
  margin-bottom: 28px;
  font-size: 13px;
}

.calc-preset-bar span {
  font-weight: 700;
  color: var(--calc-charcoal);
  margin-right: 4px;
}

.calc-preset-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--calc-charcoal);
  background: var(--calc-cream-light);
  border: 1px solid var(--calc-border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.calc-preset-btn:hover {
  border-color: var(--calc-burgundy);
  color: var(--calc-burgundy);
  background: #FFFFFF;
}

.calc-preset-btn.btn-reset {
  margin-left: auto;
  background: transparent;
  color: var(--calc-charcoal-muted);
}

.calc-preset-btn.btn-reset:hover {
  color: #991B1B;
  border-color: #FCA5A5;
}

/* Grid principal de la herramienta */
.calc-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  margin-bottom: 40px;
}

@media (max-width: 960px) {
  .calc-main-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .calc-form-column,
  .calc-results-column {
    min-width: 0;
    max-width: 100%;
  }
  .calc-card {
    padding: 18px 14px;
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
  }
  .calc-action-bar {
    padding: 14px 12px;
    flex-direction: column;
    align-items: stretch;
  }
  .calc-action-bar .calc-action-group,
  .calc-action-bar .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

/* Columna de entradas y formularios */
.calc-card {
  background: #FFFFFF;
  border: 1px solid var(--calc-border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 4px 16px rgba(53, 41, 37, 0.03);
  margin-bottom: 24px;
}

.calc-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif, "Zodiak", Georgia, serif);
  font-size: 20px;
  color: var(--calc-charcoal);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--calc-border-light);
}

.calc-card-title span.badge-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--calc-burgundy);
  color: #FFFFFF;
  font-family: var(--font-sans, "Plus Jakarta Sans", sans-serif);
  font-size: 13px;
  font-weight: 700;
}

/* Filas y grupos de formulario */
.calc-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 560px) {
  .calc-row-2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.calc-field {
  margin-bottom: 18px;
}

.calc-field label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--calc-charcoal);
  margin-bottom: 5px;
}

.calc-field span.hint {
  display: block;
  font-size: 12px;
  color: var(--calc-charcoal-muted);
  line-height: 1.4;
  margin-bottom: 7px;
}

.calc-control {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-sans, "Plus Jakarta Sans", sans-serif);
  font-size: 15px;
  color: var(--calc-charcoal);
  background: #FFFFFF;
  border: 1px solid var(--calc-border);
  border-radius: 8px;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.calc-control:focus {
  outline: none;
  border-color: var(--calc-burgundy);
  box-shadow: 0 0 0 3px rgba(140, 37, 54, 0.12);
}

/* Toggle de modalidad de costos */
.calc-subtoggle {
  display: inline-flex;
  background: var(--calc-cream-light);
  border: 1px solid var(--calc-border);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
  margin-bottom: 10px;
}

.calc-subtoggle-btn {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--calc-charcoal-muted);
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.calc-subtoggle-btn.active {
  background: #FFFFFF;
  color: var(--calc-burgundy);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Panel de resultados principales (Hero KPIs) */
.calc-results-hero {
  background: #FFFFFF;
  border: 1px solid var(--calc-border);
  border-radius: 16px;
  padding: 28px;
  position: sticky;
  top: 90px;
  box-shadow: 0 6px 20px rgba(53, 41, 37, 0.05);
}

@media (max-width: 960px) {
  .calc-results-hero {
    position: static;
  }
}

.hero-main-kpi {
  background: var(--calc-cream-light);
  border: 1px solid var(--calc-cream);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}

.hero-main-kpi span.label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--calc-charcoal-muted);
  margin-bottom: 6px;
}

.hero-main-kpi strong.value {
  display: block;
  font-family: var(--font-serif, "Zodiak", Georgia, serif);
  font-size: clamp(34px, 5vw, 44px);
  line-height: 1.05;
  color: var(--calc-burgundy);
}

.hero-main-kpi span.subtext {
  display: block;
  font-size: 13px;
  color: var(--calc-charcoal-muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* Grid de métricas secundarias */
.kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 400px) {
  .kpi-grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.kpi-box {
  background: #FAF8F5;
  border: 1px solid var(--calc-border-light);
  border-radius: 10px;
  padding: 14px;
}

.kpi-box span.kpi-lbl {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--calc-charcoal-muted);
  margin-bottom: 4px;
}

.kpi-box strong.kpi-val {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--calc-charcoal);
  line-height: 1.2;
}

.kpi-box span.kpi-detail {
  display: block;
  font-size: 11.5px;
  color: var(--calc-charcoal-muted);
  margin-top: 3px;
}

/* Tarjeta de Diagnóstico basado en evidencia (3 partes) */
.calc-diagnosis-card {
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}

.calc-diagnosis-card.healthy {
  background: #F4FAF5;
  border-color: #D1E7DD;
}

.calc-diagnosis-card.warning {
  background: #FFFBEB;
  border-color: #FDE68A;
}

.calc-diagnosis-card.danger {
  background: #FEF2F2;
  border-color: #FECACA;
}

.calc-diagnosis-card.neutral {
  background: var(--calc-cream-light);
  border-color: var(--calc-border);
}

.diag-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14.5px;
  margin-bottom: 12px;
  color: var(--calc-charcoal);
}

.diag-item {
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 10px;
  color: var(--calc-charcoal);
}

.diag-item strong {
  color: var(--calc-burgundy);
  font-weight: 700;
}

.diag-item:last-child {
  margin-bottom: 0;
}

/* =========================================================================
   SECCIÓN MATRIZ DE ESCENARIOS (ELEMENTO DIFERENCIADOR)
   ========================================================================= */

.matrix-section {
  background: #FFFFFF;
  border: 1px solid var(--calc-border);
  border-radius: 16px;
  padding: 32px 28px;
  margin-bottom: 40px;
  box-shadow: 0 4px 16px rgba(53, 41, 37, 0.03);
}

.matrix-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--calc-border-light);
}

.matrix-header h2 {
  font-family: var(--font-serif, "Zodiak", Georgia, serif);
  font-size: 24px;
  color: var(--calc-charcoal);
  margin-bottom: 6px;
}

.matrix-header p {
  font-size: 14px;
  color: var(--calc-charcoal-muted);
  max-width: 650px;
}

.matrix-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12.5px;
  font-weight: 600;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.legend-dot.loss { background: var(--calc-loss-text); }
.legend-dot.breakeven { background: #D97706; }
.legend-dot.profit { background: var(--calc-profit-text); }

/* Tabla responsive de la matriz */
.matrix-scroll-hint {
  display: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--calc-burgundy);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

@media (max-width: 768px) {
  .matrix-scroll-hint {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
  }
  .matrix-table-wrap {
    box-shadow: inset -12px 0 10px -8px rgba(140, 37, 54, 0.2);
  }
}

.matrix-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--calc-border);
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 680px;
}

.matrix-table th,
.matrix-table td {
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--calc-border-light);
  border-right: 1px solid var(--calc-border-light);
  white-space: nowrap;
}

.matrix-table th:last-child,
.matrix-table td:last-child {
  border-right: none;
}

.matrix-table thead th {
  background: var(--calc-cream-light);
  color: var(--calc-charcoal);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 2;
}

.matrix-table thead th.col-budget {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--calc-cream-light);
}

.matrix-table tbody th.row-budget {
  text-align: left;
  font-weight: 700;
  color: var(--calc-charcoal);
  background: #FFFFFF;
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 2px solid var(--calc-border);
}

.matrix-cell {
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-sans, "Plus Jakarta Sans", sans-serif);
}

.matrix-cell:hover {
  filter: brightness(0.95);
  box-shadow: inset 0 0 0 2px var(--calc-burgundy);
}

.matrix-cell.cell-loss {
  background: var(--calc-loss-bg);
  color: var(--calc-loss-text);
  font-weight: 600;
}

.matrix-cell.cell-breakeven {
  background: var(--calc-breakeven-bg);
  color: var(--calc-breakeven-text);
  font-weight: 700;
}

.matrix-cell.cell-profit {
  background: var(--calc-profit-bg);
  color: var(--calc-profit-text);
  font-weight: 700;
}

.cell-revenue-sub {
  display: block;
  font-size: 10.5px;
  opacity: 0.8;
  font-weight: normal;
}

/* Detalle desplegable de celda inspeccionada */
.matrix-cell-inspector {
  background: var(--calc-cream-light);
  border: 1px dashed var(--calc-burgundy);
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
  display: none;
}

.matrix-cell-inspector.active {
  display: block;
}

/* Opciones avanzadas y colapsables */
.calc-collapsible-drawer {
  background: #FFFFFF;
  border: 1px solid var(--calc-border);
  border-radius: 14px;
  margin-bottom: 20px;
  overflow: hidden;
}

.calc-collapsible-summary {
  padding: 18px 24px;
  font-weight: 700;
  font-size: 15px;
  color: var(--calc-charcoal);
  cursor: pointer;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background 0.15s ease;
}

.calc-collapsible-summary:hover {
  background: var(--calc-cream-light);
}

.calc-collapsible-content {
  padding: 24px;
  border-top: 1px solid var(--calc-border-light);
  background: #FCFBF9;
}

/* Barra de acciones (Exportar, Imprimir, WhatsApp) */
.calc-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 24px;
  background: var(--calc-cream-light);
  border: 1px solid var(--calc-border);
  border-radius: 14px;
  margin-bottom: 40px;
}

.calc-action-btns {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Estilos de impresión */
@media print {
  .site-header,
  .site-footer,
  .calc-mode-switcher,
  .calc-preset-bar,
  .calc-action-bar,
  .btn,
  .breadcrumb {
    display: none !important;
  }

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

  .calc-card,
  .calc-results-hero,
  .matrix-section {
    box-shadow: none !important;
    border: 1px solid #CCC !important;
    page-break-inside: avoid;
  }
}
