:root {
  --sp-primary: #0d9488;
  --sp-primary-dark: #0f766e;
  --sp-accent: #2563eb;
  --sp-accent-dark: #1d4ed8;
  --sp-bg: #f4f7f8;
  --sp-ink: #1e293b;
  --sp-radius: 1rem;
}

* {
  font-family: 'Inter', system-ui, sans-serif;
}

h1, h2, h3, h4, h5, h6, .navbar-brand {
  font-family: 'Poppins', 'Inter', sans-serif;
}

body {
  background-color: var(--sp-bg);
  color: var(--sp-ink);
}

.text-sp-primary { color: var(--sp-primary) !important; }
.text-sp-accent { color: #7dd3fc !important; }

/* ===== Navbar ===== */
.sp-navbar {
  background: linear-gradient(90deg, var(--sp-primary-dark), var(--sp-primary));
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.sp-navbar .nav-link {
  font-weight: 500;
  color: rgba(255,255,255,.85);
  transition: color .15s ease;
}
.sp-navbar .nav-link:hover,
.sp-navbar .nav-link.active {
  color: #fff;
}

.btn-sp-primary {
  background-color: var(--sp-primary);
  border-color: var(--sp-primary);
  color: #fff;
}
.btn-sp-primary:hover, .btn-sp-primary:focus {
  background-color: var(--sp-primary-dark);
  border-color: var(--sp-primary-dark);
  color: #fff;
}

.btn-sp-accent {
  background-color: var(--sp-accent);
  border-color: var(--sp-accent);
  color: #fff;
}
.btn-sp-accent:hover, .btn-sp-accent:focus {
  background-color: var(--sp-accent-dark);
  border-color: var(--sp-accent-dark);
  color: #fff;
}

/* ===== Hero ===== */
.sp-hero {
  position: relative;
  min-height: 62vh;
  background: url('https://images.unsplash.com/photo-1576091160399-112ba8d25d1d?auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
}
.sp-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(15,118,110,.92) 0%, rgba(13,148,136,.75) 45%, rgba(15,23,42,.55) 100%);
}
.sp-badge-soft {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  font-weight: 500;
  padding: .5rem .9rem;
  border-radius: 50rem;
  backdrop-filter: blur(4px);
}

/* ===== Cards ===== */
.sp-card {
  border: none;
  border-radius: var(--sp-radius);
  box-shadow: 0 4px 20px rgba(15, 23, 42, .06);
  transition: box-shadow .2s ease, transform .2s ease;
}
.sp-card:hover {
  box-shadow: 0 8px 28px rgba(15, 23, 42, .1);
}

.sp-stat-card {
  border: none;
  border-radius: var(--sp-radius);
  padding: 1.5rem;
  color: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
  position: relative;
  overflow: hidden;
}
.sp-stat-card .stat-icon {
  font-size: 2.1rem;
  opacity: .85;
}
.sp-stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
}
.sp-stat-card .stat-label {
  font-size: .85rem;
  opacity: .9;
  font-weight: 500;
}
.sp-stat-1 { background: linear-gradient(135deg, #0d9488, #0f766e); }
.sp-stat-2 { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.sp-stat-3 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.sp-stat-4 { background: linear-gradient(135deg, #16a34a, #15803d); }
.sp-stat-5 { background: linear-gradient(135deg, #e11d48, #be123c); }

/* ===== Tables ===== */
.sp-table thead th {
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .04em;
  color: #64748b;
  border-bottom: 2px solid #eef2f4;
  font-weight: 700;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.sp-table td {
  padding-top: .85rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.sp-table tbody tr:hover {
  background-color: #f8fafc;
}

/* ===== Badges de estado ===== */
.badge-estado {
  font-weight: 600;
  padding: .45em .8em;
  border-radius: 50rem;
  font-size: .75rem;
}
.badge-Pendiente { background: #fef3c7; color: #92400e; }
.badge-Confirmada { background: #dbeafe; color: #1e40af; }
.badge-Cancelada { background: #fee2e2; color: #991b1b; }
.badge-Atendida { background: #dcfce7; color: #166534; }

/* ===== Especialidades ===== */
.sp-especialidad-card {
  border: none;
  border-radius: var(--sp-radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(15, 23, 42, .06);
  height: 100%;
}
.sp-especialidad-header {
  padding: 1.5rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: .9rem;
}
.sp-especialidad-header i { font-size: 1.8rem; }
.sp-esp-1 { background: linear-gradient(135deg, #0d9488, #0f766e); }
.sp-esp-2 { background: linear-gradient(135deg, #f472b6, #db2777); }
.sp-esp-3 { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.sp-esp-4 { background: linear-gradient(135deg, #f59e0b, #b45309); }

.medico-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem 0;
}
.medico-item img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--sp-primary);
}

/* ===== Modal ===== */
.sp-modal {
  border: none;
  border-radius: var(--sp-radius);
}

/* ===== Footer ===== */
.sp-footer {
  background: #0f172a;
}

/* ===== Utility ===== */
.avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--sp-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .8rem;
  flex-shrink: 0;
}

.sp-section {
  animation: fadeIn .35s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-label { font-size: .9rem; }

/* ===== Acceso staff / sesión admin ===== */
#btnAccesoStaff, #btnCerrarSesion {
  border-color: rgba(255,255,255,.5);
}
#btnAccesoStaff:hover, #btnCerrarSesion:hover {
  background-color: rgba(255,255,255,.15);
  color: #fff;
}

/* ===== Botón flotante de WhatsApp ===== */
.whatsapp-float {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  background-color: #25d366;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.28);
  z-index: 1070;
  transition: transform .18s ease, box-shadow .18s ease;
}
.whatsapp-float:hover {
  color: #fff;
  transform: scale(1.08);
  box-shadow: 0 8px 22px rgba(0,0,0,.35);
}
@media (max-width: 576px) {
  .whatsapp-float {
    right: 16px;
    bottom: 16px;
    width: 52px;
    height: 52px;
    font-size: 1.7rem;
  }
}
