/* assets/ab-dictamen.css - Simulador por Sector y Dictamen para Junta Directiva  */

/* Barra de Selección de Sector y Tamaño de PyME */
.sim-sector-toolbar {
  background: #061527;
  border: 1px solid var(--border, #183552);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.sim-sector-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 320px;
}

.sim-sector-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #5eead4;
  white-space: nowrap;
}

.sim-sector-select {
  background: #0d2238;
  border: 1px solid rgba(94, 234, 212, 0.3);
  color: #f8fafc;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  max-width: 420px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.sim-sector-select:focus {
  border-color: #5eead4;
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.2);
}

.sim-size-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sim-size-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
}

.sim-size-pills {
  display: inline-flex;
  gap: 6px;
  background: rgba(13, 34, 56, 0.7);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border, #183552);
}

.sim-size-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sim-size-btn:hover {
  color: #fff;
}

.sim-size-btn.is-active {
  background: rgba(94, 234, 212, 0.2);
  color: #5eead4;
  border: 1px solid rgba(94, 234, 212, 0.4);
}

/* Tarjeta de Norma e Impacto Sectorial */
.sim-sector-meta-card {
  background: rgba(13, 34, 56, 0.5);
  border: 1px dashed rgba(94, 234, 212, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 14px;
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sim-meta-item strong {
  color: #5eead4;
}

/* Panel de Fórmulas y Supuestos Transparentes (Regla 10) */
.sim-transparency-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border, #183552);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 24px 0;
  font-size: 0.88rem;
  color: #cbd5e1;
}

.sim-transparency-box summary {
  cursor: pointer;
  font-weight: 700;
  color: #5eead4;
  user-select: none;
  outline: none;
}

.sim-transparency-box summary:hover {
  text-decoration: underline;
}

.sim-transparency-content {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.6;
}

.sim-formula-code {
  background: #061527;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.82rem;
  color: #38bdf8;
  margin: 6px 0;
  display: block;
  overflow-x: auto;
}

/* Botón y Modal de Dictamen para Junta Directiva */
.sim-dictamen-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.12) 0%, rgba(13, 34, 56, 0.9) 100%);
  border: 1px solid #5eead4;
  border-radius: 12px;
  margin: 28px 0;
  box-shadow: 0 10px 30px rgba(94, 234, 212, 0.1);
}

.sim-dictamen-btn {
  background: #5eead4;
  color: #042f2e;
  border: none;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 4px 14px rgba(94, 234, 212, 0.35);
}

.sim-dictamen-btn:hover {
  background: #2dd4bf;
  transform: translateY(-2px);
}

/* ==============================================================================
   MODAL DEL DICTAMEN - ARQUITECTURA VISUAL POWER BI / BOARD REPORT
   ============================================================================== */
.dictamen-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(3, 10, 20, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 40px 16px 80px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  justify-content: center;
  align-items: flex-start !important; /* CORRECCIÓN CRÍTICA: Garantiza que el papel crezca y no desborde texto */
}

.dictamen-modal-overlay.is-active {
  display: flex !important;
}

.dictamen-paper {
  background: #ffffff;
  color: #0f172a;
  width: 100%;
  max-width: 960px;
  min-height: min-content;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 44px;
  margin: 0 auto 40px auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  position: relative;
  line-height: 1.55;
  box-sizing: border-box;
}

.dictamen-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  z-index: 10;
}

.dictamen-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: scale(1.05);
}

/* Cabecera Ejecutiva Tipo Tablero */
.dictamen-header {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 18px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.dictamen-brand {
  font-size: 1.35rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.dictamen-brand span {
  color: #0d9488;
}

.dictamen-classification-pill {
  display: inline-block;
  background: #0f172a;
  color: #5eead4;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 4px;
  margin-top: 6px;
}

.dictamen-meta {
  text-align: right;
  font-size: 0.82rem;
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dictamen-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px 0;
  line-height: 1.25;
}

.dictamen-subtitle {
  font-size: 0.95rem;
  color: #475569;
  margin-bottom: 20px;
}

.dictamen-disclaimer {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ==============================================================================
   TARJETAS KPI EJECUTIVAS EJECUTIVAS
   ============================================================================== */
.pbi-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.pbi-kpi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  position: relative;
  overflow: hidden;
}

.pbi-kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.pbi-card-teal::before { background: #0d9488; }
.pbi-card-sky::before { background: #0284c7; }
.pbi-card-indigo::before { background: #6366f1; }
.pbi-card-emerald::before { background: #059669; }

.pbi-kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.pbi-kpi-val {
  font-size: 1.55rem;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.15;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.pbi-kpi-sub {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pbi-card-teal .pbi-kpi-sub { color: #0d9488; }
.pbi-card-sky .pbi-kpi-sub { color: #0284c7; }
.pbi-card-indigo .pbi-kpi-sub { color: #4f46e5; }
.pbi-card-emerald .pbi-kpi-sub { color: #059669; }

/* ==============================================================================
   PANELES VISUALES Y GRÁFICAS ANALÍTICAS SVG (ESTILO POWER BI)
   ============================================================================== */
.pbi-visuals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.pbi-visual-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.pbi-visual-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pbi-visual-tag {
  font-size: 0.72rem;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.dictamen-section {
  margin-bottom: 28px;
}

.dictamen-section h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a !important; /* Asegura máxima visibilidad */
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.dictamen-section p,
.dictamen-section li {
  color: #334155 !important; /* Asegura máxima legibilidad */
  font-size: 0.92rem;
  line-height: 1.6;
}

.dictamen-section strong {
  color: #0f172a !important;
}

.dictamen-kpi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 12px 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.dictamen-kpi-table th {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  border: 1px solid #1e293b;
  font-size: 0.84rem;
}

.dictamen-kpi-table td {
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  color: #334155;
  background: #ffffff;
}

.dictamen-kpi-table tr:nth-child(even) td {
  background: #f8fafc;
}

/* Cajas Visuales de Arquitectura y Hoja de Ruta */
.pbi-flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.pbi-flow-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
}

.pbi-flow-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 6px;
}

.tag-prob { background: #e0f2fe; color: #0369a1; }
.tag-det { background: #dcfce7; color: #15803d; }
.tag-sec { background: #ede9fe; color: #6d28d9; }

.dictamen-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
  border-top: 1px solid #e2e8f0;
  padding-top: 20px;
}

.dictamen-print-btn {
  background: #0f172a;
  color: #ffffff;
  border: none;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.dictamen-print-btn:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

.dictamen-export-btn {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.dictamen-export-btn:hover {
  background: #e2e8f0;
}

/* ==============================================================================
   REGLAS PARA IMPRESIÓN (@media print) FORMATO CARTA / A4
   ============================================================================== */
@media print {
  body * {
    visibility: hidden;
  }

  .dictamen-modal-overlay,
  .dictamen-modal-overlay * {
    visibility: visible;
  }

  .dictamen-modal-overlay {
    position: absolute;
    inset: 0;
    background: transparent !important;
    padding: 0 !important;
    display: block !important;
    overflow: visible !important;
  }

  .dictamen-paper {
    box-shadow: none !important;
    padding: 15mm !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
    color: #000000 !important;
    border: none !important;
    margin: 0 !important;
  }

  .dictamen-close-btn,
  .dictamen-actions-bar,
  #site-header,
  #site-footer,
  .ab-nav,
  .ab-copilot-pill,
  button {
    display: none !important;
  }

  .dictamen-section,
  .pbi-visual-card,
  .pbi-kpi-card {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  @page {
    size: letter;
    margin: 12mm;
  }
}

/* Botón Alternar Gráfica / Tabla Accesible (Regla 10) */
.sim-toggle-view-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #5eead4;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  margin: 8px 0 14px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.sim-toggle-view-btn:hover,
.sim-toggle-view-btn:focus-visible {
  background: rgba(94, 234, 212, 0.15);
  border-color: #5eead4;
  color: #fff;
  outline: none;
}
