/* ============================================================
   JR FITNESS - Sistema de Diseño Principal
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ────────────────────────────────────────────── */
:root {
  /* Colores marca JR Fitness */
  --primary:        #5cb870;
  --primary-dark:   #4a9d5c;
  --primary-light:  #7ed491;
  --primary-bg:     #f0faf2;
  --primary-10:     rgba(92, 184, 112, .10);
  --primary-20:     rgba(92, 184, 112, .20);

  /* Neutros */
  --dark:           #111827;
  --dark-2:         #1f2937;
  --gray-700:       #374151;
  --gray-600:       #4b5563;
  --gray-500:       #6b7280;
  --gray-400:       #9ca3af;
  --gray-300:       #d1d5db;
  --gray-200:       #e5e7eb;
  --gray-100:       #f3f4f6;
  --gray-50:        #f9fafb;
  --white:          #ffffff;

  /* Semánticos */
  --danger:         #ef4444;
  --danger-bg:      #fef2f2;
  --warning:        #f59e0b;
  --warning-bg:     #fff7ed;
  --info:           #3b82f6;
  --info-bg:        #eff6ff;
  --success:        #10b981;
  --success-bg:     #ecfdf5;

  /* Layout */
  --sidebar-w:      260px;
  --topbar-h:       64px;
  --bottom-nav-h:   64px;

  /* Radios */
  --r-sm:  6px;
  --r:     10px;
  --r-md:  14px;
  --r-lg:  18px;
  --r-xl:  24px;
  --r-full:9999px;

  /* Sombras */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.06);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-md:  0 10px 15px rgba(0,0,0,.10), 0 4px 6px rgba(0,0,0,.05);
  --shadow-lg:  0 20px 25px rgba(0,0,0,.10), 0 10px 10px rgba(0,0,0,.04);

  /* Transición */
  --ease: cubic-bezier(.4,0,.2,1);
  --dur:  180ms;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  /* Prevenir scroll horizontal global */
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Prevenir scroll horizontal global */
  overflow-x: hidden;
  max-width: 100vw;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* ── Scrollbar personalizada ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════ */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0b2915 0%, #154323 50%, #0c2b16 100%);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 600px 400px at 70% 30%, rgba(92,184,112,.2) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 20% 80%, rgba(92,184,112,.12) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  background: rgba(255,255,255,.98);
  backdrop-filter: blur(20px);
  border-radius: var(--r-xl);
  box-shadow: 0 20px 40px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,.2);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* Cabecera clara alineada con los tonos blancos y limpios del resto de la app */
.login-card__header {
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  padding: 2.25rem 2rem 1.75rem;
  text-align: center;
  position: relative;
  border-bottom: 1px solid var(--gray-100);
}

.login-card__header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 60px; height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}

.login-logo {
  height: auto;
  max-height: 200px;
  margin: 0 auto .75rem;
  display: block;
  filter: drop-shadow(0 6px 16px rgba(92,184,112,.28));
  transition: transform var(--dur) var(--ease);
}

.login-logo:hover {
  transform: scale(1.04);
}

.login-title {
  color: var(--dark);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.login-subtitle {
  color: var(--gray-500);
  font-size: .85rem;
  margin-top: .2rem;
  font-weight: 500;
}

.login-card__body {
  padding: 2rem;
}

/* Tabs login/register */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--gray-100);
  border-radius: var(--r);
  padding: 3px;
  margin-bottom: 1.75rem;
}

.auth-tab {
  padding: .6rem 1rem;
  border-radius: var(--r-sm);
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-500);
  transition: all var(--dur) var(--ease);
  text-align: center;
}

.auth-tab.active {
  background: var(--white);
  color: var(--dark);
  box-shadow: var(--shadow-xs);
}

/* Form */
.form-group {
  margin-bottom: 1.1rem;
}

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-input {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r);
  font-size: .95rem;
  color: var(--dark);
  background: var(--white);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  outline: none;
  appearance: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-10);
}

.form-input::placeholder { color: var(--gray-400); }

.form-input-icon {
  position: relative;
}

.form-input-icon .form-input {
  padding-left: 2.75rem;
}

.form-input-icon .icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
  font-size: 1rem;
}

/* Photo upload */
.photo-upload-area {
  border: 2px dashed var(--gray-200);
  border-radius: var(--r-md);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  position: relative;
}

.photo-upload-area:hover { border-color: var(--primary); background: var(--primary-bg); }
.photo-upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-upload-area .upload-icon { font-size: 2rem; margin-bottom: .5rem; }
.photo-upload-area p { font-size: .85rem; color: var(--gray-500); }
.photo-upload-area strong { color: var(--primary); }

.photo-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin: .5rem auto 0;
  display: none;
  border: 3px solid var(--primary);
}

/* Botón primario */
.btn-primary {
  width: 100%;
  padding: .85rem 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--r);
  border: none;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  box-shadow: 0 4px 14px rgba(92,184,112,.4);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--dur) var(--ease);
}

.btn-primary:hover::after { background: rgba(255,255,255,.08); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

/* Alert error login */
.login-error {
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--r);
  padding: .75rem 1rem;
  font-size: .875rem;
  color: #991b1b;
  margin-bottom: 1rem;
  display: none;
}

/* ═══════════════════════════════════════════════════════════
   MAIN APP LAYOUT
   ═══════════════════════════════════════════════════════════ */

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: .75rem;
}

.sidebar-logo img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.sidebar-logo-text {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1;
}

.sidebar-logo-text span { color: var(--primary); }

/* Perfil en sidebar */
.sidebar-profile {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}

.sidebar-profile:hover { background: var(--gray-50); }

.sidebar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name  { font-size: .875rem; font-weight: 600; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: .75rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Navegación */
.sidebar-nav {
  flex: 1;
  padding: .75rem 1rem;
}

.nav-section-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-400);
  padding: .75rem .5rem .4rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .9rem;
  border-radius: var(--r);
  font-size: .9rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  margin-bottom: 2px;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--gray-100);
  color: var(--dark);
}

.nav-item.active {
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-weight: 600;
}

.nav-item .nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: var(--white);
  font-size: .7rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: var(--r-full);
  min-width: 20px;
  text-align: center;
}

/* Botón logout en sidebar */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--gray-100);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .6rem .9rem;
  border-radius: var(--r);
  font-size: .875rem;
  font-weight: 500;
  color: var(--gray-500);
  transition: all var(--dur) var(--ease);
}

.btn-logout:hover { background: var(--danger-bg); color: var(--danger); }

/* Badge de estado suscripción */
.subscription-badge {
  padding: .6rem 1rem;
  margin: .5rem 1rem;
  border-radius: var(--r);
  font-size: .8rem;
  font-weight: 500;
}
.subscription-badge.paid    { background: var(--success-bg); color: #065f46; }
.subscription-badge.unpaid  { background: var(--warning-bg); color: #92400e; }
.subscription-badge.expired { background: var(--danger-bg);  color: #991b1b; }
.subscription-badge.pending { background: var(--info-bg);    color: #1e40af; }

/* ── Topbar mobile ────────────────────────────────────────── */
.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  z-index: 300;
}

.topbar-menu-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--dark);
  flex-shrink: 0;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  flex: 1;
}

.topbar-logo img {
  height: 32px;
  width: auto;
}

/* ── Main content ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Evitar overflow horizontal que cause scroll lateral */
  overflow-x: hidden;
  min-width: 0;
}

.main-inner {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  width: 100%;
  /* Prevenir que contenido interno cause overflow */
  box-sizing: border-box;
  overflow-x: hidden;
  min-width: 0;
}

/* ── Overlay mobile sidebar ───────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 190;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
}
.sidebar-overlay.active {
  pointer-events: auto;
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════
   CALENDARIO / WEEK SELECTOR
   ═══════════════════════════════════════════════════════════ */

.calendar-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.calendar-date-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
}

.week-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--gray-600);
  background: var(--white);
  flex-shrink: 0;
  transition: all var(--dur) var(--ease);
}

.week-nav-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

/* Week strip */
.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .5rem;
  margin-bottom: 1.75rem;
  background: var(--white);
  border-radius: var(--r-md);
  padding: .75rem;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--gray-200);
}

.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .5rem .2rem .4rem;
  border-radius: var(--r);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  position: relative;
  border: 1.5px solid transparent;
  background: var(--white);
  min-height: 64px;
  justify-content: space-between;
}

.week-day:hover {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

/* 1. Día Seleccionado (Primary Green) */
.week-day.selected {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: var(--white) !important;
  box-shadow: 0 4px 12px rgba(92, 184, 112, 0.35);
}

/* 2. Día Actual / Hoy (cuando NO está seleccionado) */
.week-day.today:not(.selected) {
  border-color: var(--primary);
  background: #f0fdf4;
}

/* 3. Día Cerrado (cuando NO está seleccionado) */
.week-day.closed-day:not(.selected) {
  background: #fafafa;
  border-color: var(--gray-100);
}

.week-day-name {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--gray-500);
  letter-spacing: .04em;
}

.week-day.selected .week-day-name { color: rgba(255,255,255,.8); }

.week-day-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
}

.week-day.selected .week-day-num { color: var(--white); }

/* ═══════════════════════════════════════════════════════════
   TARJETAS DE CLASE
   ═══════════════════════════════════════════════════════════ */

.classes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.class-card {
  background: var(--white);
  border-radius: var(--r-md);
  border: 1.5px solid var(--gray-200);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.class-card:hover { box-shadow: var(--shadow); border-color: var(--gray-300); }

.class-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--gray-100);
}

.class-card__title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--dark);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.class-card__meta {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.class-time-badge {
  font-size: .9rem;
  font-weight: 700;
  color: var(--dark-2);
}

.class-instructor {
  font-size: .8rem;
  color: var(--gray-500);
  margin-top: .1rem;
}

.class-card__body {
  padding: .75rem 1.25rem;
}

/* Grid de avatares */
.attendees-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .75rem;
  min-height: 44px;
  align-items: flex-start;
}

.attendee-slot {
  width: 44px;
  flex-shrink: 0;
}

.attendee-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--white);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
  position: relative;
}

.attendee-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attendee-avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--white);
}

.attendee-slot-empty {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gray-100);
  border: 2px dashed var(--gray-300);
}

/* Tooltip on avatar */
.attendee-avatar[title] { cursor: default; }

.class-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.25rem;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  gap: 1rem;
}

.capacity-info {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--gray-500);
}

.capacity-icon { color: var(--gray-400); }

.capacity-bar {
  width: 80px;
  height: 6px;
  background: var(--gray-200);
  border-radius: 99px;
  overflow: hidden;
}

.capacity-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width .3s var(--ease);
}

.capacity-fill.full { background: var(--danger); }
.capacity-fill.almost { background: var(--warning); }

/* Botones de clase */
.btn-book {
  padding: .55rem 1.25rem;
  border-radius: var(--r);
  font-size: .875rem;
  font-weight: 600;
  transition: all var(--dur) var(--ease);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.btn-book.book {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(92,184,112,.35);
}

.btn-book.book:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(92,184,112,.45); }

.btn-book.cancel {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.btn-book.cancel:hover { background: #fecaca; }

.btn-book.full {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
}

.btn-book.past {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
  font-style: italic;
}

.btn-book.booked-by-me {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #bbf7d0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-400);
}

.empty-state-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.1rem; color: var(--gray-500); font-weight: 600; margin-bottom: .5rem; }
.empty-state p  { font-size: .9rem; }

/* ═══════════════════════════════════════════════════════════
   MIS RESERVAS
   ═══════════════════════════════════════════════════════════ */

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.booking-card {
  background: var(--white);
  border-radius: var(--r);
  border: 1.5px solid var(--gray-200);
  padding: .65rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow var(--dur) var(--ease);
  margin-bottom: .4rem;
}

.booking-card:hover { box-shadow: var(--shadow-sm); }

.booking-card.past { opacity: .65; }

.booking-class-color {
  width: 4px;
  height: 38px;
  border-radius: 99px;
  flex-shrink: 0;
}

.booking-info { flex: 1; min-width: 0; }

.booking-name { font-size: .9rem; font-weight: 700; color: var(--dark); }
.booking-meta { font-size: .775rem; color: var(--gray-500); margin-top: .15rem; display: flex; gap: .65rem; flex-wrap: wrap; }
.booking-meta span { display: flex; align-items: center; gap: .2rem; }

/* Filas super compactas para el historial de reservas */
.past-booking-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .35rem .75rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--r);
  font-size: .8rem;
}

.past-booking-color {
  width: 3px;
  height: 16px;
  border-radius: 99px;
  flex-shrink: 0;
}

.past-booking-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  min-width: 0;
}

.past-booking-date { font-weight: 600; color: var(--dark); }
.past-booking-time { color: var(--gray-600); }
.past-booking-name { font-weight: 700; color: var(--dark); }
.past-booking-instructor { color: var(--gray-500); font-size: .75rem; }

/* Tabla densa y compacta para historial masivo */
.compact-history-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r);
  overflow: hidden;
  font-size: .8rem;
}

.compact-history-table th {
  background: var(--gray-100);
  padding: .4rem .75rem;
  font-size: .725rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gray-500);
  letter-spacing: .04em;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.compact-history-table td {
  padding: .35rem .75rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--dark);
}

.compact-history-table tr:last-child td {
  border-bottom: none;
}

.compact-history-table tr:hover td {
  background: var(--gray-50);
}

/* Pestañas para modal de ficha de usuario */
.user-modal-tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.25rem;
  gap: .25rem;
  overflow-x: auto;
}

.modal-tab-btn {
  padding: .55rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  margin-bottom: -2px;
}

.modal-tab-btn:hover {
  color: var(--dark);
}

.modal-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.modal-tab-btn.modal-tab-danger {
  color: #b45309;
}
.modal-tab-btn.modal-tab-danger:hover {
  color: #92400e;
  background: #fff7ed;
}
.modal-tab-btn.modal-tab-danger.active {
  color: #dc2626;
  border-bottom-color: #dc2626;
}

.btn-cancel-booking {
  padding: .45rem .9rem;
  border-radius: var(--r);
  font-size: .8rem;
  font-weight: 600;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  transition: all var(--dur) var(--ease);
  flex-shrink: 0;
}

.btn-cancel-booking:hover { background: #fecaca; }

/* ═══════════════════════════════════════════════════════════
   PERFIL
   ═══════════════════════════════════════════════════════════ */

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--white);
  border-radius: var(--r-lg);
  border: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-xs);
}

.profile-avatar-big {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
  overflow: hidden;
  border: 3px solid var(--primary-light);
}

.profile-avatar-big img { width: 100%; height: 100%; object-fit: cover; }

.profile-info { flex: 1; }
.profile-name { font-size: 1.3rem; font-weight: 700; color: var(--dark); }
.profile-email { font-size: .875rem; color: var(--gray-500); margin-top: .15rem; }

/* Plan card — unificado con el estilo general de la web */
.plan-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-left: 4px solid var(--primary);
  border-radius: var(--r-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
  transition: box-shadow var(--dur) var(--ease);
}
.plan-card:hover { box-shadow: var(--shadow); }

.plan-card.expired {
  border-left-color: var(--danger);
  background: #fff8f8;
}

.plan-icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  background: var(--primary-bg);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.plan-card.expired .plan-icon { background: var(--danger-bg); }

.plan-details { flex: 1; min-width: 0; }
.plan-details h3 { font-size: 1.05rem; font-weight: 700; color: var(--dark); margin-bottom: .2rem; }
.plan-details p { font-size: .83rem; color: var(--gray-500); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; }
.plan-details p strong { color: var(--gray-700); font-weight: 600; }

.plan-details .plan-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--primary-bg);
  color: var(--primary-dark);
  border: 1px solid var(--primary-light);
  padding: .2rem .75rem;
  border-radius: var(--r-full);
  font-size: .78rem;
  font-weight: 700;
  margin-top: .5rem;
}
.plan-card.expired .plan-pill {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}

/* ═══════════════════════════════════════════════════════════
   PANEL ADMIN
   ═══════════════════════════════════════════════════════════ */

.admin-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.75rem;
  border-bottom: 2px solid var(--gray-200);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.admin-tabs::-webkit-scrollbar { display: none; }

.admin-tab-btn {
  padding: .65rem 1.1rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.admin-tab-btn:hover { color: var(--dark); }
.admin-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* User row admin */
.user-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1rem;
  border-radius: var(--r);
  transition: background var(--dur) var(--ease);
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
}

.user-row:hover { background: var(--gray-50); }

.user-row-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
  overflow: hidden;
}

.user-row-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-row-info { flex: 1; min-width: 0; }
.user-row-name { font-size: .9rem; font-weight: 600; color: var(--dark); }
.user-row-meta { font-size: .775rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: .25rem .7rem;
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.status-pill.pending  { background: var(--info-bg);    color: #1e40af; }
.status-pill.approved { background: var(--success-bg); color: #065f46; }
.status-pill.rejected { background: var(--danger-bg);  color: #991b1b; }
.status-pill.paid     { background: var(--success-bg); color: #065f46; }
.status-pill.unpaid   { background: var(--warning-bg); color: #92400e; }
.status-pill.expired  { background: var(--danger-bg);  color: #991b1b; }

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: var(--dark); line-height: 1; }
.stat-card .stat-label { font-size: .8rem; color: var(--gray-500); margin-top: .35rem; }
.stat-card .stat-icon  { font-size: 1.5rem; margin-bottom: .5rem; }

/* ═══════════════════════════════════════════════════════════
   MODALES
   ═══════════════════════════════════════════════════════════ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  place-items: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal-backdrop.open { display: grid; animation: fadeIn .15s var(--ease); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  animation: slideUp .2s var(--ease);
  overflow: hidden;
}

.modal-box.modal-lg { max-width: 700px; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--dark); }

.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--gray-500);
  transition: all var(--dur) var(--ease);
}

.modal-close:hover { background: var(--gray-100); color: var(--dark); }

.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-200); display: flex; gap: .75rem; justify-content: flex-end; }

/* ═══════════════════════════════════════════════════════════
   TOASTS / NOTIFICACIONES
   ═══════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 1rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: .5rem;
  z-index: 1000;
  width: calc(100% - 2rem);
  max-width: 400px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .875rem 1.1rem;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  font-size: .875rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toastIn .25s var(--ease);
  cursor: pointer;
}

@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.toast.out {
  animation: toastOut .25s var(--ease) forwards;
}

@keyframes toastOut {
  to { transform: translateY(20px); opacity: 0; }
}

.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }
.toast-msg  { flex: 1; line-height: 1.4; }

.toast.success { background: var(--dark); color: var(--white); }
.toast.error   { background: var(--danger); color: var(--white); }
.toast.warning { background: var(--warning); color: var(--white); }
.toast.info    { background: var(--info); color: var(--white); }

/* ═══════════════════════════════════════════════════════════
   MISC UTILITIES
   ═══════════════════════════════════════════════════════════ */

.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
}

.card-title { font-size: .95rem; font-weight: 700; color: var(--dark); }

.card-body { padding: 1.25rem; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 700;
}

.badge-green { background: var(--success-bg); color: #065f46; }
.badge-red   { background: var(--danger-bg);  color: #991b1b; }
.badge-gray  { background: var(--gray-100);   color: var(--gray-600); }

/* Spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Loading screen */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 1.25rem;
}

.loading-screen .logo-load { font-size: 3rem; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .6; } to { opacity: 1; } }

.loading-screen p { color: rgba(255,255,255,.6); font-size: .9rem; }

/* Divider */
.divider { height: 1px; background: var(--gray-200); margin: 1.5rem 0; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* Btn secundario */
.btn-secondary {
  padding: .65rem 1.25rem;
  border-radius: var(--r);
  font-size: .875rem;
  font-weight: 600;
  border: 1.5px solid var(--gray-200);
  color: var(--gray-600);
  background: var(--white);
  transition: all var(--dur) var(--ease);
}

.btn-secondary:hover { background: var(--gray-100); border-color: var(--gray-300); }

/* Btn danger */
.btn-danger {
  padding: .65rem 1.25rem;
  border-radius: var(--r);
  font-size: .875rem;
  font-weight: 600;
  background: var(--danger);
  color: var(--white);
  transition: all var(--dur) var(--ease);
}

.btn-danger:hover { filter: brightness(1.1); }

/* Select / Input extras */
.form-select {
  width: 100%;
  padding: .75rem 2.5rem .75rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r);
  font-size: .95rem;
  color: var(--dark);
  background: var(--white) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") no-repeat right .75rem center / 16px 16px;
  appearance: none;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-10); }

/* Search */
.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  padding: .65rem 1rem .65rem 2.5rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r);
  font-size: .9rem;
  outline: none;
  transition: border-color var(--dur) var(--ease);
}

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

.search-box .search-icon {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}

/* Page title */
.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: .25rem;
}

.page-subtitle {
  font-size: .9rem;
  color: var(--gray-500);
  margin-bottom: 1.75rem;
}

/* Color swatches para clases */
.color-swatches {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .15s;
}

.color-swatch.selected { border-color: var(--dark); transform: scale(1.2); }

/* Bottom nav (mobile) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  z-index: 200;
  align-items: center;
  justify-content: space-around;
  padding: 0 .5rem;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  padding: .4rem .75rem;
  border-radius: var(--r);
  cursor: pointer;
  color: var(--gray-400);
  transition: color var(--dur) var(--ease);
  flex: 1;
  max-width: 80px;
}

.bottom-nav-item .bn-icon { font-size: 1.25rem; }
.bottom-nav-item .bn-label { font-size: .65rem; font-weight: 600; }
.bottom-nav-item.active { color: var(--primary); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  :root { --sidebar-w: 280px; }

  /* Sidebar oculta por defecto en mobile */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    z-index: 250;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-footer {
    padding-bottom: calc(1rem + var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  }

  .sidebar-overlay { display: block; pointer-events: none; }

  .topbar { display: flex; }

  /* Main content en mobile: ocupa toda la pantalla menos topbar y bottom-nav */
  .main-content {
    margin-left: 0;
    padding-top: var(--topbar-h);
    /* padding-bottom garantiza que el contenido no quede bajo la bottom-nav fija */
    padding-bottom: var(--bottom-nav-h);
    /* Importante: no permitir overflow horizontal */
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
  }

  .main-inner {
    padding: 1.25rem 1rem;
    /* Garantizar que el inner no desborde */
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Bottom nav: siempre fija, siempre visible */
  .bottom-nav {
    display: flex;
    /* Safe area para notch en iOS */
    padding-bottom: env(safe-area-inset-bottom, 0);
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0));
  }

  /* Calendar */
  .week-day-name { font-size: .6rem; }
  .week-day-num  { font-size: .95rem; }

  /* Grid de stats */
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* Grid 2/3 col -> 1 col */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* Toast arriba en mobile */
  .toast-container { bottom: auto; top: calc(var(--topbar-h) + .75rem); }

  /* Modal full en mobile */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal-box { border-radius: var(--r-xl) var(--r-xl) 0 0; max-width: 100%; animation: slideUpMobile .25s var(--ease); }
  .modal-box.modal-lg { border-radius: var(--r-xl) var(--r-xl) 0 0; max-width: 100%; }

  @keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  /* Week strip más compacto */
  .week-strip { gap: .25rem; padding: .5rem; }
  .week-day { padding: .5rem .1rem; }

  /* Plan card en mobile: evitar overflow */
  .plan-card {
    padding: 1rem;
    gap: .75rem;
  }
  .plan-details { min-width: 0; overflow: hidden; }
  .plan-details p {
    font-size: .78rem;
    /* Texto largo que se corta en vez de desbordar */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Profile card info en mobile */
  .profile-hero { flex-wrap: wrap; }
  .profile-hero .profile-info { min-width: 0; flex: 1; }
  .profile-hero .profile-info h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Tablas con scroll interno (no desbordamiento) */
  table {
    min-width: 0;
  }
  .payments-table-wrap,
  .admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--r);
  }

  /* Class cards: footer botón a ancho completo en pantallas muy pequeñas */
  .class-card__footer {
    flex-wrap: wrap;
    gap: .5rem;
  }

  /* Attendees grid: no desborda en mobile */
  .attendees-grid {
    max-width: 100%;
    overflow: hidden;
  }
  .attendee-slot, .attendee-avatar, .attendee-slot-empty {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }

  /* User modal tabs: scroll horizontal sin desbordar */
  .user-modal-tabs {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
  }
  .user-modal-tabs::-webkit-scrollbar { display: none; }

  /* Booking rows en mobile */
  .booking-item {
    flex-wrap: wrap;
    gap: .5rem;
  }
}

@media (max-width: 400px) {
  .week-strip { gap: .15rem; padding: .4rem; }
  .attendee-avatar, .attendee-slot, .attendee-slot-empty { width: 32px; height: 32px; }
  .plan-icon { font-size: 1.75rem; }
}

/* ── Day alerts (compactos) ───────────────────────────────────────────────── */
.day-alert {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .9rem;
  border-radius: var(--r);
  font-size: .82rem;
  font-weight: 500;
  margin-bottom: .85rem;
}

.day-alert--holiday {
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  color: #92400e;
}

.day-alert--closed {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--gray-500);
}

/* ── Divisor de franja horaria ────────────────────────────────────────────── */
.period-divider {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .65rem;
}

.period-divider__label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  flex-shrink: 0;
}

.period-divider__label--morning  { color: #d97706; }
.period-divider__label--afternoon { color: #7c3aed; }

.period-divider__hours {
  font-size: .72rem;
  color: var(--gray-400);
  white-space: nowrap;
  flex-shrink: 0;
}

.period-divider__line {
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* ── Semana: estados y días ────────────────────────────────────────────────── */
.week-day.today:not(.selected) .week-day-name { color: var(--primary); font-weight: 700; }
.week-day.today:not(.selected) .week-day-num  { color: var(--primary-dark); font-weight: 800; }

.week-day.closed-day:not(.selected) .week-day-num  { color: var(--gray-400); }
.week-day.closed-day:not(.selected) .week-day-name { color: var(--gray-400); }

.week-day-status {
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.closed-dot {
  font-size: .7rem;
  font-weight: 800;
  color: var(--danger);
  line-height: 1;
}

.week-day.selected .closed-dot {
  color: rgba(255,255,255,.9);
}

.day-status-icon {
  font-size: .65rem;
  line-height: 1;
}
