/**
 * ====================================================================
 * Admin Dashboard Stylesheet - PQRS Clinical Management
 * ====================================================================
 */

:root {
  --admin-navy: #002b54;
  --admin-sidebar: #0f172a;
  --admin-primary: #0077c8;
  --admin-cyan: #00a3e0;
  --admin-bg: #f1f5f9;
  --admin-card: #ffffff;
  --admin-text: #1e293b;
  --admin-muted: #64748b;
  --admin-border: #e2e8f0;
}

body.admin-body {
  background-color: var(--admin-bg);
  color: var(--admin-text);
  font-family: 'Outfit', 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: var(--admin-sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform 0.3s ease;
}

.admin-sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-sidebar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0077c8, #00a3e0);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.admin-sidebar-logo svg {
  width: 22px;
  height: 22px;
}

.admin-sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.admin-sidebar-title span {
  font-size: 0.75rem;
  color: var(--admin-cyan);
  font-weight: 500;
  display: block;
}

.admin-nav {
  padding: 20px 12px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.2s;
}

.admin-nav-item:hover, .admin-nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.admin-nav-item.active {
  background: var(--admin-primary);
  color: #ffffff;
}

.admin-nav-item svg {
  width: 20px;
  height: 20px;
}

.admin-sidebar-footer {
  padding: 18px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-user-info {
  display: flex;
  flex-direction: column;
}

.admin-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.admin-user-role {
  font-size: 0.72rem;
  color: #94a3b8;
}

.btn-logout {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
}

/* Main Content Area */
.admin-main {
  margin-left: 260px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.admin-page-title h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--admin-navy);
}

.admin-page-title p {
  font-size: 0.82rem;
  color: var(--admin-muted);
}

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

.admin-content {
  padding: 32px;
  flex-grow: 1;
}

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

.kpi-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--admin-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s;
}

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

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon svg {
  width: 24px;
  height: 24px;
}

.kpi-icon.total { background: #e0f2fe; color: #0284c7; }
.kpi-icon.radicados { background: #e0e7ff; color: #4338ca; }
.kpi-icon.gestion { background: #fef3c7; color: #d97706; }
.kpi-icon.resueltos { background: #dcfce7; color: #16a34a; }
.kpi-icon.cerrados { background: #f1f5f9; color: #475569; }

.kpi-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--admin-navy);
  line-height: 1.1;
}

.kpi-lbl {
  font-size: 0.82rem;
  color: var(--admin-muted);
  font-weight: 600;
}

/* Filter Bar & Table Panel */
.table-panel {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid var(--admin-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.table-toolbar {
  padding: 20px 24px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  min-width: 280px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 38px;
  border-radius: 9999px;
  border: 1.5px solid var(--admin-border);
  font-size: 0.88rem;
  outline: none;
}

.search-box input:focus {
  border-color: var(--admin-primary);
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--admin-muted);
}

.filter-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.select-filter {
  padding: 8px 14px;
  border-radius: 9999px;
  border: 1.5px solid var(--admin-border);
  font-size: 0.85rem;
  color: var(--admin-text);
  background: #fff;
  outline: none;
  font-weight: 500;
}

/* Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.admin-table th {
  background: #f8fafc;
  padding: 14px 20px;
  font-weight: 700;
  color: var(--admin-muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text);
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: #f8fafc;
}

.radicado-tag {
  font-weight: 700;
  color: var(--admin-primary);
  font-family: monospace;
  font-size: 0.95rem;
}

.btn-table-action {
  background: #f1f5f9;
  border: 1px solid var(--admin-border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--admin-navy);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-table-action:hover {
  background: var(--admin-primary);
  color: #fff;
  border-color: var(--admin-primary);
}

/* Admin Detail & Resolution Drawer/Modal */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.admin-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.admin-modal-window {
  background: #ffffff;
  border-radius: 20px;
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.admin-modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 10;
}

.admin-modal-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-block {
  background: #f8fafc;
  border-radius: 12px;
  padding: 18px;
  border: 1px solid var(--admin-border);
}

.detail-block h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--admin-muted);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  font-size: 0.9rem;
}

.resolution-box {
  background: #fff;
  border: 2px solid var(--admin-primary);
  border-radius: 14px;
  padding: 20px;
}

/* Login Page Styles */
.admin-login-body {
  background: radial-gradient(circle at center, #003b71 0%, #001f3f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.admin-login-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.login-brand-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0077c8, #003b71);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.login-brand-icon svg {
  width: 32px;
  height: 32px;
}

.admin-login-card h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--admin-navy);
  margin-bottom: 4px;
}

.admin-login-card p {
  font-size: 0.88rem;
  color: var(--admin-muted);
  margin-bottom: 24px;
}

/* Badges de Roles */
.badge-role {
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-role.superadmin {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #d8b4fe;
}
.badge-role.gestorpqrs {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.badge-role.auditor {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

/* Badges SLA Semáforo Inteligente */
.sla-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.sla-ok {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}
.sla-alerta {
  background: #fef9c3;
  color: #a16207;
  border: 1px solid #fde047;
}
.sla-vencido {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  animation: pulse-red 2s infinite ease-in-out;
}
@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

/* Estado Activo / Inactivo */
.badge-activo {
  background: #dcfce7;
  color: #166534;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-inactivo {
  background: #f1f5f9;
  color: #94a3b8;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Acciones en Tabla de Usuarios */
.btn-action-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-navy);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-action-icon:hover {
  background: var(--admin-primary);
  color: #fff;
  border-color: var(--admin-primary);
}
.btn-action-icon.danger:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

/* Sistema de Notificaciones Toast Profesionales */
.pqrs-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 440px;
  width: calc(100% - 48px);
  pointer-events: none;
}

.pqrs-toast {
  pointer-events: auto;
  background: #ffffff;
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 16px 36px rgba(0, 43, 84, 0.16), 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid var(--admin-border);
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.pqrs-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.pqrs-toast-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pqrs-toast-icon svg {
  width: 20px;
  height: 20px;
}

.pqrs-toast.success .pqrs-toast-icon {
  background: #dcfce7;
  color: #15803d;
}
.pqrs-toast.success {
  border-left: 5px solid #16a34a;
}
.pqrs-toast.success .pqrs-toast-progress {
  background: #16a34a;
}

.pqrs-toast.error .pqrs-toast-icon {
  background: #fee2e2;
  color: #dc2626;
}
.pqrs-toast.error {
  border-left: 5px solid #dc2626;
}
.pqrs-toast.error .pqrs-toast-progress {
  background: #dc2626;
}

.pqrs-toast.info .pqrs-toast-icon {
  background: #e0f2fe;
  color: #0284c7;
}
.pqrs-toast.info {
  border-left: 5px solid #0077c8;
}
.pqrs-toast.info .pqrs-toast-progress {
  background: #0077c8;
}

.pqrs-toast-content {
  flex: 1;
}

.pqrs-toast-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--admin-navy);
  margin-bottom: 3px;
}

.pqrs-toast-message {
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.45;
}

.pqrs-toast-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  font-size: 1.2rem;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pqrs-toast-close:hover {
  color: #0f172a;
}

.pqrs-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  transform-origin: left;
  animation: toast-timer 4.5s linear forwards;
}

@keyframes toast-timer {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}


