/* ================================================================
   AntiPhishing MX — Stylesheet
   Dark Premium Design — Glassmorphism + Cybersecurity Aesthetic
   ================================================================ */

/* --------------------------------
   CSS Custom Properties
   -------------------------------- */
:root {
  /* Colors */
  --bg-base:        #070d14;
  --bg-surface:     #0d1825;
  --bg-card:        #111d2e;
  --bg-card-hover:  #162236;
  --border:         rgba(0, 212, 255, 0.12);
  --border-hover:   rgba(0, 212, 255, 0.30);

  --cyan:           #00d4ff;
  --cyan-dim:       rgba(0, 212, 255, 0.15);
  --cyan-glow:      rgba(0, 212, 255, 0.35);
  --purple:         #7b2fff;
  --purple-dim:     rgba(123, 47, 255, 0.15);

  --red:            #ff4d6d;
  --red-dim:        rgba(255, 77, 109, 0.15);
  --red-glow:       rgba(255, 77, 109, 0.40);

  --yellow:         #ffd166;
  --yellow-dim:     rgba(255, 209, 102, 0.15);

  --green:          #06d6a0;
  --green-dim:      rgba(6, 214, 160, 0.15);
  --green-glow:     rgba(6, 214, 160, 0.35);

  --text-primary:   #e8f4f8;
  --text-secondary: #7a9bb5;
  --text-muted:     #445e73;

  /* Sidebar */
  --sidebar-w: 240px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  /* Radius */
  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

/* --------------------------------
   Reset & Base
   -------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #1e3550; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2a4a6e; }

/* --------------------------------
   Layout
   -------------------------------- */
body {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
}

/* --------------------------------
   Sidebar
   -------------------------------- */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--cyan-dim), var(--purple-dim));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-main {
  display: block;
  font-weight: 700;
  font-size: 13px;
  color: var(--cyan);
  letter-spacing: 0.5px;
}

.logo-sub {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Nav */
.nav-menu {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  transition: all var(--transition);
  border: 1px solid transparent;
}

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

.nav-item:hover {
  background: var(--cyan-dim);
  color: var(--cyan);
  border-color: var(--border);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--cyan-dim), var(--purple-dim));
  color: var(--cyan);
  border-color: var(--border-hover);
  box-shadow: 0 0 20px var(--cyan-glow);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.version-badge {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* --------------------------------
   Main Content
   -------------------------------- */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-base);
  overflow-y: auto;
}

/* --------------------------------
   Topbar
   -------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(8px);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 6px;
}
.menu-toggle span { display: block; width: 20px; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: var(--transition); }

.topbar-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  display: block;
}
.status-dot.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--green-glow); }
  50%       { box-shadow: 0 0 0 6px transparent; }
}

/* --------------------------------
   Views
   -------------------------------- */
.view { display: none; padding: 28px; animation: fadeIn 0.3s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-header { margin-bottom: 28px; }

.view-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.view-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

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

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  right: 0; height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.kpi-total::before  { background: var(--cyan); }
.kpi-blocked::before { background: var(--red); }
.kpi-review::before  { background: var(--yellow); }
.kpi-safe::before    { background: var(--green); }
.kpi-score::before   { background: var(--purple); }

.kpi-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.kpi-icon { font-size: 24px; }

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
}

.kpi-pct {
  position: absolute;
  right: 16px;
  top: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  background: var(--red-dim);
  padding: 2px 8px;
  border-radius: 20px;
}

/* --------------------------------
   Charts Grid
   -------------------------------- */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition);
}

.chart-card.wide {
  grid-column: 1 / -1;
}

.chart-card:hover { border-color: var(--border-hover); }

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

.chart-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.legend-dot.red    { background: var(--red); }
.legend-dot.yellow { background: var(--yellow); }
.legend-dot.green  { background: var(--green); }

.chart-body { height: 160px; position: relative; }

.chart-card.wide .chart-body { height: 200px; }

/* --------------------------------
   Tables Grid (Dashboard)
   -------------------------------- */
.tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.table-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.table-body { padding: 8px 0; }

/* --------------------------------
   Data Table
   -------------------------------- */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  margin-bottom: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tbody tr:hover td {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.table-loading {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
  font-style: italic;
}

.loading-row {
  padding: 24px 20px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* --------------------------------
   Badges
   -------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-alto     { background: var(--red-dim);    color: var(--red);    border: 1px solid rgba(255,77,109,0.3); }
.badge-medio    { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255,209,102,0.3); }
.badge-bajo     { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(6,214,160,0.3); }

.badge-bloquear { background: var(--red-dim);    color: var(--red); }
.badge-revisar  { background: var(--yellow-dim); color: var(--yellow); }
.badge-permitir { background: var(--green-dim);  color: var(--green); }

/* Score Pill */
.score-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  min-width: 44px;
  text-align: center;
}

.score-pill.high   { background: var(--red-dim);    color: var(--red);    border: 1px solid rgba(255,77,109,0.3); }
.score-pill.medium { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255,209,102,0.3); }
.score-pill.low    { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(6,214,160,0.3); }

/* --------------------------------
   Evaluador
   -------------------------------- */
.evaluator-container {
  max-width: 900px;
}

.evaluator-input-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
}

.input-group-eval {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-group-eval:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}

.domain-icon {
  padding: 0 14px;
  font-size: 18px;
  flex-shrink: 0;
}

.domain-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 16px;
  font-family: var(--font-mono);
  padding: 14px 0;
}

.domain-input::placeholder { color: var(--text-muted); font-family: var(--font-sans); }

.btn-eval {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  border: none;
  color: #fff;
  padding: 14px 24px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity var(--transition);
  min-width: 110px;
  justify-content: center;
}

.btn-eval:hover { opacity: 0.85; }
.btn-eval:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

.input-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.input-hint code {
  background: var(--bg-surface);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: var(--cyan);
}

.quick-tests {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.quick-label {
  font-size: 12px;
  color: var(--text-muted);
}

.quick-btn {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid;
  background: none;
  font-family: var(--font-mono);
  transition: all var(--transition);
  cursor: pointer;
}

.quick-btn.danger {
  color: var(--red);
  border-color: rgba(255,77,109,0.4);
}
.quick-btn.danger:hover { background: var(--red-dim); }

.quick-btn.warning {
  color: var(--yellow);
  border-color: rgba(255,209,102,0.4);
}
.quick-btn.warning:hover { background: var(--yellow-dim); }

.quick-btn.safe {
  color: var(--green);
  border-color: rgba(6,214,160,0.4);
}
.quick-btn.safe:hover { background: var(--green-dim); }

/* --------------------------------
   Result Container
   -------------------------------- */
.result-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  animation: fadeIn 0.4s ease;
}

.result-main {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  margin-bottom: 24px;
  align-items: start;
}

/* Gauge */
.gauge-container { text-align: center; }

.gauge-svg { width: 200px; height: 120px; }

.gauge-track { transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.5s ease; }

.gauge-score-text {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 800;
  fill: var(--text-primary);
}

.gauge-label-text {
  font-size: 8px;
  font-weight: 600;
  fill: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.gauge-range-text {
  font-size: 9px;
  fill: var(--text-muted);
  font-family: var(--font-mono);
}

.gauge-level {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.gauge-level.alto   { color: var(--red); }
.gauge-level.medio  { color: var(--yellow); }
.gauge-level.bajo   { color: var(--green); }

/* Result Info */
.result-domain {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 8px;
  word-break: break-all;
}

.result-action {
  font-size: 14px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 12px;
}

.result-action.bloquear {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255,77,109,0.4);
}
.result-action.revisar {
  background: var(--yellow-dim);
  color: var(--yellow);
  border: 1px solid rgba(255,209,102,0.4);
}
.result-action.permitir {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(6,214,160,0.4);
}

.result-entity {
  font-size: 13px;
  color: var(--yellow);
  margin-bottom: 16px;
  min-height: 0;
}

/* Breakdown Bars */
.score-breakdown { margin-top: 8px; }

.breakdown-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.breakdown-item {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.breakdown-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.breakdown-bar-wrap {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
}

.breakdown-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.breakdown-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  text-align: right;
}

/* Motivos */
.result-motivos {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.motivos-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.motivo-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.motivo-item:last-child { border-bottom: none; }

.motivo-item::before {
  content: '›';
  color: var(--cyan);
  font-weight: 700;
  flex-shrink: 0;
}

/* DNS Data */
.result-dns {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.dns-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.dns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.dns-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.dns-item-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.dns-item-value {
  font-size: 13px;
  color: var(--cyan);
  font-family: var(--font-mono);
  word-break: break-all;
}

/* Result Actions */
.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-action {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid;
  transition: all var(--transition);
}

.btn-blacklist {
  background: var(--red-dim);
  border-color: rgba(255,77,109,0.4);
  color: var(--red);
}
.btn-blacklist:hover { background: rgba(255,77,109,0.25); }

.btn-copy {
  background: var(--cyan-dim);
  border-color: rgba(0,212,255,0.3);
  color: var(--cyan);
}
.btn-copy:hover { background: rgba(0,212,255,0.2); }

/* --------------------------------
   Historial Controls
   -------------------------------- */
.historial-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  flex: 1;
  min-width: 200px;
}

.search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  padding: 10px 0;
  font-size: 13px;
  width: 100%;
}

.search-input::placeholder { color: var(--text-muted); }

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.filter-select:focus { border-color: var(--cyan); }

.filter-date {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
}

.btn-filter, .btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  border: none;
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  transition: opacity var(--transition);
}

.btn-filter:hover, .btn-primary:hover { opacity: 0.85; }

.btn-export {
  background: var(--green-dim);
  border: 1px solid rgba(6,214,160,0.3);
  color: var(--green);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-export:hover { background: rgba(6,214,160,0.2); }

.btn-danger {
  background: var(--red-dim);
  border: 1px solid rgba(255,77,109,0.4);
  color: var(--red);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.btn-danger:hover { background: rgba(255,77,109,0.25); }

/* --------------------------------
   Pagination
   -------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin-top: 16px;
}

.page-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  cursor: pointer;
}

.page-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.page-btn.active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--bg-base);
  font-weight: 700;
}

/* --------------------------------
   Rules Form
   -------------------------------- */
.rule-form-card,
.blacklist-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.form-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.rule-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.form-control:focus { border-color: var(--cyan); }

/* Rules Tabs */
.rules-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  width: fit-content;
}

.tab-btn {
  background: none;
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 4px;
  transition: all var(--transition);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--cyan-dim), var(--purple-dim));
  color: var(--cyan);
  border: 1px solid var(--border-hover);
}

.tab-btn:not(.active):hover {
  color: var(--text-secondary);
  background: var(--bg-surface);
}

/* --------------------------------
   Action Buttons Table
   -------------------------------- */
.btn-icon {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  padding: 4px 8px;
  font-size: 12px;
  transition: all var(--transition);
  cursor: pointer;
}

.btn-icon:hover { color: var(--text-primary); border-color: var(--border); }
.btn-icon.delete:hover { color: var(--red); border-color: rgba(255,77,109,0.3); }
.btn-icon.toggle:hover { color: var(--cyan); border-color: var(--border-hover); }

/* --------------------------------
   Entities Grid
   -------------------------------- */
.entities-search {
  margin-bottom: 20px;
  max-width: 400px;
}

.entities-search .search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  width: 100%;
}

.entities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.entity-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all var(--transition);
}

.entity-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.entity-type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.tipo-gobierno         { background: rgba(0,212,255,0.12); color: var(--cyan); }
.tipo-banco            { background: rgba(123,47,255,0.12); color: #a78bfa; }
.tipo-regulador        { background: rgba(255,209,102,0.12); color: var(--yellow); }
.tipo-seguridad_social { background: rgba(6,214,160,0.12); color: var(--green); }
.tipo-otro             { background: rgba(148,163,184,0.12); color: #94a3b8; }

.entity-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.entity-sigla {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  margin-bottom: 6px;
}

.entity-domain {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.entity-keywords {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --------------------------------
   Toast Notifications
   -------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text-primary);
  max-width: 340px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 3px solid;
}

.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }
.toast.info    { border-left-color: var(--cyan); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(30px); }
}

/* --------------------------------
   Modal
   -------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(700px, 95vw);
  max-height: 85vh;
  overflow-y: auto;
  animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--red); }

.modal-body { padding: 24px; }

/* --------------------------------
   Responsive
   -------------------------------- */
@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    left: -100%;
    width: var(--sidebar-w);
    transition: left var(--transition-slow);
    z-index: 200;
  }

  .sidebar.open { left: 0; }

  .main-content { grid-column: 1; }

  .menu-toggle { display: flex; }

  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: 1; }
  .tables-grid { grid-template-columns: 1fr; }
  .result-main { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .view { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
