/* Tomar Clase - UI & Mobile Refined Styles */
:root {
  --bg: #090d16;
  --panel: #111827;
  --panel-card: #1f2937;
  --muted: #9ca3af;
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.25);
  --green: #10b981;
  --red: #ef4444;
  --sidebar-w: 220px;
  --header-h: 64px;
  --border-color: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: var(--bg);
  color: #f3f4f6;
  -webkit-font-smoothing: antialiased;
}

/* Contenedor Principal */
.main-content {
  margin-top: var(--header-h);
  margin-left: var(--sidebar-w);
  padding: 24px;
  min-height: calc(100vh - var(--header-h) - 60px);
  transition: all 0.3s ease;
}

.top-header h1 {
  font-size: 1.8rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.top-header h1 i { color: var(--gold); }
.top-header p { color: var(--muted); margin-top: 4px; font-size: 0.95rem; }

/* Banner Premium */
.premium-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.1));
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 12px 18px;
  color: #fef3c7;
  font-weight: 600;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.1);
}

/* Barra de Búsqueda */
.search-filter-bar {
  margin: 20px 0;
}
.search-input-wrapper {
  position: relative;
  max-width: 450px;
}
.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}
.search-input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--panel);
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border 0.2s;
}
.search-input-wrapper input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

/* Secciones */
.section-title {
  font-size: 1.25rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Grilla de Profesores */
.teachers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

.teacher-card {
  background: var(--panel);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.teacher-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.4);
  border-color: rgba(245, 158, 11, 0.4);
}

.teacher-img-wrap {
  width: 100%;
  height: 170px;
  position: relative;
  overflow: hidden;
}
.teacher-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.teacher-badge-price {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  border: 1px solid var(--border-color);
}

.teacher-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.teacher-card-body h3 {
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 4px;
}
.teacher-subject-tag {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.teacher-info-line {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 4px;
}
.teacher-modality-list,
.teacher-modalities {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0;
}
.teacher-modalities:empty { display: none; }
.teacher-modality-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid rgba(245, 158, 11, .26);
  border-radius: 999px;
  background: rgba(245, 158, 11, .09);
  color: #f5cf77;
  font-size: .76rem;
  font-weight: 650;
  line-height: 1.2;
}
.teacher-modality-chip i { color: var(--gold); }
.teacher-rating-text {
  color: #fbbf24;
  font-size: 0.85rem;
  margin-top: 4px;
  font-weight: 600;
}

.teacher-card-actions {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  gap: 8px;
}

/* Botones */
.btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.btn.primary { background: var(--gold); color: #000; }
.btn.primary:hover { background: #d97706; }
.btn.secondary { background: rgba(255,255,255,0.08); color: #fff; }
.btn.secondary:hover { background: rgba(255,255,255,0.15); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border-color); }
.btn.ghost:hover { color: #fff; border-color: rgba(255,255,255,0.3); }
.btn-lg { width: 100%; padding: 14px; font-size: 1rem; border-radius: 12px; }
.small-btn { padding: 6px 10px; font-size: 0.8rem; }

/* POPUP MODAL (Mobile First) */
.popup {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.popup.hidden { display: none; }

.popup-content {
  width: 100%;
  max-width: 1100px;
  max-height: 92vh;
  background: var(--panel);
  border-radius: 24px;
  border: 1px solid var(--border-color);
  padding: 24px;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px rgba(0,0,0,0.6);
}

.popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
}

.popup-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 28px;
}

/* Sidebar del Popup */
.popup-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.prof-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}
.prof-photo {
  width: 110px;
  height: 110px;
  border-radius: 20px;
  object-fit: cover;
  border: 2px solid var(--gold);
}
.prof-info-header h2 { font-size: 1.3rem; color: #fff; }
.bio-snippet { font-size: 0.85rem; color: var(--muted); margin-top: 6px; line-height: 1.4; }

.teacher-card-meta {
  background: var(--panel-card);
  padding: 16px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.price-row { display: flex; justify-content: space-between; font-weight: 600; font-size: 0.95rem; }
.price-row strong { color: var(--gold); }
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; background: rgba(245,158,11,0.15); color: var(--gold); font-weight: 600; font-size: 0.8rem; }
.selected-slots { color: #38bdf8; font-size: 0.85rem; margin-top: 4px; }

/* Contenido Principal del Formulario */
.popup-main { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 0.9rem; font-weight: 600; color: #e5e7eb; display: flex; align-items: center; gap: 8px; }
.field-label i { color: var(--gold); }

/* Select Personalizado */
.select-wrapper { position: relative; width: 100%; }
.select-wrapper select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--panel-card);
  color: #fff;
  font-size: 0.95rem;
  appearance: none;
  outline: none;
  cursor: pointer;
}
.select-wrapper select:focus { border-color: var(--gold); }
.select-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* Selector de Días Móvil (Chips) */
.day-chips-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.day-chips-bar::-webkit-scrollbar { display: none; }

.day-chip {
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--panel-card);
  border: 1px solid var(--border-color);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.day-chip.active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}

/* Grilla de Horarios de la Pestaña Activa */
.hours-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 8px;
}

.timezone-info {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.slot-btn {
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}
.slot-btn:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.25);
  transform: scale(1.02);
}
.slot-btn.active {
  background: var(--gold) !important;
  color: #000 !important;
  border-color: var(--gold) !important;
  font-weight: 700;
  box-shadow: 0 0 12px var(--gold-glow);
}
.slot-btn.ocupado {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
  cursor: not-allowed;
  opacity: 0.6;
}

textarea {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--panel-card);
  color: #fff;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
textarea:focus { border-color: var(--gold); }

/* Footer de Checkout */
.checkout-footer {
  background: var(--panel-card);
  padding: 16px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border-color);
}
.total-line {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  color: #fff;
}
.total-line strong { color: var(--gold); font-size: 1.3rem; }

.popup-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.popup-actions .btn { flex: 1 1 140px; }

/* Perfil Oculto & Reseñas */
.profile-panel, .reviews-section {
  background: var(--panel-card);
  border-radius: 16px;
  padding: 16px;
  margin-top: 10px;
}
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* REGLAS RESPONSIVAS Y MÓVILES */
@media (max-width: 850px) {
  .popup-grid { grid-template-columns: 1fr; gap: 18px; }
  .popup-sidebar { order: 1; }
  .prof-details { flex-direction: row; text-align: left; }
  .prof-photo { width: 80px; height: 80px; border-radius: 14px; }
}

@media (max-width: 768px) {
  .hamburger { display: block; }
  .main-content { margin-left: 0; padding: 16px; }
  .teachers-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .popup-content { padding: 18px; max-height: 95vh; }
  .checkout-footer { position: sticky; bottom: 0; z-index: 5; background: #1f2937; }
}

@media (max-width: 480px) {
  .teachers-grid { grid-template-columns: 1fr; }
  .hours-grid { grid-template-columns: repeat(3, 1fr); }
  .prof-details { flex-direction: column; text-align: center; }
  .profile-grid { grid-template-columns: 1fr; }
}
/* --- SECCIÓN DE RESEÑAS ESTILO INDRIVER / MODERNO --- */
.reviews-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px;
  margin-top: 20px;
}

.reviews-section h4 {
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.reviews-section h4 i { color: var(--gold); }

.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* Tarjeta de Reseña tipo InDriver (Compacta y Elegante) */
.review-item {
  background: var(--panel-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--gold);
  padding: 12px 14px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease;
}
.review-item:hover {
  transform: translateX(2px);
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.review-rating-stars {
  color: #fbbf24;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.review-date {
  color: var(--muted);
  font-size: 0.75rem;
}

.review-text {
  color: #e5e7eb;
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
}

.review-author {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Caja para Agregar Reseña */
.add-review {
  margin-top: 16px;
  background: rgba(0, 0, 0, 0.2);
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed var(--border-color);
}
.add-review h5 {
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 8px;
}
.rating-input {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.star {
  cursor: pointer;
  font-size: 22px;
  color: #4b5563;
  transition: color 0.15s ease, transform 0.15s ease;
}
.star:hover, .star.active {
  color: var(--gold);
  transform: scale(1.1);
}
.add-review textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--panel);
  color: #fff;
  font-size: 0.88rem;
  resize: vertical;
  outline: none;
  margin-bottom: 10px;
}
.add-review textarea:focus {
  border-color: var(--gold);
}
/* --- CORRECCIONES Y CONTRASTE PARA MODO CLARO (`body.light`) --- */
body.light {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-card: #f1f5f9;
  --muted: #4b5563;
  --border-color: #cbd5e1;
  background: var(--bg);
  color: #0f172a;
}

body.light .top-header h1,
body.light .top-header p,
body.light .section-title,
body.light .popup-content h2,
body.light .popup-content h3,
body.light .popup-content h4,
body.light .popup-content h5,
body.light .prof-info-header h2,
body.light .teacher-card-body h3,
body.light .field-label,
body.light .total-line,
body.light .profile-panel h3,
body.light .profile-panel h4 {
  color: #0f172a !important;
}

body.light .search-input-wrapper input,
body.light .select-wrapper select,
body.light textarea,
body.light .add-review textarea {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

body.light .search-input-wrapper input::placeholder,
body.light textarea::placeholder {
  color: #94a3b8 !important;
}

body.light .teacher-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.light .teacher-card-body p,
body.light .teacher-info-line,
body.light .bio-snippet,
body.light .profile-card p,
body.light .profile-card strong,
body.light .profile-description p,
body.light .review-text,
body.light .review-date {
  color: #334155 !important;
}

body.light .teacher-card-meta,
body.light .checkout-footer,
body.light .profile-panel,
body.light .reviews-section,
body.light .add-review,
body.light .profile-card,
body.light .day-chip {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

body.light .day-chip.active {
  background: var(--gold) !important;
  color: #000 !important;
  border-color: var(--gold) !important;
}
/* --- CORRECCIONES FINALES MODO CLARO Y BOTÓN DE CIERRE --- */

/* 1. Botón de WhatsApp y elementos secundarios en modo claro */
body.light .teacher-card .btn.secondary,
body.light .popup-actions .btn.ghost {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
body.light .teacher-card .btn.secondary:hover,
body.light .popup-actions .btn.ghost:hover {
  background: #e2e8f0 !important;
  color: #000 !important;
}

/* 2. Banner de Cuenta Premium en modo claro */
body.light #premiumStatusBanner {
  background: #fef9c3 !important;
  border-color: #f59e0b !important;
  color: #78350f !important;
}
body.light #premiumStatusBanner strong {
  color: #b45309 !important;
}

/* 3. Botón de cierre adicional en la parte inferior del Popup de horarios */
.popup-footer-close {
  display: none;
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.popup-footer-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

body.light .popup-footer-close {
  background: #e2e8f0 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

/* Mostrar botón de cierre inferior en pantallas móviles o cuando sea necesario */
@media (max-width: 760px) {
  .popup-footer-close {
    display: block;
  }
}

/* --- CORRECCIONES DEFINITIVAS DE RESPONSIVIDAD Y BOTONES DE CIERRE --- */

.popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 10px;
}

.popup-content {
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  padding: 24px 20px 20px 20px;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px rgba(0,0,0,0.7);
}

/* 🔴 Botón de Cierre Superior Fijo en la esquina derecha */
.popup-close {
  position: sticky;
  float: right;
  top: 0;
  right: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #dc2626 !important; /* Rojo intenso */
  color: #fff !important;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
  transition: transform 0.2s ease, background 0.2s ease;
}
.popup-close:hover {
  background: #b91c1c !important;
  transform: scale(1.08);
}

/* 🔴 Botón de Cierre Inferior Rojo */
.popup-footer-close {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 24px;
  background: #dc2626 !important;
  border: none;
  color: #fff !important;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  transition: background 0.2s ease;
}
.popup-footer-close:hover {
  background: #b91c1c !important;
}

/* Ajustes de visibilidad y contraste para MÓVILES */
@media (max-width: 768px) {
  .popup {
    padding: 6px;
  }
  .popup-content {
    max-height: 96vh;
    padding: 16px 12px;
    border-radius: 16px;
  }
  .popup-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  /* Asegurar que las horas y textos se adapten en celular */
  .hours-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px;
  }
  .slot-btn {
    padding: 10px 4px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .hours-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
/* --- CORRECCIONES MÓVILES Y BOTONES DE CIERRE ROJOS --- */

.popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 8px;
}

.popup-content {
  width: 100%;
  max-width: 1100px;
  max-height: 94vh;
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  padding: 20px;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px rgba(0,0,0,0.8);
}

/* 🔴 Barra superior fija para el botón de cierre en móviles */
.popup-header-bar {
  display: flex;
  justify-content: flex-end;
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 100;
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.popup-close {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #dc2626 !important; /* Rojo vivo */
  color: #fff !important;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
  transition: transform 0.2s ease, background 0.2s ease;
}
.popup-close:hover {
  background: #b91c1c !important;
  transform: scale(1.08);
}

/* 🔴 Botón de Cierre Inferior Rojo */
.popup-footer-close {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 24px;
  background: #dc2626 !important;
  border: none;
  color: #fff !important;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  transition: background 0.2s ease;
}
.popup-footer-close:hover {
  background: #b91c1c !important;
}

/* Estilos de Horarios y Disponibilidad (Contraste Asegurado) */
.availability-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.day-section {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.day-header {
  margin: 0 0 10px 0;
  color: var(--gold);
  font-size: 15px;
  font-weight: 700;
}

.hours-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 8px;
}

.slot-btn {
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}
.slot-btn.active {
  background: var(--gold) !important;
  color: #000 !important;
  border-color: var(--gold) !important;
}
.slot-btn.ocupado {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Modo Claro General para Contraste de Textos y Horas */
body.light .popup-content {
  background: #ffffff !important;
  color: #0f172a !important;
}
body.light .day-section {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}
body.light .slot-btn {
  background: #e6f4ea !important;
  color: #137333 !important;
  border-color: #ceead6 !important;
}
body.light .slot-btn.active {
  background: var(--gold) !important;
  color: #000 !important;
}
body.light .slot-btn.ocupado {
  background: #fce8e6 !important;
  color: #c5221f !important;
}

/* Responsividad Móvil Estricta */
@media (max-width: 768px) {
  .popup-content {
    padding: 14px 10px;
    max-height: 98vh;
  }
  .popup-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .hours-grid, .hours-list {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 480px) {
  .hours-grid, .hours-list {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* --- CORRECCIÓN DEFINITIVA: MODAL DESDE EL HEADER Y X FLOTANTE --- */

.popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 12px;
  /* Hace que el modal empiece limpio justo debajo del encabezado fijo de la academia */
  padding-top: calc(var(--header-h) + 12px) !important;
}

.popup-content {
  width: 100%;
  max-width: 1250px;
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto;
  background: linear-gradient(180deg, #0f0f0f, #0a0a0a);
  padding: 32px 24px 24px 24px !important; /* Espacio superior para la X flotante */
  border-radius: 20px;
  color: #fff;
  position: relative !important; /* Vital para anclar la X flotante */
  box-shadow: 0 25px 50px rgba(0,0,0,0.8);
  border: 1px solid rgba(255,255,255,0.08);
}

/* 🔴 Botón "X" Rojo Flotante y Siempre Visible */
.popup-close {
  position: absolute !important;
  top: 14px !important;
  right: 14px !important;
  width: 42px !important;
  height: 42px !important;
  border-radius: 50% !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
  background: #dc2626 !important; /* Rojo vivo */
  color: #fff !important;
  font-size: 20px !important;
  font-weight: bold !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 9999 !important; /* Por encima de todo */
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.6) !important;
  transition: transform 0.2s ease, background 0.2s ease !important;
}

.popup-close:hover {
  background: #b91c1c !important;
  transform: scale(1.1) !important;
}

/* Adaptación para Modo Claro de la X flotante */
body.light .popup-content {
  background: #ffffff !important;
  color: #000000 !important;
  border: 1px solid #cbd5e1 !important;
}

body.light .popup-close {
  background: #dc2626 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}