/* ==========================================================================
   LexAdmin Bolívar - UI Components & Controls
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons & Actions
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Botón Oro Imperial (Acción de Prestigio / Principal) */
.btn-gold {
  background: var(--gold-gradient);
  color: #0b0f19;
  border-color: rgba(251, 191, 36, 0.4);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.28);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-gold:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
}

.btn-gold:active {
  transform: translateY(0);
}

/* Botón Azul Zafiro (Intelecto / Táctico) */
.btn-primary {
  background: var(--intellect-blue);
  color: #ffffff;
  border-color: rgba(96, 165, 250, 0.3);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: var(--intellect-blue-hover);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

/* Botón Esmeralda Táctico */
.btn-cunning {
  background: var(--cunning-emerald);
  color: #062b1e;
  font-weight: 700;
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-cunning:hover {
  background: var(--cunning-emerald-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Botón Secundario / Outline */
.btn-secondary {
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-primary);
  border-color: var(--border-card);
}

.btn-secondary:hover {
  background: rgba(45, 62, 94, 0.6);
  color: var(--text-sharp);
  border-color: rgba(96, 165, 250, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-sharp);
}

.btn-danger {
  background: var(--term-critical-dim);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Cards & Executive Panels
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-normal);
  position: relative;
}

.card:hover {
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: linear-gradient(145deg, rgba(16, 24, 43, 0.9), rgba(11, 16, 28, 0.85));
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.3);
}

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  font-weight: 600;
}

.kpi-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
}

.kpi-icon-wrap.gold {
  background: var(--prestige-gold-dim);
  color: var(--prestige-gold);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.kpi-icon-wrap.blue {
  background: var(--intellect-blue-dim);
  color: var(--intellect-blue-light);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.kpi-icon-wrap.red {
  background: var(--term-critical-dim);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.kpi-icon-wrap.emerald {
  background: var(--cunning-emerald-dim);
  color: var(--cunning-emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.kpi-value {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-sharp);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.kpi-subtext {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --------------------------------------------------------------------------
   Badges & Indicators
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-critical {
  background: var(--term-critical-dim);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-warning {
  background: var(--term-warning-dim);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-safe {
  background: var(--term-safe-dim);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-gold {
  background: var(--prestige-gold-dim);
  color: var(--text-gold);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-blue {
  background: var(--intellect-blue-dim);
  color: var(--intellect-blue-light);
  border: 1px solid rgba(37, 99, 235, 0.35);
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   Data Tables
   -------------------------------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background: rgba(11, 16, 27, 0.7);
}

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

.legal-table th {
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-card);
  white-space: nowrap;
}

.legal-table td {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  vertical-align: middle;
}

.legal-table tr:hover td {
  background: rgba(37, 99, 235, 0.06);
}

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

.radicado-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--intellect-blue-light);
  font-weight: 600;
}

.currency-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-gold);
}

/* --------------------------------------------------------------------------
   Tabs Navigation
   -------------------------------------------------------------------------- */
.tabs-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-card);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-sharp);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--prestige-gold-light);
  border-bottom-color: var(--prestige-gold);
  background: rgba(245, 158, 11, 0.05);
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.tab-pane.active {
  display: block;
}

/* --------------------------------------------------------------------------
   Native Dialog Modal Styling
   -------------------------------------------------------------------------- */
dialog.legal-modal {
  margin: auto;
  padding: 0;
  background: #0d1322;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), 0 0 35px rgba(245, 158, 11, 0.15);
  color: var(--text-primary);
  width: 90%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  opacity: 0;
  transform: scale(0.96) translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), overlay 0.25s ease allow-discrete, display 0.25s ease allow-discrete;
}

dialog.legal-modal[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
}

@starting-style {
  dialog.legal-modal[open] {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
}

dialog.legal-modal::backdrop {
  background: rgba(4, 7, 13, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.25s ease, overlay 0.25s ease allow-discrete, display 0.25s ease allow-discrete;
}

dialog.legal-modal[open]::backdrop {
  opacity: 1;
}

@starting-style {
  dialog.legal-modal[open]::backdrop {
    opacity: 0;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-card);
  background: rgba(15, 23, 42, 0.6);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text-sharp);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px;
  border-top: 1px solid var(--border-card);
  background: rgba(15, 23, 42, 0.4);
}

/* Form Styles inside Modals */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: var(--text-sharp);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--intellect-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
  background: rgba(15, 23, 42, 0.95);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* --------------------------------------------------------------------------
   Timeline / Actuaciones Cronológicas
   -------------------------------------------------------------------------- */
.actuaciones-timeline {
  position: relative;
  padding-left: 28px;
  margin-top: 12px;
}

.actuaciones-timeline::before {
  content: '';
  position: absolute;
  top: 6px;
  bottom: 10px;
  left: 10px;
  width: 2px;
  background: rgba(45, 62, 94, 0.6);
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-obsidian-root);
  border: 3px solid var(--intellect-blue);
  box-shadow: 0 0 8px var(--intellect-blue);
}

.timeline-dot.gold {
  border-color: var(--prestige-gold);
  box-shadow: 0 0 8px var(--prestige-gold);
}

.timeline-content {
  background: rgba(15, 22, 38, 0.7);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.timeline-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-sharp);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.timeline-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Toast Notifications
   -------------------------------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #0f172a;
  border-left: 4px solid var(--intellect-blue);
  border-top: 1px solid var(--border-card);
  border-right: 1px solid var(--border-card);
  border-bottom: 1px solid var(--border-card);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  color: var(--text-sharp);
  font-size: 0.84rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.success {
  border-left-color: var(--cunning-emerald);
}

.toast.gold {
  border-left-color: var(--prestige-gold);
}

@keyframes slideInToast {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   Demo Warning Toast (30s auto-dismiss & manual close)
   -------------------------------------------------------------------------- */
.demo-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  max-width: 440px;
  width: calc(100vw - 48px);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius-md, 10px);
  padding: 14px 16px 12px;
  color: #cbd5e1;
  font-size: 0.8rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75), 0 0 16px rgba(245, 158, 11, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideInToast 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  overflow: hidden;
}

.demo-toast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.demo-toast-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f8fafc;
  font-size: 0.82rem;
  font-weight: 700;
}

.demo-toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
  box-shadow: 0 0 8px #f59e0b;
}

.demo-toast-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 7px;
  border-radius: 6px;
  line-height: 1.2;
  transition: all 0.2s ease;
  font-weight: bold;
}

.demo-toast-close:hover {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
}

.demo-toast-body {
  color: #94a3b8;
  line-height: 1.45;
  font-size: 0.76rem;
}

.demo-toast-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #64748b;
  padding-top: 4px;
}

.demo-toast-timer-label {
  color: #f59e0b;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
}

.demo-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.demo-toast-progress-bar {
  height: 100%;
  background: #f59e0b;
  width: 100%;
  animation: demoToastCountdown 30s linear forwards;
}

@keyframes demoToastCountdown {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* --------------------------------------------------------------------------
   Print & Client Report Formal Styling
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .sidebar, .topbar, #toast-container, .no-print {
    display: none !important;
  }
  .main-wrapper {
    height: auto !important;
    overflow: visible !important;
  }
  .content-area {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .card, .client-report-paper {
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    color: #111827 !important;
  }
}
