/* =====================================================
   PANEL ADMINISTRATIVO — Tema claro profesional
   Sistema de Detección de Phishing Bancario
   Autor: Héctor Alfonzo — UCOM
   Versión: 3.0 — Julio 2026
===================================================== */

/* =====================================================
   VARIABLES
===================================================== */
:root {
  /* Panel de monitoreo — azul medio (inspirado en el gradiente del login) */
  --bg:           #4a5068;
  --panel:        #545b75;
  --panel-2:      #5e6580;
  --border:       rgba(255, 255, 255, 0.12);
  --border-hover: rgba(255, 255, 255, 0.22);
  --text:         #dce1eb;
  --text-strong:  #f3f5f9;
  --text-muted:   #a0a8bb;
  --accent:       #818cf8;
  --accent-light: #a5b4fc;
  --accent-bg:    rgba(129, 140, 248, 0.12);
  --success:      #22c55e;
  --danger:       #ef4444;
  --warn:         #f59e0b;
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --radius-full:  9999px;
  --shadow:       0 4px 20px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg:    0 10px 40px rgba(0, 0, 0, 0.18);
  --shadow-soft:  0 2px 8px rgba(0, 0, 0, 0.1);
  --transition:   180ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* =====================================================
   FONDO GENERAL
===================================================== */
.admin-bg {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* =====================================================
   PANTALLA DE LOGIN
===================================================== */
/* =====================================================
   PANTALLA DE LOGIN — Tema claro con gradiente
===================================================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
}

.login-screen::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(255,255,255,0.05) 0%, transparent 40%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25), 0 10px 20px rgba(0, 0, 0, 0.1);
  padding: 40px 36px 32px;
  position: relative;
  z-index: 1;
}

.login-card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 32px;
  text-align: center;
}

.login-card-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  margin-bottom: 10px;
}

.login-card-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.25;
  margin-bottom: 6px;
}

.login-card-sub {
  font-size: 0.88rem;
  color: #64748b;
}

/* Campos del login */
.login-field {
  margin-bottom: 18px;
}

.login-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: #94a3b8;
  pointer-events: none;
}

.login-input {
  width: 100%;
  padding: 12px 42px 12px 40px;
  border-radius: var(--radius-md);
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #1e293b;
  font-size: 0.92rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.login-input::placeholder { color: #94a3b8; }

.login-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  background: #fff;
}

.login-eye {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.login-eye:hover { color: #334155; }
.login-eye:focus-visible { outline: 2px solid var(--accent); }
.login-eye svg { width: 17px; height: 17px; }

.login-error {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: #dc2626;
  min-height: 1.1em;
}

/* Botón de login */
.login-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.login-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}
.login-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.login-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.login-btn-spinner {
  width: 16px;
  height: 16px;
  animation: spin 0.8s linear infinite;
}

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

.login-footer-note {
  margin-top: 24px;
  font-size: 0.76rem;
  color: #94a3b8;
  text-align: center;
  line-height: 1.5;
}

/* =====================================================
   PANEL PRINCIPAL — CONTENEDOR
===================================================== */
.admin-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
}

/* =====================================================
   CABECERA DEL PANEL
===================================================== */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 20px 24px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.admin-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-strong);
  margin: 0;
  line-height: 1.2;
}

.admin-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
}

.admin-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

/* Estadísticas rápidas */
.admin-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 52px;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-strong);
  line-height: 1;
}

.stat-value-danger { color: var(--danger); }
.stat-value-warn   { color: var(--warn); }

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  font-weight: 600;
}

.stat-sep {
  width: 1px;
  height: 30px;
  background: var(--border);
  margin: 0 6px;
}

/* Acciones de cabecera */
.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--accent-bg);
  border: 1px solid rgba(99, 102, 241, 0.15);
  font-size: 0.78rem;
}

.admin-user-info strong { color: var(--accent-light); font-weight: 700; }
.admin-user-info small { color: var(--text-muted); font-size: 0.7rem; }

.admin-updated {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.btn-icon:hover {
  background: var(--panel-2);
  color: var(--text-strong);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-soft);
}
.btn-icon:focus-visible { outline: 2px solid var(--accent); }
.btn-icon svg { width: 15px; height: 15px; }

.btn-icon-danger:hover {
  background: rgba(239,68,68,0.1);
  color: var(--danger);
  border-color: rgba(239,68,68,0.25);
}

/* =====================================================
   TARJETA PRINCIPAL
===================================================== */
.admin-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-card-head {
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}

.admin-card-body {
  padding: 18px 20px 16px;
}

/* =====================================================
   BARRA DE HERRAMIENTAS
===================================================== */
.admin-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-filter-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.admin-filter {
  min-width: 200px;
}

.admin-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-select {
  border-radius: var(--radius-md) !important;
  border: 1.5px solid var(--border) !important;
  background: var(--panel-2) !important;
  color: var(--text-strong) !important;
  font-size: 0.85rem !important;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.admin-select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
  outline: none !important;
}

/* Leyenda */
.admin-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.legend-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 4px;
  font-weight: 600;
}

/* =====================================================
   ESTADO DE LA TABLA
===================================================== */
.table-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.table-state.hidden { display: none; }

.state-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.state-icon-error { font-size: 2rem; }
.state-msg-error  { color: var(--danger); font-weight: 600; }

/* =====================================================
   DATATABLES — controles
===================================================== */
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_info {
  color: var(--text-muted) !important;
  font-size: 0.82rem !important;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  padding: 7px 12px !important;
  background: var(--panel-2) !important;
  color: var(--text-strong) !important;
  outline: none;
  font-size: 0.85rem !important;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--radius-sm) !important;
  color: var(--text-muted) !important;
  font-size: 0.82rem !important;
  border: none !important;
  background: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--panel-2) !important;
  color: var(--text-strong) !important;
  border: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--accent-bg) !important;
  color: var(--accent-light) !important;
  border: 1px solid rgba(99, 102, 241, 0.25) !important;
  font-weight: 700;
}

/* =====================================================
   TABLA
===================================================== */
.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#tabla-reportes {
  width: 100% !important;
  table-layout: auto;
  font-size: 0.83rem;
  color: var(--text-strong) !important;
}

#tabla-reportes thead th {
  background: #434a60 !important;
  color: var(--text-muted) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 11px 12px !important;
  white-space: nowrap !important;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#tabla-reportes tbody td {
  background: var(--panel) !important;
  border-color: var(--border) !important;
  padding: 10px 12px !important;
  vertical-align: middle;
  color: var(--text-strong) !important;
  border-bottom: 1px solid var(--border) !important;
}

#tabla-reportes.table-striped tbody tr:nth-of-type(odd) td {
  background: var(--panel-2) !important;
}

#tabla-reportes.table-hover tbody tr:hover td {
  background: rgba(99, 102, 241, 0.06) !important;
}

/* Clamp para celdas largas */
.cell-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
  max-width: 200px;
}

.cell-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 0.80rem;
  white-space: nowrap;
  color: var(--text);
}

/* =====================================================
   BADGES DE ACCESOS
===================================================== */
.badge-ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.78rem;
  border: 1px solid rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
}

.badge-warn {
  border-color: rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.1);
  color: #fde68a;
}

.badge-bad {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

/* Badge de score de abuso */
.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.score-safe   { background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.25);  color: #86efac; }
.score-low    { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.25); color: #fde68a; }
.score-medium { background: rgba(249,115,22,0.1); border: 1px solid rgba(249,115,22,0.25); color: #fed7aa; }
.score-high   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.25);  color: #fca5a5; }

/* Badge de estado */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.73rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: default;
}

.status-NEW           { background: rgba(239,68,68,0.1);   border: 1px solid rgba(239,68,68,0.25);   color: #fca5a5; }
.status-INVESTIGATING { background: rgba(245,158,11,0.1);  border: 1px solid rgba(245,158,11,0.25);  color: #fde68a; }
.status-RESOLVED      { background: rgba(34,197,94,0.1);   border: 1px solid rgba(34,197,94,0.25);   color: #86efac; }
.status-FALSE_POSITIVE{ background: rgba(100,116,139,0.1); border: 1px solid rgba(100,116,139,0.25); color: #94a3b8; }

/* =====================================================
   SELECTOR DE ESTADO (editable en la tabla)
===================================================== */
.status-select {
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-size: 0.73rem;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--panel-2);
  color: var(--text-strong);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  min-width: 115px;
}

.status-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.status-select.status-NEW {
  border-color: rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.1);
  color: #fca5a5;
}

.status-select.status-INVESTIGATING {
  border-color: rgba(245,158,11,0.35);
  background: rgba(245,158,11,0.1);
  color: #fde68a;
}

.status-select.status-RESOLVED {
  border-color: rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.1);
  color: #86efac;
}

.status-select.status-FALSE_POSITIVE {
  border-color: rgba(100,116,139,0.35);
  background: rgba(100,116,139,0.1);
  color: #94a3b8;
}

/* =====================================================
   BOTONES DE ACCIÓN
===================================================== */
/* =====================================================
   BOTONES DE ACCIÓN
===================================================== */
.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: var(--accent-bg);
  color: var(--accent-light);
  font-weight: 700;
  font-size: 0.75rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.btn-export:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.btn-export:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-report {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239,68,68,0.25);
  background: rgba(239,68,68,0.08);
  color: #fca5a5;
  font-weight: 700;
  font-size: 0.75rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.btn-report:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.4);
  box-shadow: 0 2px 8px rgba(239,68,68,0.15);
  color: #fff;
}

.btn-report:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

/* =====================================================
   PIE DE PÁGINA
===================================================== */
.admin-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 24px;
  padding-bottom: 28px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-sep { opacity: 0.35; }

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 768px) {
  .admin-container { padding: 0 12px; }
  .admin-title { font-size: 1.15rem; }
  .admin-header { padding: 16px; flex-direction: column; }
  .admin-header-right { align-items: flex-start; }
  .admin-stats { flex-wrap: wrap; }
  .admin-toolbar { flex-direction: column; align-items: stretch; }
  .admin-filter { min-width: 100%; }
  .admin-legend { justify-content: center; }
  .login-card { padding: 32px 24px 26px; }
}


/* =====================================================
   DROPDOWN INFORMES
===================================================== */
.dropdown-informes {
  position: relative;
  display: inline-block;
}

.dropdown-menu-informes {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  min-width: 260px;
  z-index: 200;
  padding: 8px;
}

.dropdown-item-informe {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.dropdown-item-informe svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.dropdown-item-informe:hover {
  background: rgba(129, 140, 248, 0.12);
  color: var(--accent-light);
}

.dropdown-item-informe:hover svg {
  opacity: 1;
}
