/* ============================================================
   Calisthenics Colleferro ASD — Premium CSS v4
   Mobile  : bottom navigation bar
   Desktop : left sidebar  (≥ 992 px)
   ============================================================ */

/* ------------------------------------------------------------------ */
/*  DESIGN TOKENS                                                       */
/* ------------------------------------------------------------------ */
:root {
  --primary:     #0a0a10;      /* sidebar / dark elements          */
  --primary2:    #16161e;      /* sidebar hover / secondary dark   */
  --accent:      #c9a227;      /* brand gold                       */
  --accent2:     #a07a1a;      /* darker gold                      */
  --accent-glow: rgba(201,162,39,.22);
  --surface-card: #ffffff;     /* card / modal surface             */
  --surface-hover: #f1f5f9;   /* hover surface                    */
  --success:     #10b981;
  --success-bg:  #d1fae5;
  --success-text:#065f46;
  --warning:     #f59e0b;
  --warning-bg:  #fef3c7;
  --warning-text:#92400e;
  --danger:      #ef4444;
  --danger-bg:   #fee2e2;
  --danger-text: #7c2d12;
  --info:        #3b82f6;
  --info-bg:     #dbeafe;
  --info-text:   #1e40af;
  --bg:          #f8fafc;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #0f172a;
  --text-2:      #475569;
  --muted:       #94a3b8;
  --radius-sm:   8px;
  --radius:      14px;
  --radius-lg:   20px;
  --shadow-sm:   0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow:      0 4px 16px rgba(15,23,42,.08), 0 1px 4px rgba(15,23,42,.04);
  --shadow-lg:   0 12px 40px rgba(15,23,42,.12), 0 4px 12px rgba(15,23,42,.06);
  --sidebar-w:   240px;
  --nav-h:       62px;
  --topbar-h:    58px;
  --transition:  .18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }

body {
  font-family: -apple-system, 'Segoe UI', system-ui, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

/* ================================================================
   AUTH PAGES
   ================================================================ */
/* ---- Prevent horizontal overflow on mobile ---- */
html, body { overflow-x: hidden; max-width: 100%; }

/* ---- La barra superiore dell'app è sempre fissa. Le pagine che la
   utilizzano ricevono automaticamente lo spazio necessario sotto di essa. */
body:has(.top-navbar) {
  padding-top: var(--topbar-h);
}

/* ---- Text inputs inside modals — white bg for readability ---- */
.modal .form-control {
  background-color: #ffffff !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
.modal .form-control::placeholder {
  color: #94a3b8 !important;
  opacity: 1;
}
.modal .form-control:focus {
  background-color: #ffffff !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 .2rem rgba(201,162,39,.2) !important;
}
/* ---- Select dropdowns inside modals — dark theme (leggibile su sfondo scuro) ---- */
.modal .form-select,
.modal select {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
  -webkit-text-fill-color: #e2e8f0 !important;
  border-color: #475569 !important;
  color-scheme: dark !important;
}
.modal .form-select:focus,
.modal select:focus {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
  -webkit-text-fill-color: #e2e8f0 !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 .2rem rgba(201,162,39,.2) !important;
}

.auth-page {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  position: relative;
  overflow: hidden;
  background: var(--primary);
}

/* Geometric background decoration */
.auth-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  top: -200px; right: -200px;
  pointer-events: none;
}
.auth-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.08) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}

.auth-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.auth-logo { text-align: center; margin-bottom: 2rem; }

.auth-logo-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  font-size: 1.6rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 24px var(--accent-glow);
  letter-spacing: 1px;
}

.auth-logo h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .25rem;
}
.auth-logo p {
  font-size: .82rem;
  color: var(--muted);
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
}

.card-header-accent {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary2) 100%);
  color: #fff;
  padding: 1.25rem 1.5rem;
  border-bottom: none;
}
.card-header-accent h4,
.card-header-accent h5 { margin: 0; font-weight: 800; letter-spacing: -.3px; }
.card-header-accent p  { margin: .3rem 0 0; opacity: .65; font-size: .82rem; }

.card-body { padding: 1.25rem; }

/* ================================================================
   SECTION TITLE
   ================================================================ */
.section-title {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 1.75rem 0 .875rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn-primary-custom {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  letter-spacing: .2px;
  transition: all var(--transition);
  color: #0a0a10;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-primary-custom:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
  color: #0a0a10;
}
.btn-primary-custom:active { transform: translateY(0); }

.btn-biometric {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  padding: .875rem 1.5rem;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
}
.btn-biometric:hover {
  background: var(--primary2);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(15,23,42,.2);
}

/* ================================================================
   TOP NAVBAR
   ================================================================ */
.top-navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  padding: 0 .875rem;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: .75rem;
  box-shadow: var(--shadow-sm);
}

/* Link della navbar (logout, avatar): flex per allineamento pulito al bordo destro */
.top-navbar > a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.top-navbar .brand {
  color: var(--text);
  font-weight: 800;
  font-size: 1rem;
  flex: 0 1 auto;
  margin-right: auto; /* spinge logout+avatar al bordo destro anche quando il brand è limitato da max-width */
  letter-spacing: -.2px;
}

.top-navbar .btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  flex-shrink: 0;
}
.top-navbar .btn-icon:hover {
  background: var(--bg);
  color: var(--accent);
  border-color: var(--accent);
}

/* ================================================================
   AVATAR
   ================================================================ */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  font-size: .78rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  box-shadow: 0 2px 8px var(--accent-glow);
  letter-spacing: .5px;
  text-decoration: none;
}

/* ================================================================
   BOTTOM NAV  (mobile)
   ================================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 24px rgba(15,23,42,.08);
  /* height include il safe-area: icone sempre visibili su iPhone con notch */
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: .4rem .25rem;
  color: var(--muted);
  text-decoration: none;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .3px;
  gap: 3px;
  transition: color var(--transition);
  position: relative;
}
.bottom-nav a span { display: block; }
.bottom-nav a i { font-size: 1.25rem; }

.bottom-nav a.active { color: var(--accent); }
.bottom-nav a.active::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
}
.bottom-nav a:not(.active):hover { color: var(--text-2); }

/* Pulsante annulla/esci "grafico" (pill) — sostituisce le vecchie X */
.btn-cancel-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid rgba(239,68,68,.4);
  color: #ef4444;
  background: rgba(239,68,68,.08);
  border-radius: 999px;
  padding: .32rem .7rem;
  font-size: .72rem; font-weight: 700; line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-cancel-pill:hover { background: #ef4444; color: #fff; }
.btn-cancel-pill .bi { font-size: .8rem; line-height: 1; }

/* Icona "+" (e simili) centrata verticalmente nei bottoni primari */
.btn-primary-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary-custom .bi { line-height: 1; display: inline-flex; }

/* ================================================================
   PAGE CONTAINER
   ================================================================ */
.page-container {
  padding: 1rem .875rem;
  max-width: 760px;
  margin: 0 auto;
}

/* ================================================================
   STAT CARDS
   ================================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card--blue::before  { background: linear-gradient(90deg, var(--info), #60a5fa); }
.stat-card--green::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card--orange::before{ background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-card--red::before   { background: linear-gradient(90deg, var(--accent), var(--accent2)); }

.stat-card .stat-icon {
  font-size: 1.35rem;
  margin-bottom: .5rem;
  opacity: .7;
}
.stat-card--blue   .stat-icon { color: var(--info); }
.stat-card--green  .stat-icon { color: var(--success); }
.stat-card--orange .stat-icon { color: var(--warning); }
.stat-card--red    .stat-icon { color: var(--accent); }

.stat-card .stat-val {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  color: var(--text);
}
.stat-card .stat-lbl {
  font-size: .7rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-top: .3rem;
}

/* ================================================================
   MEMBER HERO (view.php)
   ================================================================ */
.member-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary2) 100%);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}
.member-hero-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 1.3rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.25);
  letter-spacing: .5px;
}
.member-hero-info { flex: 1; min-width: 0; }
.member-hero-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: .2rem;
  line-height: 1.2;
  letter-spacing: -.3px;
}
.member-hero-email { font-size: .8rem; color: rgba(255,255,255,.6); }
.member-hero-badge { flex-shrink: 0; }

/* ================================================================
   STATUS PILLS
   ================================================================ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  border-radius: 20px;
  padding: .3rem .8rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .2px;
}
.status-active   { background: var(--success-bg); color: var(--success-text); }
.status-inactive { background: var(--danger-bg);  color: var(--danger-text); }
.status-warning  { background: var(--warning-bg); color: var(--warning-text); }
.status-info     { background: var(--info-bg);    color: var(--info-text); }

/* ================================================================
   ACTION BAR (view.php quick actions)
   ================================================================ */
.action-bar {
  display: flex;
  gap: .625rem;
  flex-wrap: wrap;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.action-btn:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--primary2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.action-btn--danger { color: var(--danger-text); border-color: var(--danger-bg); background: var(--danger-bg); }
.action-btn--danger:hover { background: #fca5a5; border-color: var(--danger); }
.action-btn--success{ color: var(--success-text); border-color: var(--success-bg); background: var(--success-bg); }
.action-btn--success:hover { background: #6ee7b7; border-color: var(--success); }

/* ================================================================
   INFO GRID (view.php anagrafics)
   ================================================================ */
.info-grid { display: flex; flex-direction: column; gap: .875rem; }
.info-row {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
}
.info-row-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: .95rem;
  flex-shrink: 0;
  margin-top: .1rem;
}
.info-row-label {
  font-size: .7rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .15rem;
}
.info-row-val {
  font-size: .875rem;
  color: var(--text);
  font-weight: 600;
}

/* ================================================================
   LIST CLEAN (generic bordered list)
   ================================================================ */
.list-clean { }
.list-clean-row {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.list-clean-row:last-child { border-bottom: none; }
.list-clean-row:hover { background: var(--bg); }
.list-clean-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ================================================================
   SLOT / LESSON CARDS
   ================================================================ */
.slot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: .625rem;
  display: flex;
  gap: .875rem;
  align-items: flex-start;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition);
}
.slot-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: inherit;
}
.slot-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.slot-info { flex: 1; min-width: 0; }
.slot-time { font-size: .78rem; color: var(--muted); font-weight: 600; margin-bottom: .15rem; }
.slot-name { font-weight: 700; font-size: .95rem; line-height: 1.25; color: var(--text); }
.slot-meta { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.slot-count { text-align: right; flex-shrink: 0; }
.slot-count .n { font-size: 1.15rem; font-weight: 800; line-height: 1; }
.slot-count small { font-size: .68rem; color: var(--muted); display: block; margin-top: .15rem; }
.slot-full { color: var(--accent); }
.slot-ok   { color: var(--success); }

/* ================================================================
   FORMS
   ================================================================ */
.form-label {
  font-weight: 700;
  font-size: .82rem;
  margin-bottom: .35rem;
  color: var(--text);
  letter-spacing: .1px;
}
.form-control,
.form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: .9rem;
  padding: .65rem .9rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}
.form-control::placeholder { color: var(--muted); }
.required-star { color: var(--accent); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-text { font-size: .78rem; color: var(--muted); margin-top: .3rem; }

/* Input group */
.input-group-text {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--muted);
}
.input-group .form-control:not(:first-child) { border-left: none; }
.input-group .input-group-text:first-child    { border-right: none; }

/* ================================================================
   AUTOSAVE INDICATOR
   ================================================================ */
.save-indicator {
  font-size: .72rem; font-weight: 700;
  letter-spacing: .3px; min-height: 18px;
  transition: all var(--transition);
}
.save-indicator.saving { color: var(--muted); }
.save-indicator.saving::before {
  content: '';
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-right: 4px;
  vertical-align: middle;
}
.save-indicator.saved { color: var(--success); }
.save-indicator.error { color: var(--accent); }

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

/* ================================================================
   BADGES / PILLS (legacy compat)
   ================================================================ */
.badge-verificato,
.badge-verified  { background: var(--success-bg); color: var(--success-text); border-radius: 20px; padding: .25rem .75rem; font-size: .72rem; font-weight: 700; display: inline-block; }
.badge-nonverif  { background: var(--warning-bg); color: var(--warning-text); border-radius: 20px; padding: .25rem .75rem; font-size: .72rem; font-weight: 700; display: inline-block; }
.badge-attivo    { background: var(--success-bg); color: var(--success-text); border-radius: 20px; padding: .25rem .75rem; font-size: .72rem; font-weight: 700; display: inline-block; }
.badge-inattivo  { background: var(--danger-bg);  color: var(--danger-text);  border-radius: 20px; padding: .25rem .75rem; font-size: .72rem; font-weight: 700; display: inline-block; }
.coach-badge     { background: var(--accent-glow); color: var(--accent); border-radius: 20px; padding: .25rem .75rem; font-size: .72rem; font-weight: 700; display: inline-block; }
.badge-masterclass { background:#4f1d96; color:#e9d5ff; border-radius:20px; padding:.25rem .75rem; font-size:.72rem; font-weight:700; display:inline-block; }
.badge-riserva   { background:#78350f; color:#fde68a; border-radius:20px; padding:.25rem .65rem; font-size:.72rem; font-weight:700; display:inline-block; }
.badge-prova     { background:#164e63; color:#a5f3fc; border-radius:20px; padding:.25rem .65rem; font-size:.72rem; font-weight:700; display:inline-block; }

/* Date chip enhancements */
.date-chip.no-slots { opacity:.35; }
.date-chip-cnt { font-size:.52rem; font-weight:700; letter-spacing:.4px; text-transform:uppercase; opacity:.75; margin-top:.05rem; }

/* ================================================================
   LIST ITEMS (member list)
   ================================================================ */
.member-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .875rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition);
}
.member-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  color: inherit;
  border-color: #d1d5db;
}
.member-item:active { transform: scale(.99); }

/* ================================================================
   BOOKING CARDS
   ================================================================ */
.booking-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: .5rem;
  border-left: 3px solid var(--border);
}
.booking-card.stato-confermata { border-left-color: var(--success); }
.booking-card.stato-in_attesa  { border-left-color: var(--warning); }
.booking-card.stato-cancellata { border-left-color: var(--muted); opacity: .6; }
.booking-card .bk-date { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.booking-card .bk-name { font-weight: 700; font-size: .95rem; margin: .2rem 0; }
.booking-card .bk-time { font-size: .82rem; color: var(--muted); }

/* ================================================================
   ABBONAMENTO CARD
   ================================================================ */
.abb-card {
  border-radius: var(--radius);
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary2) 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.abb-card::before {
  content: '';
  position: absolute;
  right: -30px; top: -30px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.abb-card::after {
  content: '';
  position: absolute;
  right: 50px; bottom: -40px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.abb-card--scaduto { background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%); }

.abb-card .abb-type { font-size: .7rem; text-transform: uppercase; letter-spacing: 1.5px; opacity: .6; font-weight: 700; }
.abb-card .abb-name { font-size: 1.25rem; font-weight: 800; margin: .3rem 0 .5rem; letter-spacing: -.3px; }
.abb-card .abb-exp  { font-size: .8rem; opacity: .75; }
.abb-progress     { height: 6px; border-radius: 3px; background: rgba(255,255,255,.2); margin-top: 1rem; }
.abb-progress-bar { height: 100%; border-radius: 3px; background: var(--accent); transition: width .5s; }

/* ================================================================
   SCHEDULE GRID
   ================================================================ */
.schedule-header { display: grid; grid-template-columns: 56px repeat(7,1fr); gap: 2px; margin-bottom: 2px; }
.schedule-header > div {
  text-align: center; font-size: .6rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .8px; color: var(--muted); padding: .4rem;
}
.schedule-row  { display: grid; grid-template-columns: 56px repeat(7,1fr); gap: 2px; margin-bottom: 2px; }
.schedule-time { font-size: .7rem; color: var(--muted); font-weight: 700; display: flex; align-items: center; justify-content: flex-end; padding-right: .5rem; }
.schedule-cell { min-height: 48px; border-radius: 6px; }
.schedule-slot { border-radius: 6px; padding: .35rem .5rem; font-size: .7rem; font-weight: 700; cursor: pointer; transition: transform var(--transition); line-height: 1.2; }
.schedule-slot:hover { transform: scale(1.05); }

/* ================================================================
   STEP INDICATOR
   ================================================================ */
.step-indicator { display: flex; align-items: center; margin-bottom: 1.5rem; }
.step { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; }
.step:not(:last-child)::after {
  content: '';
  position: absolute; top: 15px; left: 60%;
  width: 80%; height: 2px; background: var(--border);
}
.step.done::after { background: var(--accent); }
.step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  background: var(--surface); color: var(--muted);
  transition: all var(--transition);
}
.step.active .step-circle { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.step.done   .step-circle { border-color: var(--accent); background: var(--accent); color: #fff; }
.step span { font-size: .6rem; font-weight: 700; margin-top: .4rem; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .5px; }

/* ================================================================
   ALERTS
   ================================================================ */
.alert-info-custom {
  background: var(--info-bg);
  border-left: 3px solid var(--info);
  color: var(--info-text);
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  font-size: .85rem;
}

/* ================================================================
   DIVIDER
   ================================================================ */
.divider-text {
  text-align: center; position: relative;
  margin: 1.25rem 0; color: var(--muted); font-size: .8rem;
}
.divider-text::before,
.divider-text::after {
  content: '';
  position: absolute; top: 50%;
  width: 42%; height: 1px; background: var(--border);
}
.divider-text::before { left: 0; }
.divider-text::after  { right: 0; }

/* ================================================================
   TABLE
   ================================================================ */
.table-app { font-size: .875rem; width: 100%; border-collapse: collapse; }
.table-app th {
  background: var(--primary); color: #fff;
  font-weight: 700; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .8px;
  border: none; padding: .75rem 1rem;
  white-space: nowrap;
}
.table-app th:first-child { border-radius: var(--radius) 0 0 0; }
.table-app th:last-child  { border-radius: 0 var(--radius) 0 0; }
.table-app td { vertical-align: middle; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.table-app tr:last-child td { border-bottom: none; }
.table-app tr:hover td { background: var(--bg); }

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state { text-align: center; padding: 3.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 3rem; display: block; margin-bottom: 1rem; opacity: .3; }
.empty-state p { font-size: .9rem; margin-bottom: 1.5rem; }

/* ================================================================
   FLOATING ACTION BUTTON
   ================================================================ */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + .875rem + env(safe-area-inset-bottom));
  right: .875rem;
  z-index: 150;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  border: none; font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.fab:hover { transform: scale(1.1) rotate(8deg); color: #fff; box-shadow: 0 8px 28px var(--accent-glow); }

/* ================================================================
   TAGS / CHIPS
   ================================================================ */
.tag {
  display: inline-block;
  border-radius: 20px;
  padding: .2rem .65rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .2px;
}

/* ================================================================
   WEEK DAY VIEW (slots admin)
   ================================================================ */
.week-day {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.week-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  gap: .5rem;
}
.week-day:not(:has(.week-day-body)) .week-day-header,
.week-day:has(.week-day-empty) .week-day-header {
  border-radius: var(--radius);
  border-bottom: 1px solid var(--border);
}
.week-day-header--today {
  background: linear-gradient(135deg, rgba(99,102,241,.15), rgba(79,70,229,.08));
  border-color: rgba(99,102,241,.3);
}
.week-day-label { display: flex; align-items: baseline; gap: .5rem; }
.week-day-name  { font-weight: 800; font-size: .82rem; text-transform: uppercase; letter-spacing: .7px; color: var(--text); }
.week-day-header--today .week-day-name { color: var(--primary); }
.week-day-date  { font-size: .78rem; color: var(--muted); }
.week-day-count { font-size: .7rem; font-weight: 700; background: var(--primary); color: #fff; border-radius: 20px; padding: .15rem .6rem; white-space: nowrap; }
.week-day-rest  { font-size: .72rem; color: var(--muted); opacity: .7; }

.week-day-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.week-slot-card {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.week-slot-card:last-child { border-bottom: none; }
.week-slot-card:hover { background: var(--surface-hover); }
.week-slot-strip {
  width: 4px;
  flex-shrink: 0;
  align-self: stretch;
}
.week-slot-body {
  flex: 1;
  padding: .65rem .9rem;
  min-width: 0;
}
.week-slot-top {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: .2rem;
}
.week-slot-time  { font-size: .8rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.week-slot-tipo-pt { font-size: .65rem; font-weight: 700; background: rgba(139,92,246,.2); color: #a78bfa; border-radius: 10px; padding: .1rem .45rem; }
.week-slot-full  { font-size: .65rem; font-weight: 700; background: rgba(233,69,96,.18); color: var(--accent); border-radius: 10px; padding: .1rem .45rem; }
.week-slot-low   { font-size: .65rem; font-weight: 700; background: rgba(245,158,11,.15); color: var(--warning); border-radius: 10px; padding: .1rem .45rem; }
.week-slot-name  { font-size: .88rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-slot-meta  { font-size: .73rem; color: var(--muted); margin-top: .15rem; }

.week-slot-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: .65rem .9rem .65rem .4rem;
  min-width: 52px;
}
.week-slot-count         { font-size: 1.15rem; font-weight: 800; color: var(--muted); line-height: 1; }
.week-slot-count--ok     { color: var(--success); }
.week-slot-count--full   { color: var(--accent); }
.week-slot-max           { font-size: .7rem; color: var(--muted); }
.week-slot-bar           { width: 36px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }

.week-day-empty {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem 1rem;
  font-size: .8rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  opacity: .7;
}
.week-day-empty i        { font-size: .9rem; }
.week-day-add            { margin-left: auto; color: var(--muted); font-size: 1rem; transition: color var(--transition); }
.week-day-add:hover      { color: var(--primary); }

/* ================================================================
   TEMPLATE GRID (slots admin)
   ================================================================ */
.tpl-grid { display: grid; grid-template-columns: 1fr; gap: .625rem; margin-bottom: 1rem; }
@media (min-width: 600px) { .tpl-grid { grid-template-columns: 1fr 1fr; } }

.tpl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
.tpl-card:hover          { transform: translateY(-2px); }
.tpl-card--inactive      { opacity: .55; }
.tpl-card-color          { width: 5px; flex-shrink: 0; }
.tpl-card-body           { flex: 1; padding: .75rem; min-width: 0; }
.tpl-card-header         { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .3rem; }
.tpl-card-name           { font-size: .88rem; font-weight: 700; color: var(--text); }
.tpl-card-meta           { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .73rem; color: var(--muted); margin-bottom: .35rem; }
.tpl-card-stats          { display: flex; gap: .75rem; font-size: .72rem; color: var(--muted); }
.tpl-card-actions        { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; padding: .75rem .65rem; border-left: 1px solid var(--border); }

/* ================================================================
   ABB-MINI-CARD (abbonamenti secondari atleta dashboard)
   ================================================================ */
.abb-mini-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem 1rem;
  font-size: .78rem;
  box-shadow: var(--shadow-sm);
  width: 100%;
}
.abb-mini-card i         { font-size: 1.1rem; color: var(--accent); flex-shrink: 0; }
.abb-mini-nome           { font-weight: 700; color: var(--text); }
.abb-mini-meta           { color: var(--muted); font-size: .72rem; margin-top: .1rem; }

/* ================================================================
   LIST CLEAN ROW (prodotti.php)
   ================================================================ */
.list-clean-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.list-clean-row:last-child { border-bottom: none; }

/* ================================================================
   DESKTOP — LEFT SIDEBAR  (≥ 992 px)
   ================================================================ */
@media (min-width: 992px) {

  /* Solo le pagine che hanno .bottom-nav ricevono il padding sidebar.
     CSS :has() evita FOUC senza JavaScript. */
  body:has(.bottom-nav) {
    padding-left: var(--sidebar-w);
    padding-bottom: 0;
  }

  /* ---- SIDEBAR ---- */
  .bottom-nav {
    position: fixed;
    left: 0; top: 0;
    right: auto; bottom: 0;
    width: var(--sidebar-w);
    height: 100vh;

    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;

    background: var(--primary);
    border-top: none;
    border-right: 1px solid rgba(255,255,255,.06);
    box-shadow: 2px 0 32px rgba(15,23,42,.25);
    padding: 0;
    gap: 0;
    overflow-y: auto;
  }

  /* Brand header */
  .bottom-nav::before {
    content: '⚡ CC ASD';
    display: block;
    color: #fff;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: .5px;
    padding: 1.4rem 1.25rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: .5rem;
    flex-shrink: 0;
  }

  /* Nav links */
  .bottom-nav a {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    padding: .8rem 1.25rem;
    color: rgba(255,255,255,.55);
    font-size: .865rem;
    font-weight: 500;
    letter-spacing: 0;
    gap: .75rem;
    border-radius: 0;
    border-left: 3px solid transparent;
    text-transform: none;
    transition: all var(--transition);
  }
  .bottom-nav a::before { display: none; } /* remove mobile top-line indicator */

  .bottom-nav a span { display: inline; font-size: .865rem; }
  .bottom-nav a i { font-size: 1.05rem; width: 22px; text-align: center; flex-shrink: 0; }

  .bottom-nav a:hover {
    color: rgba(255,255,255,.9);
    background: rgba(255,255,255,.07);
    border-left-color: rgba(255,255,255,.2);
  }
  .bottom-nav a.active {
    color: #fff !important;
    background: rgba(233,69,96,.15);
    border-left-color: var(--accent);
    font-weight: 700;
  }
  .bottom-nav a.active i { color: var(--accent) !important; }

  /* ---- TOP NAVBAR ---- */
  .top-navbar {
    left: var(--sidebar-w);
    padding: 0 1rem;
    border-bottom: 1px solid var(--border);
  }
  .top-navbar .brand { font-size: 1.05rem; }

  /* ---- CONTENT ---- */
  .page-container {
    max-width: 1200px;
    padding: 1.75rem 2.5rem;
  }

  /* Stats: 4-col on desktop */
  .stat-grid { grid-template-columns: repeat(4, 1fr); }

  /* FAB: no more bottom-nav overlap */
  .fab { bottom: 2rem; right: 2rem; }

  /* Member list: 2-col grid */
  .members-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
  }
  .members-grid .member-item { margin-bottom: 0; }

  /* Info grid: 2-col on wide screens */
  .info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .875rem; }
  .info-row  { align-items: flex-start; }
}

/* Medium: 4 stat-cols before sidebar kicks in */
@media (min-width: 768px) and (max-width: 991px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .page-container { padding: 1.25rem 1.5rem; }
}

@media (min-width: 1400px) {
  .page-container { padding: 2rem 3.5rem; }
}

/* ================================================================
   EXPIRY ALERT BANNERS (atleta)
   ================================================================ */
.expiry-alert {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .83rem;
  line-height: 1.4;
}
.expiry-alert--warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid #fcd34d;
}
.expiry-alert--danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid #fca5a5;
}

/* ================================================================
   STAT-CARD LINK (clickable cards on admin dashboard)
   ================================================================ */
a.stat-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
a.stat-card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  color: inherit;
}
a.stat-card-link:active {
  transform: scale(.97);
}

/* ================================================================
   SCADENZA STATUS COLORS (view.php scheda socio)
   ================================================================ */
.scadenza-ok      { color: var(--success); }
.scadenza-warning { color: var(--warning); font-weight: 600; }
.scadenza-danger  { color: var(--accent);  font-weight: 700; }

/* Required field asterisk */
.required-star { color: var(--accent); margin-left: .1rem; }

/* Opacity helper for expired rows */
.opacity-60 { opacity: .6; }

/* ================================================================
   FIX: Form colors — text inputs bianchi, select sempre scuri
   Covers both OS-level dark mode AND Bootstrap 5.3 color-scheme
   ================================================================ */

/* ── Text inputs: sfondo bianco + testo scuro (leggibilità form) ── */
html body .form-control,
html body textarea.form-control,
html body input[type="text"],
html body input[type="email"],
html body input[type="date"],
html body input[type="password"],
html body input[type="tel"],
html body input[type="number"],
html body input[type="search"],
html body input[type="url"] {
  color: #0f172a !important;
  background-color: #ffffff !important;
  -webkit-text-fill-color: #0f172a !important;
  color-scheme: light !important;
}
html body .form-control:disabled {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  -webkit-text-fill-color: #64748b !important;
  opacity: 1 !important;
}

/* ── Select / dropdown: tema scuro dell'app — testo chiaro su sfondo scuro ── */
html body .form-select,
html body select {
  color: #e2e8f0 !important;
  background-color: #1e293b !important;
  -webkit-text-fill-color: #e2e8f0 !important;
  color-scheme: dark !important;
  border-color: #475569 !important;
}
html body .form-select:focus,
html body select:focus {
  background-color: #1e293b !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 .2rem rgba(201,162,39,.2) !important;
}
/* ── Eccezione: select chiari (.select-light) — bianchi e leggibili, vincono sulle regole scure ── */
html body select.select-light,
html body .form-select.select-light,
html body .form-control.select-light {
  background-color: #ffffff !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  color-scheme: light !important;
  border-color: #cbd5e1 !important;
}
html body select.select-light:focus,
html body .form-control.select-light:focus {
  background-color: #ffffff !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 .2rem rgba(201,162,39,.2) !important;
}
html body select.select-light option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

html body .form-select:disabled,
html body select:disabled {
  background-color: #0f172a !important;
  color: #64748b !important;
  -webkit-text-fill-color: #64748b !important;
  opacity: 1 !important;
}
/* option elements: colore esplicito per browser che lo supportano */
html body .form-select option,
html body select option {
  background-color: #1e293b;
  color: #e2e8f0;
}

/* ── Media dark mode: mantieni stessa logica ── */
@media (prefers-color-scheme: dark) {
  .form-control,
  input[type="text"], input[type="email"], input[type="date"],
  input[type="password"], input[type="tel"], input[type="number"],
  input[type="search"], textarea {
    color: #0f172a !important;
    background-color: #ffffff !important;
    -webkit-text-fill-color: #0f172a !important;
    color-scheme: light !important;
  }
  .form-select, select {
    color: #e2e8f0 !important;
    background-color: #1e293b !important;
    -webkit-text-fill-color: #e2e8f0 !important;
    color-scheme: dark !important;
  }
}
/* ----------------------------------------------------------------
   input[type="time"] / datetime-local — segmento selezionato leggibile
   Con color-scheme:light il segmento evidenziato diventa blu medio
   con testo scuro → contrasto insufficiente su alcuni browser.
   Usando color-scheme:dark il browser applica sfondo scuro + testo
   chiaro: il segmento attivo appare più chiaro su scuro → sempre
   leggibile indipendentemente dall'OS e dal browser.
---------------------------------------------------------------- */
input[type="time"],
input[type="datetime-local"],
html body input[type="time"],
html body input[type="datetime-local"] {
  color-scheme: dark !important;
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
  -webkit-text-fill-color: #e2e8f0 !important;
  border: 1px solid #475569 !important;
  border-radius: var(--radius-sm) !important;
  padding: .375rem .75rem !important;
}
input[type="time"]:focus,
input[type="datetime-local"]:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
  outline: none !important;
}
@media (prefers-color-scheme: dark) {
  input[type="time"],
  input[type="datetime-local"] {
    color-scheme: dark !important;
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    -webkit-text-fill-color: #e2e8f0 !important;
  }
}
/* iOS Safari autofill override */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: #0f172a !important;
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  box-shadow:         0 0 0 1000px #ffffff inset !important;
  transition: background-color 5000s ease-in-out 0s;
}
/* Upload zone */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; cursor: pointer; transition: border-color var(--transition); background: #fff; }
.upload-zone:hover { border-color: var(--accent); }
.upload-zone input[type="file"] { display: none; }

/* ================================================================
   MASTER CLASS — badge & strip color
   ================================================================ */
.week-slot-tipo-masterclass {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  color: #fff;
  padding: .15rem .6rem;
  border-radius: 20px;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.week-slot-strip-masterclass {
  background: linear-gradient(180deg, #7c3aed 0%, #5b21b6 100%);
}

/* ================================================================
   SLOTS — GRIGLIA GIORNI (admin) + GRIGLIA ATLETA
   ================================================================ */

/* Admin: settimana in griglia multi-colonna */
.slots-week-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  align-items: start;
}
@media (min-width: 600px) { .slots-week-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .slots-week-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px){ .slots-week-grid { grid-template-columns: repeat(7, 1fr); } }
.slots-week-grid .week-day { margin-bottom: 0; }
.slots-week-grid .week-slot-card { cursor: pointer; position: relative; }

/* Atleta: slot del giorno in 2 colonne */
.slots-day-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
@media (min-width: 600px) { .slots-day-grid { grid-template-columns: repeat(3, 1fr); } }

/* Slot tile (card compatta per la griglia atleta) */
.sg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem .65rem .7rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.sg-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.sg-time {
  font-size: .7rem; font-weight: 700; color: var(--accent);
  margin-top: .15rem; display: flex; align-items: center; flex-wrap: wrap; gap: .2rem;
}
.sg-name { font-size: .82rem; font-weight: 700; color: var(--text); line-height: 1.2; margin-top: .1rem; }
.sg-meta { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.sg-actions { margin-top: auto; padding-top: .5rem; }
.sg-actions .btn { font-size: .75rem; }

/* ================================================================
   BATCH DELETE (admin slots)
   ================================================================ */
.batch-bar {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + .6rem);
  left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff;
  border-radius: 30px; padding: .5rem 1rem;
  display: flex; align-items: center; gap: .75rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  z-index: 300; font-size: .85rem; font-weight: 600; white-space: nowrap;
  animation: batchBarIn .18s ease;
}
@keyframes batchBarIn { from { transform: translateX(-50%) translateY(20px); opacity: 0; } }
.batch-check {
  position: absolute; top: .3rem; right: .3rem; z-index: 10; display: none;
}
.batch-check input[type="checkbox"] { width: 17px; height: 17px; cursor: pointer; accent-color: var(--accent); }
body.batch-mode .batch-check { display: block; }
body.batch-mode .week-slot-card { user-select: none; }
body.batch-mode .week-slot-card:hover { box-shadow: 0 0 0 2px var(--accent); }
body.batch-mode .week-slot-card.batch-selected { box-shadow: 0 0 0 2px var(--accent); background: rgba(201,162,39,.1); }
.batch-sel-day { display: none; background: none; border: none; color: var(--muted); font-size: .78rem; padding: 0 .2rem; cursor: pointer; }
body.batch-mode .batch-sel-day { display: inline-flex; align-items: center; }

/* Elimina periodo card */
.epcard { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow-sm); }
.epcard-toggle { display:flex; align-items:center; width:100%; background:none; border:none; padding:.6rem .875rem; font-size:.82rem; font-weight:600; color:var(--text-2); cursor:pointer; gap:.35rem; }
.epcard-toggle:hover { background:var(--surface-hover); }
.epcard-toggle i.ep-chevron { margin-left:auto; transition:transform .2s; }
.epcard-toggle.open i.ep-chevron { transform: rotate(180deg); }

/* ================================================================
   AGENDA ADMIN — slot per giorno in riga orizzontale
   ================================================================ */
.slots-agenda { display:flex; flex-direction:column; gap:.4rem; }
.agenda-row { background:var(--surface); border-radius:var(--radius-sm); border:1px solid var(--border); overflow:hidden; }
.agenda-day-hd { display:flex; align-items:center; gap:.5rem; padding:.45rem .75rem; background:var(--primary); color:#fff; }
.agenda-day-hd--today { background:var(--accent); }
.agenda-day-hd--today .agenda-day-name,
.agenda-day-hd--today .agenda-day-date { color:var(--primary) !important; }
.agenda-day-info { flex:1; display:flex; align-items:baseline; gap:.45rem; }
.agenda-day-name { font-weight:800; font-size:.82rem; text-transform:uppercase; letter-spacing:.7px; color:#fff; }
.agenda-day-date { font-size:.75rem; opacity:.75; color:#fff; }
.agenda-day-cnt  { background:rgba(255,255,255,.2); border-radius:20px; font-size:.7rem; font-weight:700; padding:.1rem .55rem; color:#fff; white-space:nowrap; }
.agenda-sel-day  { background:transparent; border:none; color:rgba(255,255,255,.7); font-size:.9rem; padding:.1rem .3rem; cursor:pointer; border-radius:4px; line-height:1; }
.agenda-sel-day:hover { color:#fff; background:rgba(255,255,255,.15); }
body:not(.batch-mode) .agenda-sel-day { display:none; }
.agenda-slots-row { display:flex; gap:.5rem; padding:.55rem .6rem; overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch; }
.agenda-slots-row::-webkit-scrollbar { display:none; }
.agenda-day-empty { padding:.4rem .75rem; font-size:.73rem; color:var(--muted); }
/* Chip slot in agenda */
.asc { flex-shrink:0; width:162px; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden; cursor:pointer; position:relative; transition:border-color .15s, box-shadow .15s; display:flex; flex-direction:column; }
.asc:hover { border-color:var(--accent); box-shadow:0 2px 8px rgba(201,162,39,.15); }
.asc-strip { height:4px; }
.asc-body  { padding:.4rem .5rem .35rem; flex:1; display:flex; flex-direction:column; }
.asc-body .asc-fill-wrap { margin-top:auto; }
.asc-top   { display:flex; align-items:flex-start; justify-content:space-between; gap:.2rem; margin-bottom:.15rem; }
.asc-time  { font-size:.73rem; font-weight:700; color:var(--text); white-space:nowrap; }
.asc-bdg   { display:flex; gap:.15rem; flex-wrap:wrap; justify-content:flex-end; }
.asc-name  { font-size:.78rem; font-weight:600; color:var(--text); line-height:1.25; margin-bottom:.15rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.asc-coach { font-size:.63rem; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:.2rem; }
.asc-low   { font-size:.6rem; color:var(--warning-text); background:var(--warning-bg); border-radius:4px; padding:.05rem .3rem; margin-bottom:.2rem; display:inline-block; }
.asc-fill-wrap { height:3px; background:var(--border); border-radius:2px; overflow:hidden; margin-bottom:.15rem; }
.asc-fill-bar  { height:100%; border-radius:2px; transition:width .3s; }
.asc-cnt   { font-size:.68rem; color:var(--muted); font-weight:600; text-align:right; }
.asc .batch-check { position:absolute; top:3px; right:3px; z-index:1; }
body.batch-mode .asc { user-select:none; }
body.batch-mode .asc:hover { box-shadow:0 0 0 2px var(--accent); }
body.batch-mode .asc.batch-selected { box-shadow:0 0 0 2px var(--accent); background:rgba(201,162,39,.1); }

/* ================================================================
   FEED PRENOTAZIONI ATLETA — scroll verticale con sticky date
   ================================================================ */
.prenota-feed { display:flex; flex-direction:column; }
.feed-section  { }
.feed-day-hd   { position:sticky; top:var(--topbar-h); z-index:10; background:var(--primary); color:#fff;
                 padding:.42rem .75rem; display:flex; align-items:center; gap:.5rem; }
.feed-day-hd--today { background:var(--accent); }
.feed-day-hd--today .fday-label,
.feed-day-hd--today .fday-cnt { color:var(--primary); }
.fday-label { flex:1; font-size:.82rem; font-weight:700; color:#fff; }
.fday-cnt   { font-size:.65rem; background:rgba(255,255,255,.18); border-radius:20px; padding:.1rem .55rem; color:#fff; white-space:nowrap; }
.feed-day-hd--today .fday-cnt { background:rgba(0,0,0,.12); }
.feed-slots { display:flex; flex-direction:column; gap:.5rem; padding:.55rem .75rem; background:var(--bg); }
/* Card singola lezione */
.fsc { background:var(--surface); border-radius:var(--radius); border:2px solid var(--border); position:relative; overflow:hidden; transition:border-color .18s, background .18s; }
.fsc--booked  { border-color:#10b981; background:#f0fdf4; }
.fsc--riserva { border-color:#f59e0b; background:#fffbeb; }
.fsc--pieno   { opacity:.8; }
.fsc-strip    { position:absolute; top:0; left:0; bottom:0; width:4px; }
.fsc-content  { padding:.6rem .75rem .6rem .9rem; }
.fsc-row1 { display:flex; align-items:center; gap:.4rem; margin-bottom:.3rem; flex-wrap:wrap; }
.fsc-time { font-size:.8rem; font-weight:700; color:var(--text-2); white-space:nowrap; }
.fsc-name { font-size:.92rem; font-weight:700; color:var(--text); flex:1; }
.fsc-row2 { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; margin-bottom:.45rem; }
.fsc-spots { display:flex; align-items:center; gap:.25rem; font-size:.78rem; color:var(--muted); }
.fsc-spots-avail { font-weight:800; color:var(--text); font-size:.84rem; }
.fsc-spots-max   { color:var(--muted); }
.fsc-waitlist { font-size:.7rem; color:var(--warning-text); background:var(--warning-bg); border-radius:20px; padding:.1rem .55rem; display:inline-flex; align-items:center; gap:.2rem; white-space:nowrap; }
.fsc-coach { font-size:.7rem; color:var(--muted); }
.fsc-row3 { display:flex; align-items:center; justify-content:space-between; gap:.5rem; }
.fsc-status { display:flex; align-items:center; flex:1; min-width:0; }
.fsc-badge-booked { font-size:.72rem; font-weight:700; color:var(--success-text); background:var(--success-bg); border-radius:20px; padding:.15rem .65rem; display:inline-flex; align-items:center; gap:.3rem; white-space:nowrap; }
.fsc-badge-riserva { font-size:.72rem; font-weight:700; color:var(--warning-text); background:var(--warning-bg); border-radius:20px; padding:.15rem .65rem; display:inline-flex; align-items:center; gap:.3rem; white-space:nowrap; }
.fsc-action { flex-shrink:0; }

/* Bottoni azione uniformi nella pagina Prenota: stessa dimensione, colori diversi */
.btn-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  height: 44px;
  padding: .25rem .6rem;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.25;
  border-radius: var(--radius-sm, 8px);
  white-space: nowrap;
}
.btn-slot > i { margin-right: .25rem; }

/* ── PT Tipo Chips (slot_detail modal) ── */
.pren-chip {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 20px;
  padding: .2rem .7rem;
  font-size: .78rem;
  font-weight: 600;
  transition: .15s;
}
.pren-chip:hover { border-color: #8b5cf6; color: #8b5cf6; }
.pren-chip.active { background: rgba(139,92,246,.2); border-color: #8b5cf6; color: #8b5cf6; }

/* ================================================================
   MOBILE ADMIN — impaginazione generale su schermi piccoli (≤576px)
   ================================================================ */
@media (max-width: 576px) {

  /* ---- Contenitori e navbar ---- */
  .page-container { padding: .75rem .625rem; }
  .top-navbar { padding: 0 .625rem; }
  .top-navbar .brand {
    font-size: .95rem;
    max-width: 55vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ---- Niente overflow orizzontale ---- */
  .page-container img, .page-container video { max-width: 100%; height: auto; }
  .page-container .form-control,
  .page-container .form-select { max-width: 100% !important; min-width: 0; }
  /* Input data/numero con larghezza fissa inline: lasciali adattare */
  .page-container input[type="date"].form-control-sm,
  .page-container input[type="number"].form-control-sm { max-width: 100% !important; }

  /* Le righe flessibili vanno a capo invece di uscire dallo schermo
     (escluse le strisce a scorrimento orizzontale volute, es. chip date) */
  .page-container .d-flex { min-width: 0; }
  .page-container .d-flex:not(.flex-nowrap):not([style*="overflow-x"]) { flex-wrap: wrap; }

  /* ---- Tab (es. profilo atleta): scorrono invece di schiacciarsi ---- */
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tabs .nav-link { white-space: nowrap; font-size: .82rem; padding: .5rem .65rem; }

  /* ---- Tabelle: scorrimento orizzontale invece di rottura layout ---- */
  .page-container table.table,
  .page-container .table-app {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ---- Bottoni e barre azioni ---- */
  .action-bar .btn { flex: 1 1 auto; }
  .btn { white-space: normal; }

  /* ---- Modali a tutta larghezza utile ---- */
  .modal-dialog { margin: .5rem auto; max-width: calc(100vw - 1rem); }
  .modal-body { padding: 1rem .875rem; }
  .modal-footer { padding: .75rem .875rem; }

  /* ---- Card e hero più compatti ---- */
  .member-hero { padding: 1rem .875rem; }
  .stat-card { padding: .75rem .625rem; }
  .stat-val { font-size: 1.25rem; }
  .section-title { font-size: .95rem; }

  /* ---- Login ---- */
  .auth-wrap { padding: 1.5rem 1rem; }

  /* ---- Titoli scalati ---- */
  h1, .h1 { font-size: 1.35rem; }
  h2, .h2 { font-size: 1.15rem; }
  h5, .h5 { font-size: 1rem; }
}

/* ================================================================
   LISTA ABBONAMENTI — azioni allineate a destra
   Evita che Modifica venga spinta al centro dalla doppia .ms-auto.
   ================================================================ */
.abb-actions-row {
  width: 100%;
}
.abb-actions-row > .badge {
  margin-right: auto;
}
.abb-actions-row > .btn,
.abb-actions-row > .abb-count-switch {
  flex-shrink: 0;
}

@media (max-width: 576px) {
  .abb-actions-row {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .abb-actions-row::-webkit-scrollbar { display: none; }
  .abb-actions-row > .badge {
    flex: 1 1 auto;
    min-width: 0;
  }
}
