/* ── Admin layout base ────────────────────────────────────── */
body.admin-layout {
  margin: 0;
  background: #f1f5f9;
  font-family: 'Poppins', sans-serif;
}

/* Sidebar */
#admin-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 240px;
  height: 100vh;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform .25s ease;
}

#admin-sidebar.collapsed {
  transform: translateX(-240px);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid #1e293b;
  color: #f1f5f9;
  font-weight: 700;
  font-size: 1rem;
}

.sidebar-brand .sidebar-logo {
  height: 32px;
  filter: brightness(0) invert(1);
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: .5rem 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .75rem 1.25rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: .875rem;
  transition: background .15s, color .15s;
}

.sidebar-nav li a:hover,
.sidebar-nav li.active a {
  background: #1e293b;
  color: #f8fafc;
}

.sidebar-nav li.active a {
  color: #60a5fa;
}

.sidebar-nav li a i {
  width: 18px;
  text-align: center;
}

.sidebar-nav li.sidebar-section-label {
  padding: 1.25rem 1.25rem .25rem;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #475569;
  cursor: default;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #94a3b8;
  font-size: .8rem;
  overflow: hidden;
  text-decoration: none;
  transition: color .15s;
}
.sidebar-user:hover, .sidebar-user.active { color: #f8fafc; }

.sidebar-user span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  color: #64748b;
  font-size: 1.1rem;
  transition: color .15s;
}
.sidebar-logout:hover { color: #ef4444; }

/* Toggle button (mobile) */
#sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 300;
  background: #0f172a;
  border: none;
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
}

/* Main content */
#admin-content {
  min-height: 100vh;
}

#admin-content.with-sidebar {
  margin-left: 240px;
}

/* Admin topbar */
#admin-topbar {
  height: 56px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  #admin-sidebar {
    transform: translateX(-240px);
  }
  #admin-sidebar.open {
    transform: translateX(0);
  }
  #admin-content.with-sidebar {
    margin-left: 0;
  }
  #sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ── Common admin UI ──────────────────────────────────────── */
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem .75rem;
  flex-wrap: wrap;
  gap: .75rem;
}

.admin-page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.admin-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  margin: 0 1.5rem 1.5rem;
  overflow: visible;
}

.admin-card-body { padding: 1.25rem; }

/* Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.admin-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .04em;
  padding: .75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.admin-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f8fafc; }
.admin-table a { color: #3b82f6; text-decoration: none; }
.admin-table a:hover { text-decoration: underline; }

/* Status badges */
.badge-estatus {
  display: inline-block;
  padding: .2em .65em;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: #e2e8f0;
  color: #475569;
}
.badge-estatus.Operado,
.est-paciente-operado              { background: #dcfce7; color: #16a34a; }
.badge-estatus.Activo,
.est-valoraciones-clinicas,
.est-asesoria-medica               { background: #dbeafe; color: #1d4ed8; }
.badge-estatus.Contacto,
.est-acudio-a-su-primera-cita,
.est-contacto                      { background: #fef9c3; color: #a16207; }
.badge-estatus.Cancelado,
.est-no-candidato,
.est-no-acudio                     { background: #fee2e2; color: #dc2626; }
.badge-estatus.Prospecto,
.est-programacion-quirurgica       { background: #ede9fe; color: #7c3aed; }
.est-en-espera,
.est-cita-programada               { background: #fff7ed; color: #c2410c; }
.est-informacion,
.est-fallido                       { background: #f1f5f9; color: #64748b; }

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  font-size: .85rem;
  color: #64748b;
  flex-wrap: wrap;
  gap: .5rem;
}
.admin-pagination .pages { display: flex; gap: .25rem; }
.admin-pagination .pages button {
  width: 32px; height: 32px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8rem;
  color: #475569;
  transition: background .15s;
}
.admin-pagination .pages button.active,
.admin-pagination .pages button:hover {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

/* Search / filter bar */
.admin-filters {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
}
.admin-filters input,
.admin-filters select {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: .45rem .85rem;
  font-size: .875rem;
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  transition: border-color .15s;
}
.admin-filters input:focus,
.admin-filters select:focus { border-color: #3b82f6; background: #fff; }
.admin-filters input { flex: 1; min-width: 180px; }

/* Modal improvements for admin */
body.admin-layout .modal-content {
  border-radius: 12px;
  border: none;
}
body.admin-layout .modal-header {
  background: #0f172a;
  color: #f1f5f9;
  border-radius: 12px 12px 0 0;
}
body.admin-layout .modal-header .btn-close {
  filter: invert(1);
}

/* Loading overlay */
.admin-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: #94a3b8;
  font-size: .875rem;
  gap: .5rem;
}
