/* ============================================
   MULTISYSTEMS - Admin Panel Styles
   ============================================ */

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --secondary: #06b6d4;
  --accent: #f59e0b;
  --dark: #0f172a;
  --sidebar-bg: #0f172a;
  --main-bg: #1e293b;
  --card-bg: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: rgba(255,255,255,0.08);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --radius: 12px;
  --input-bg: rgba(255,255,255,0.05);
  --input-color: #fff;
  --topbar-bg: #1e293b;
  --table-header-bg: rgba(255,255,255,0.05);
  --table-row-hover: rgba(255,255,255,0.03);
  --modal-bg: #1e293b;
  --panel-bg: #1e293b;
  --badge-text: #fff;
}

/* ===== TEMA CLARO ===== */
body.tema-claro {
  --sidebar-bg: #1e1b4b;
  --main-bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: rgba(0,0,0,0.1);
  --input-bg: #f8fafc;
  --input-color: #1e293b;
  --topbar-bg: #ffffff;
  --table-header-bg: #f8fafc;
  --table-row-hover: #f1f5f9;
  --modal-bg: #ffffff;
  --panel-bg: #ffffff;
  --badge-text: #fff;
  background: #f1f5f9;
  color: #1e293b;
}

body.tema-claro .admin-main  { background: #f1f5f9; }
body.tema-claro .admin-content { background: #f1f5f9; }

body.tema-claro .admin-topbar {
  background: var(--topbar-bg);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
body.tema-claro .admin-topbar h1  { color: #1e293b; }
body.tema-claro .admin-topbar span { color: #64748b; }

body.tema-claro .panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
body.tema-claro .panel h2 {
  color: #1e293b;
  border-bottom-color: var(--border);
}

body.tema-claro .stat-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
body.tema-claro .stat-card .stat-value { color: #1e293b; }
body.tema-claro .stat-card .stat-label { color: #64748b; }
body.tema-claro .stat-icon { color: var(--text-muted); }

body.tema-claro .table th {
  background: var(--table-header-bg);
  color: var(--text-muted);
}
body.tema-claro .table td {
  border-color: var(--border);
  color: var(--text);
}
body.tema-claro .table small { color: #94a3b8; }
body.tema-claro .table tbody tr:hover { background: var(--table-row-hover); }
body.tema-claro .row-warning { background: rgba(245,158,11,0.08) !important; }
body.tema-claro .row-danger  { background: rgba(239,68,68,0.08)  !important; }

body.tema-claro .modal {
  background: var(--modal-bg);
  border-color: var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
body.tema-claro .modal-header {
  border-bottom-color: var(--border);
  color: #1e293b;
}
body.tema-claro .modal-close {
  background: rgba(0,0,0,0.08);
  color: #1e293b;
}
body.tema-claro .modal-body { color: #1e293b; }

body.tema-claro .form-group label { color: #475569; }
body.tema-claro .form-group input,
body.tema-claro .form-group select,
body.tema-claro .form-group textarea {
  background: var(--input-bg);
  border-color: rgba(0,0,0,0.12);
  color: var(--input-color);
}
body.tema-claro .form-group input:focus,
body.tema-claro .form-group select:focus,
body.tema-claro .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

body.tema-claro .filtros-bar .filtro-btn {
  background: #fff;
  border-color: rgba(0,0,0,0.12);
  color: #64748b;
}
body.tema-claro .filtros-bar .filtro-btn:hover,
body.tema-claro .filtros-bar .filtro-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

body.tema-claro .btn-logout {
  background: rgba(239,68,68,0.1);
  color: #dc2626;
}
body.tema-claro .btn-logout:hover { background: rgba(239,68,68,0.2); }

/* Botón de tema */
.btn-tema {
  width: 100%;
  padding: 0.7rem 1rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-tema:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

body.tema-claro .btn-tema {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.1);
  color: #94a3b8;
}

body.tema-claro .btn-tema:hover {
  background: rgba(0,0,0,0.1);
  color: #1e293b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: #0f172a;
  color: var(--text);
}

/* ===== LOGIN PAGE ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at center, #1e293b 0%, #0f172a 100%);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
}

.login-card {
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.login-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-login {
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all 0.3s;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79,70,229,0.4);
}

/* ===== ADMIN LAYOUT ===== */
.admin-body {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-track { background: transparent; }
.admin-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
}
.admin-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.18);
}

.sidebar-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 2.5rem;
}

.sidebar-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 0.3rem;
}

.sidebar-header p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sidebar-nav a {
  padding: 0.8rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 500;
  font-size: 0.95rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(79,70,229,0.2);
  color: #fff;
}

.admin-main {
  flex: 1;
  margin-left: 260px;
  padding: 0;
}

.admin-topbar {
  background: #1e293b;
  border-bottom: 1px solid var(--border);
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-topbar h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-logout {
  padding: 0.5rem 1.2rem;
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.3s;
}

.btn-logout:hover {
  background: rgba(239,68,68,0.4);
}

.admin-content {
  padding: 2rem;
}

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.stat-card.warning { border-left: 3px solid var(--warning); }
.stat-card.success { border-left: 3px solid var(--success); }

.stat-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 2rem; font-weight: 800; }
.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.3rem; }

/* ===== PANELS & TABLES ===== */
.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.panel h2 {
  font-size: 1.2rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  padding: 0.8rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.table tr:hover { background: rgba(255,255,255,0.02); }

.row-warning { background: rgba(245,158,11,0.08) !important; }
.row-danger { background: rgba(239,68,68,0.08) !important; }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-success { background: rgba(16,185,129,0.2); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.2); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.2); color: var(--warning); }
.badge-info { background: rgba(6,182,212,0.2); color: var(--info); }

/* ===== BUTTONS ===== */
.btn-primary {
  padding: 0.7rem 1.5rem;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.4rem 0.7rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-edit { background: rgba(79,70,229,0.3); color: #fff; }
.btn-edit:hover { background: rgba(79,70,229,0.6); }
.btn-danger { background: rgba(239,68,68,0.3); color: #fff; }
.btn-danger:hover { background: rgba(239,68,68,0.6); }
.btn-success { background: rgba(16,185,129,0.3); color: #fff; }
.btn-success:hover { background: rgba(16,185,129,0.6); }
.btn-warning { background: rgba(245,158,11,0.3); color: #fff; }
.btn-warning:hover { background: rgba(245,158,11,0.6); }

/* ===== FILTROS BAR ===== */
.filtros-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filtros-bar .filtro-btn {
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 50px;
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.3s;
}

.filtros-bar .filtro-btn:hover,
.filtros-bar .filtro-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.btn-submit {
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79,70,229,0.4);
}

/* ===== ALERTS ===== */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.alert-error { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.alert-success { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }

/* ===== MODAL (reutiliza estilos landing) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal {
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-body {
  padding: 1.5rem;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 4000;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: slideIn 0.4s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
  .admin-sidebar {
    width: 100%;
    position: relative;
    height: auto;
  }
  .admin-main {
    margin-left: 0;
  }
  .admin-body {
    flex-direction: column;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}