/* ==========================================================================
   DIRECTRICES DE VISUALIZACIÓN Y ARQUITECTURA ELECTORAL // ANTIOQUIA
   Estándar de Diseño: Dark Obsidian Tactical (#07090e / #0d121c / #0f172a)
   Atlas Intel / LaTeX Analytics & Glassmorphism
   ========================================================================== */

#directrices-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 24px 60px 24px;
  background-color: var(--bg-primary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary);
  box-sizing: border-box;
  animation: fadeIn 0.25s ease-out;
}

/* Custom Scrollbar */
#directrices-viewport::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
#directrices-viewport::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.4);
}
#directrices-viewport::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.4);
  border-radius: 3px;
}

/* Top Command Bar */
.directrices-command-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.directrices-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.directrices-select {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.directrices-select:hover, .directrices-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

.directrices-quadrant-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* 3-Column Tactical Analysis Grid */
.directrices-grid-layout {
  display: grid;
  grid-template-columns: 1.15fr 1.35fr 1.15fr;
  gap: 12px;
  min-height: 580px;
}

@media (max-width: 1300px) {
  .directrices-grid-layout {
    grid-template-columns: 1fr;
  }
}

/* Column Cards */
.directriz-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.directriz-column::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  opacity: 0.7;
}

.directriz-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
  margin-bottom: 2px;
}

.directriz-title-group h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.directriz-title-group .subtitle {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* Glass Inner Cards */
.tactical-box {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s;
}

.tactical-box:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.box-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* KPIs in Directriz 1 */
.health-kpis-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.health-kpi-item {
  background: rgba(0, 0, 0, 0.35);
  border-left: 3px solid var(--accent-cyan);
  padding: 6px 10px;
  border-radius: 4px;
}

.health-kpi-item.emerald { border-left-color: var(--accent-emerald); }
.health-kpi-item.amber { border-left-color: var(--accent-amber); }
.health-kpi-item.rose { border-left-color: var(--accent-rose); }

.kpi-label {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}

/* Forensic Alert Badge */
.forensic-alert-badge {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.forensic-alert-badge.normal {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
}

.forensic-alert-badge.severa {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(239, 68, 68, 0.5); box-shadow: 0 0 8px rgba(239, 68, 68, 0.2); }
  50% { border-color: #ef4444; box-shadow: 0 0 16px rgba(239, 68, 68, 0.5); }
}

/* Cruce Ejecutivo vs Colegiado */
.split-analysis-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.split-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.split-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}

.split-progress-container {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.split-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.split-diagnosis-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

/* Ranking de Candidatos Congreso */
.candidate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 10.5px;
  transition: background 0.15s;
}

.candidate-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.candidate-row:last-child {
  border-bottom: none;
}

.cand-tarjeton-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-cyan);
  margin-right: 6px;
}

/* Directriz 2: Mapa & Capas */
.subregion-axiom-banner {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 10px;
  color: #cffafe;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subregion-axiom-banner strong {
  color: #fff;
}

.layer-switch-strip {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.layer-switch-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.layer-switch-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.layer-switch-btn.active {
  background: var(--accent-cyan);
  color: #07090e;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

#directrices-leaflet-map {
  height: 380px;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: #07090e;
}

/* Subregion Chips Bar */
.subregion-chips-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.subregion-mini-chip {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 9.5px;
  font-family: var(--font-mono);
  padding: 3px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.subregion-mini-chip:hover {
  border-color: var(--accent-cyan);
  color: #fff;
}

.subregion-mini-chip.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
  color: #fff;
}

/* Directriz 3: Radar de Corporados */
.preference-gauge-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gauge-legend-strip {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.gauge-multi-bar {
  height: 14px;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}

.gauge-fill-preferente {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  transition: width 0.4s ease;
}

.gauge-fill-logo {
  height: 100%;
  background: #06b6d4;
  transition: width 0.4s ease;
}

.treason-alert-box {
  background: rgba(239, 68, 68, 0.12);
  border-left: 4px solid #ef4444;
  border-top: 1px solid rgba(239, 68, 68, 0.3);
  border-right: 1px solid rgba(239, 68, 68, 0.3);
  border-bottom: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.treason-alert-title {
  color: #f87171;
  font-weight: 800;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Micro Leak Puestos Table */
.micro-puestos-table-wrap {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
}

.micro-puestos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.micro-puestos-table th {
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 2;
}

.micro-puestos-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.micro-puestos-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
}

/* Bottom Practical Decision Panel */
.directrices-decision-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.decision-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.decision-panel-header h4 {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #fff;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.decision-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 1100px) {
  .decision-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .decision-cards-grid {
    grid-template-columns: 1fr;
  }
}

.decision-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: transform 0.2s, border-color 0.2s;
}

.decision-card:hover {
  transform: translateY(-2px);
}

.decision-card.card-green {
  border-left: 4px solid var(--accent-emerald);
}
.decision-card.card-amber {
  border-left: 4px solid var(--accent-amber);
}
.decision-card.card-cyan {
  border-left: 4px solid var(--accent-cyan);
}
.decision-card.card-rose {
  border-left: 4px solid var(--accent-rose);
}

.decision-card-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.decision-card-body {
  font-size: 10.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ==========================================================================
   INTERACTIVE WORKSPACE: FOCUS MODE, PREFERENCES & ACCORDIONS
   ========================================================================== */

/* Fullscreen Focus Mode on Columns */
.directriz-column.fullscreen-focus {
  position: fixed !important;
  top: 60px !important;
  left: 20px !important;
  right: 20px !important;
  bottom: 20px !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  z-index: 9999 !important;
  background: var(--bg-surface-elevated) !important;
  border: 1px solid var(--accent-cyan) !important;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.95), 0 0 20px rgba(6, 182, 212, 0.3) !important;
  overflow-y: auto !important;
  animation: modalSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.directriz-column.fullscreen-focus #directrices-leaflet-map {
  height: 480px !important;
}

/* Focus Button (⛶ / ↗) */
.focus-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.focus-toggle-btn:hover {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  transform: scale(1.08);
}

/* Floating Restore Button when in Focus */
.focus-exit-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-rose);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.focus-exit-btn:hover {
  background: var(--accent-rose);
  color: #000;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

/* Widget Preferences Dropdown */
.widget-prefs-wrap {
  position: relative;
  display: inline-block;
}

.widget-prefs-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  margin-top: 6px;
  width: 260px;
  background: #090d16 !important;
  border: 1px solid var(--accent-cyan) !important;
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.95), 0 0 15px rgba(6, 182, 212, 0.25) !important;
  padding: 12px 14px;
  z-index: 9999 !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: modalSlideDown 0.18s ease-out;
}

.widget-pref-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}

.widget-pref-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.widget-pref-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent-cyan);
}

/* Collapsible Accordions in Tactical Boxes */
.box-title.collapsible {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.box-title.collapsible:hover {
  color: var(--accent-cyan);
}

.accordion-chevron {
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 10px;
  margin-left: 4px;
}

.tactical-box.collapsed .accordion-chevron {
  transform: rotate(-90deg);
}

.tactical-box.collapsed > :not(.box-title) {
  display: none !important;
}

/* Row Pulse Highlight when targeted by Search */
@keyframes rowPulseGlow {
  0% { background: rgba(6, 182, 212, 0.35); }
  50% { background: rgba(6, 182, 212, 0.7); }
  100% { background: transparent; }
}

.row-highlight-pulse {
  animation: rowPulseGlow 2.5s ease-out;
}

/* ==========================================================================
   PRINT STYLES FOR EXECUTIVE DOSSIER (1-PAGE A4 BRIEFING)
   ========================================================================== */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .command-hud, .quick-muni-strip, .directrices-command-bar, .focus-toggle-btn, .sidebar-floating-toggle, #arbe-login-overlay, #app-loader {
    display: none !important;
  }
  #directrices-viewport {
    position: static !important;
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
    height: auto !important;
    overflow: visible !important;
  }
  .directrices-grid-layout {
    display: block !important;
  }
  .directriz-column {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 12px !important;
  }
  .directrices-decision-panel {
    background: #f8fafc !important;
    color: #000 !important;
    border: 1px solid #ddd !important;
  }
  .decision-card {
    background: #fff !important;
    border: 1px solid #bbb !important;
    color: #000 !important;
  }
}
