/* ==========================================================================
   La Musica LIVE — site.css (clean start)
   Desktop/Tablet: header, sidebar, footer fissi; scorre SOLO il main
   Mobile: sidebar off-canvas (drawer) con hamburger
   ========================================================================== */

/* Reset & base */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

html { -webkit-text-size-adjust: 100%; }
/* Previene il "viewport shrink-to-fit" che fa apparire la pagina come desktop
   su mobile quando un elemento sfora la larghezza della finestra. */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

/* Tokens */
:root {
  --H: 78px;   /* Header height */
  --F: 56px;   /* Footer height */
  --radius: 12px;
  --shadow: 0 10px 24px rgba(0,0,0,.20);

  /* Tema default: DARK */
  --bg: #121212;
  --bg-soft: #1a1a1a;
  --card: #171717;
  --text: #eaeaea;
  --muted: #9a9a9a;
  --line: #2a2a2a;
  --pill: #222;
  --pill-line: #333;
  --brand: #ff3b3b;
  --brand-2:#d92a2a;
}

/* Tema LIGHT */
[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f6f7f8;
  --card: #ffffff;
  --text: #121212;
  --muted: #555;
  --line: #e5e7eb;
  --pill: #f3f4f6;
  --pill-line: #e5e7eb;
  --brand: #9dd60f;
  --brand-2:#79b000;
}

/* Utilities */
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }

/* Row responsive: su mobile forza colonna singola se necessario */
@media (max-width: 640px) {
  .row.stack-mobile {
    flex-direction: column;
    align-items: stretch;
  }
}
.badge { display:inline-flex; align-items:center; gap:6px; border:1px solid var(--line); border-radius:999px; padding:4px 10px; font-size:.85rem; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* App Shell: 3 righe fisse (Header / Workarea / Footer) */
.app-shell{
  display: grid;
  grid-template-rows: var(--H) 1fr var(--F);
  height: 100vh;
  overflow: visible;      
  background: var(--bg);
}



/* Header (dashboard) */
.dash-header{
  display: grid;
  grid-template-columns: auto 1fr auto; /* hamburger | title | actions */
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: var(--H);
  background: var(--card);
  border-bottom: 1px solid var(--line);
}


/* Workarea (Sidebar + Main) */
.workarea{
  display: grid;
  grid-template-columns: 1fr 4fr;  /* 1/5 : 4/5 */
  gap: 0;
  overflow: hidden;                /* scroll solo nei figli */
  min-height: 0;                   /* important per overflow */
}

/* Sidebar: colonna sinistra (scroll interno) */
.sidebar{
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  padding: 14px;
  overflow: auto;
  min-width: 0;
}
.sb-nav{ display:flex; flex-direction:column; gap:6px; }
.nav-link{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:10px; border:1px solid transparent; color:var(--text);
}
.nav-link:hover{ background: var(--pill); border-color: var(--pill-line); text-decoration: none; }
.nav-link.active{ background: var(--brand); color:#111; border-color:var(--brand); font-weight:600; }
/* ✅ Ora è limitata alla sidebar */
.sidebar .nav-link.active {
  background: var(--brand);
  color: #111;
  border-color: var(--brand);
  font-weight: 600;
}

.nav-link .ico{ width:20px; text-align:center; }

/* Main: colonna destra (scroll) */
.main{ overflow:auto; padding:16px; min-width:0; }
.admin-wrap{ display:grid; gap:16px; }

body.dash .dash-footer {
  height: var(--ftr-h, 40px);
  flex: 0 0 var(--ftr-h, 40px);
  justify-content: center;
  background: var(--bg);
  color: var(--muted);
}


/* Componenti base */
.card{ background:var(--card); border:1px solid var(--line); border-radius: var(--radius); padding:16px; }
.content{ display:grid; gap:12px; }

/* Card responsive: su mobile riduce padding */
@media (max-width: 640px) {
  .card {
    padding: 12px;
    border-radius: 10px;
  }

  .content {
    gap: 10px;
  }
}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 14px; border-radius:10px; border:1px solid var(--line);
  background: var(--pill); color:var(--text); cursor:pointer; user-select:none; text-decoration:none;
}
.btn:hover{ background: var(--pill); border-color: var(--pill-line); }
.btn.small{ padding:6px 12px; font-size:.9rem; }
.btn.brand{ background: var(--brand); color:#111; border-color: var(--brand); }
.btn.brand:hover{ background: var(--brand-2); border-color: var(--brand-2); }
.btn.danger{ background:#d33; border-color:#a33; color:#fff; }
.btn.danger:hover{ background:#b22; }
.btn:disabled{ opacity:.6; cursor:not-allowed; }

/* Bottoni touch-friendly su mobile */
@media (max-width: 640px) {
  .btn {
    min-height: 44px;
    padding: 12px 16px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .btn.small {
    min-height: 36px;
    padding: 8px 12px;
  }
}

label{ display:block; font-weight:600; margin-bottom:6px; }
.input, select.input, .textarea, textarea{
  width:100%; padding:10px 12px; border-radius:10px;
  border:1px solid var(--line); background: var(--bg); color:var(--text);
}
textarea, .textarea{ resize: vertical; }

/* Date/time picker: color-scheme controlla i colori nativi del browser */
input[type="date"], input[type="time"], input[type="datetime-local"] { color-scheme: dark; }
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="time"],
[data-theme="light"] input[type="datetime-local"] { color-scheme: light; }

.form-grid{ display:grid; gap:12px; grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (max-width: 900px){ .form-grid{ grid-template-columns: 1fr; } }

/* Input touch-friendly su mobile */
@media (max-width: 640px) {
  .input, select.input, textarea {
    padding: 12px;
    font-size: 16px; /* Previene zoom automatico su iOS */
    min-height: 44px;
  }

  label {
    font-size: 0.95rem;
  }
}

.chips{ display:flex; gap:8px; flex-wrap:wrap; }
.chip, .chip-btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:6px 10px; border-radius:999px; border:1px solid var(--pill-line);
  background: var(--pill); cursor:pointer;
}
.chip-btn.active{ background: var(--brand); color:#111; border-color: var(--brand); }

.table{ width:100%; border-collapse:collapse; }
.table th, .table td{ padding:10px; border-bottom:1px solid var(--line); text-align:left; }
.table tr:hover{ background: var(--bg-soft); }

/* =========================================================
   TABELLE RESPONSIVE PER DASHBOARD
   Wrapper automatico per scroll orizzontale su mobile
   ========================================================= */

/* Wrapper responsive per tabelle */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0;
}

/* Su mobile: ottimizzazioni per tabelle */
@media (max-width: 768px) {
  /* Se una tabella non è wrappata, forziamo comportamento responsive */
  .card > .content > table.table,
  .content > table.table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .table th,
  .table td {
    padding: 8px 6px;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  /* Riduce padding su schermi molto piccoli */
  .table th:first-child,
  .table td:first-child {
    padding-left: 12px;
  }

  .table th:last-child,
  .table td:last-child {
    padding-right: 12px;
  }

  /* Stile per indicare che la tabella è scrollabile */
  .card > .content > table.table::after,
  .content > table.table::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to left, var(--card), transparent);
    pointer-events: none;
  }
}

/* Per schermi molto piccoli */
@media (max-width: 480px) {
  .table th,
  .table td {
    padding: 6px 4px;
    font-size: 0.85rem;
  }

  /* Rendi i bottoni nelle celle più compatti */
  .table .btn.small {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
}

/* =========================================================
   DASHBOARD RESPONSIVE - Header e layout
   ========================================================= */

@media (max-width: 640px) {
  /* Header dashboard più compatto */
  .dash-header h1 {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dash-header .btn {
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .dash-header {
    padding: 0 8px;
    gap: 8px;
  }

  /* Main dashboard con più spazio */
  .dash-main {
    padding: 12px 8px;
  }

  /* Titoli sezioni più compatti */
  .content h3,
  .content h4 {
    font-size: 1.1rem;
  }

  /* Azioni in header sezioni */
  .header-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
}


/* Helpers */
hr{ border:none; border-top:1px solid var(--line); margin:16px 0; }
img{ max-width:100%; height:auto; display:block; }

/* ========== Auth layout come nello screenshot ========== */
.auth-cols{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}
.auth-hero{
  border-radius: 16px;
  overflow: hidden;
  background: #000 center/cover no-repeat;
  min-height: 420px;
}
.auth-card{
  border-radius: 16px;
  padding: 16px;
  min-height: 420px;
}

/* Tabs “pill” Accedi/Registrati */
.tabs{ display:flex; gap:10px; margin-bottom:12px; }
.tab{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 14px; border-radius:999px;
  border:1px solid var(--line);
  background: var(--pill); color: var(--text);
  cursor:pointer; user-select:none;
}
.tab.active{ background: var(--brand); border-color: var(--brand); color:#fff; }
.tab:focus-visible{ outline:2px solid var(--brand); outline-offset:2px; }

/* Allineamento bottone a destra dentro il form */
.form-actions-right{ display:flex; justify-content:flex-end; }
@media (max-width: 980px){
  .auth-cols{ grid-template-columns: 1fr; }
  .auth-hero{ min-height: 260px; }
}

/* ===== Login solo — layout e componenti ===== */

/* Brand rosso */
:root { --brand:#ff3b3b; --brand-2:#d92a2a; }
.btn.brand{ background:var(--brand); color:#fff; border-color:var(--brand); }
.btn.brand:hover{ background:var(--brand-2); border-color:var(--brand-2); }

/* Griglia login 2 colonne */
.auth-grid{
  display:grid; grid-template-columns: 1fr 1fr; gap:16px; align-items:stretch;
}
.auth-hero{
  border:1px solid var(--line); border-radius:16px; overflow:hidden; min-height:420px;
}
.auth-hero img{ width:100%; height:100%; object-fit:cover; display:block; }
.auth-panel{ min-height:420px; }

/* Alert inline (password errata) */
.alert{ padding:10px 12px; border:1px solid var(--line); border-radius:10px; }
.alert.danger{ background: rgba(200,40,40,.12); border-color:#7a2a2a; color: var(--text); }

/* Popup (utente non trovato) */
.modal-backdrop{
  position:fixed; inset:0; background:rgba(0,0,0,.45); display:none; z-index:100;
}
.modal-backdrop.open{ display:block; }
.modal{
  background:var(--card); border:1px solid var(--line); border-radius:16px;
  width:min(520px,96vw); margin:10vh auto 0; padding:16px; box-shadow:0 10px 24px rgba(0,0,0,.3);
}
.modal .header{ border-bottom:1px solid var(--line); padding-bottom:8px; margin-bottom:12px; }

/* Modale flash "evento inviato" */
#flashModalBackdrop .modal {
  text-align: center;
  padding: 24px;
  animation: fadeIn .3s ease;
}

#flashModalBackdrop h3 {
  margin-top: 0;
  color: var(--brand);
}

#flashModalBackdrop p {
  color: var(--text);
  margin: 12px 0 20px;
  line-height: 1.4;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}


/* Responsive: una colonna in mobile */
@media (max-width: 980px){
  .auth-grid{ grid-template-columns: 1fr; }
  .auth-hero{ min-height:260px; }
  .auth-panel{ min-height:auto; }
}

/* === Modale Eventi === */
.eventi-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity .25s ease;
}
.eventi-backdrop.hidden {
  display: none !important;
  opacity: 0;
}
.eventi-modal {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  width: 90%;
  max-width: 500px;
}

/* === Modale Piani (band) === */
/* === Fix strutturale per la modale piani (centratura e overflow) === */

/* 1️⃣ — La modale principale viene allineata in alto SOLO per #plansModal */
#plansModal.modal {
  align-items: flex-start !important;   /* niente centratura verticale */
  justify-content: center !important;   /* ma resta centrata orizzontalmente */
  padding-top: 40px !important;
  padding-bottom: 40px !important;
}

/* 2️⃣ — Estensione reale e scroll */
#plansModal .modal-content {
  width: 95vw !important;
  max-width: 1400px !important;
  margin: 0 auto !important;
  border-radius: 14px !important;
  background: var(--card, #111);
  color: var(--text, #fff);
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25);
}

/* 3️⃣ — Corpo con griglia card */
#plansCards {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 32px !important;
  align-items: start !important;
  justify-items: stretch !important;
  margin-top: 16px !important;
}

/* Card styling */
#plansCards .pricing-card {
  background: var(--card, #1e1e1e);
  border: 2px solid var(--line, #333);
  border-radius: 12px;
  padding: 16px;
  transition: all .2s ease;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
#plansCards .pricing-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.4);
}

/* Evidenziato / selezionato */
#plansCards .pricing-card.highlight {
  border-color: var(--brand, #ff3b3b);
  box-shadow: 0 0 20px rgba(255,59,59,0.4);
}
#plansCards .pricing-card[data-selected="1"] {
  border-color: var(--brand, #ff3b3b);
  box-shadow: 0 0 24px rgba(255,59,59,0.6);
  transform: scale(1.02);
}

/* Header, body e footer interni */
.pc-head { text-align:center; margin-bottom:12px; }
.pc-title { font-size:1.3rem; margin:6px 0; }
.pc-price { font-size:1.1rem; color:var(--brand); }
.pc-body { font-size:0.9rem; color:var(--text); margin-top:8px; }
.pc-cta { text-align:center; margin-top:12px; }

/* Responsività */
@media (max-width: 1100px) {
  #plansCards { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 720px) {
  #plansCards { grid-template-columns: 1fr !important; }
}

/* Card disabilitata (FREE non disponibile) */
#plansCards .pricing-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(60%);
}
#plansCards .pricing-card.disabled:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
#plansCards .pricing-card.disabled .pc-choose {
  background: #666 !important;
  cursor: not-allowed;
}

/* Prezzo barrato e nuovo prezzo */
.pc-price .price-old {
  text-decoration: line-through !important;
  -webkit-text-decoration: line-through !important;
  color: var(--muted, #888) !important;
  font-size: 0.9em;
  margin-right: 8px;
  opacity: 0.7;
}
.pc-price .price-new {
  color: var(--success, #4CAF50) !important;
  font-weight: 700;
  font-size: 1.2em;
}

/* Messaggi informativi sopra le card */
.plans-info {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  text-align: center;
  font-size: 0.95rem;
}
.plans-info.discount-info {
  background: linear-gradient(135deg, rgba(76,175,80,0.15), rgba(139,195,74,0.15));
  border: 1px solid rgba(76,175,80,0.3);
  color: var(--success, #4CAF50);
}

/* Messaggio FREE disponibile nella card */
.free-available {
  margin-top: 10px;
  padding: 8px;
  background: rgba(76,175,80,0.15);
  border-radius: 6px;
  color: var(--success, #4CAF50);
  font-size: 0.85rem;
  text-align: center;
  font-weight: 600;
}

/* Messaggio FREE non disponibile nella card */
.free-unavailable {
  margin-top: 10px;
  padding: 8px;
  background: rgba(255,82,82,0.1);
  border-radius: 6px;
  color: var(--danger, #ff5252);
  font-size: 0.85rem;
  text-align: center;
}

/* Badge sconto per piano (dentro ogni card) */
.discount-badge {
  margin-top: 10px;
  padding: 8px;
  background: rgba(255,152,0,0.15);
  border-radius: 6px;
  color: #FF9800;
  font-size: 0.85rem;
  text-align: center;
  font-weight: 600;
}

/* --- Override totale modale piani --- */
body #plansModal.modal {
  align-items: flex-start !important;
  justify-content: center !important;
}

#plansModal .modal-content {
  max-width: 1400px !important;
  width: 95vw !important;
  margin: 40px auto !important;
}


/* === HOME: filtro pannello Regioni (espandibile) === */
.filter-panel {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
}
.filter-panel-inner { padding: 12px; }
#regionChips { display:flex; flex-wrap:wrap; gap:8px; }

/* chip-btn già presenti? Aggiungo variazione per attivo */
.chip-btn { padding:8px 12px; border-radius:999px; border:1px solid var(--pill-line); background:var(--pill); cursor:pointer; }
.chip-btn.active { background: var(--brand); border-color: var(--brand); color:#111; }

/* === HOME: griglia band === */
.band-grid {
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 16px;
}
@media (max-width: 1024px){ .band-grid{ grid-template-columns: repeat(2,1fr); } }
@media (max-width: 640px){ .band-grid{ grid-template-columns: 1fr; } }

.band-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  isolation: isolate;
  transition: transform .2s ease, box-shadow .2s ease;
}
.band-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
}
.band-card::after { /* spotlight */
  content:'';
  position:absolute; inset:-40% -40%;
  background: radial-gradient(200px 200px at var(--mx,60%) var(--my,40%), rgba(255,59,59,.18), transparent 60%);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
  z-index:0;
}
.band-card:hover::after { opacity: 1; }
.band-card-bg {
  position:absolute; inset:0; background-size:cover; background-position:center;
  filter: saturate(1.05) contrast(1.02) brightness(.9);
  transform: scale(1.05);
  z-index:0;
}
.band-card-body {
  position:relative; z-index:1;
  backdrop-filter: blur(0px);
  background: linear-gradient(to bottom, rgba(0,0,0,.35), rgba(0,0,0,.75));
  color:#fff;
  padding:14px;
  min-height: 180px;
  display:flex; flex-direction:column; justify-content:space-between;
}
.band-card-top { display:flex; gap:12px; align-items:center; }
.band-avatar {
  width:64px; height:64px; border-radius:12px; object-fit:cover; border:1px solid rgba(255,255,255,.25);
}
.band-meta { min-width:0; }
.band-name { margin:0; font-size:1.1rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pill {
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px; border-radius:999px; font-size:.85rem;
  border:1px solid rgba(255,255,255,.25); background:rgba(0,0,0,.25);
}
.pill.has-events { border-color: #26a69a; color:#e8fffb; }
.pill.plan-free { border-color:#777; color:#ddd; }
.pill.plan-pro  { border-color:#2196f3; color:#e3f2fd; }
.pill.plan-star { border-color:#ffc107; color:#fff4cc; }

.band-card-actions { margin-top:12px; display:flex; justify-content:flex-end; }

/* cursor spotlight follow */
.band-card { --mx:50%; --my:50%; }
.band-card:hover {
  /* per JS che aggiorna --mx e --my su mousemove (opzionale) */
}


/* --- Fix footer che copre i contenuti --- */

/* Il main deve essere l'unico a scorrere */
.main{
  overflow: auto;              /* ripristina lo scroll interno */
  padding-bottom: calc(var(--F) + 16px);  /* spazio di sicurezza sotto i contenuti */
}

/* Il footer resta ancorato al fondo dell'area visibile del main */
.dash-footer{
  position: sticky;
  bottom: 0;
  z-index: 10;                 /* sopra a eventuali ombre delle card */
}


.btn.yellow {
  background-color: #ffcc00;      /* giallo acceso */
  color: #111;
  border: 1px solid #e6b800;      /* leggermente più scuro per contrasto */
  font-weight: 600;
  transition: all .2s ease-in-out;
}

.btn.yellow:hover {
  background-color: #ffdb4d;
  border-color: #e6b800;
  color: #000;
  transform: translateY(-1px);
}

/* Card Eventi */
.event-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .2s ease;
}
.event-card:hover { transform: translateY(-2px); }

.event-cover {
  height: 180px;
  background-size: cover;
  background-position: center;
}

.event-body { padding: 1rem; }

.event-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: .25rem;
}

.event-date, .event-location {
  color: var(--muted);
  font-size: .9rem;
}

.event-type.chip {
  background: var(--brand);
  color: #fff;
  font-size: .8rem;
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  margin-top: .5rem;
}


#mapConfirmCanvas {
  width: 100%;
  height: 400px;
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(0,0,0,0.2);
}
#mapConfirmModal .modal-content {
  background-color: var(--card, #fff);
  color: var(--text, #111);
  border-radius: 14px;
  border: 1px solid var(--line, #ddd);
}
@media (prefers-color-scheme: dark) {
  #mapConfirmModal .modal-content {
    background-color: #1e1e1e;
    color: #eee;
    border-color: #333;
  }
}

@media (min-width: 981px) {
  .dash-sidebar {
    transform: none !important;
    position: static !important;
    z-index: auto !important;
  }
  body.menu-open .dash-sidebar {
    transform: none !important;
  }
}

/* ============================================================
   🧱 FIX COMPLETO — GHOST TRANSFORM / CARD INVISIBILE
   ============================================================ */

/* 1️⃣ — App Shell: impedisce che le animazioni sidebar
      spingano fuori il contenuto principale */
.app-shell {
  overflow: hidden !important;
}

/* 2️⃣ — Resetta ogni transform o translate attivo
      su body, dash-body, main e card principale */
.dash-body,
.dash-main,
#main,
#main > section.content.card {
  position: relative !important;
  transform: none !important;
  translate: none !important;
  left: 0 !important;
  right: 0 !important;
  top: auto !important;
  bottom: auto !important;
  z-index: auto !important;
  animation: none !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* 3️⃣ — Quando il layout è in modalità desktop,
      forziamo l’assetto statico di sidebar e main */
@media (min-width: 981px) {
  .dash-sidebar {
    position: static !important;
    transform: none !important;
    z-index: auto !important;
  }

  .dash-main,
  #main {
    position: relative !important;
    transform: none !important;
    translate: none !important;
    z-index: auto !important;
    left: 0 !important;
    right: 0 !important;
  }

  body.menu-open .dash-sidebar {
    transform: none !important;
  }
}

/* 4️⃣ — Footer sempre visibile, senza coprire contenuti */
.dash-footer {
  position: sticky !important;
  bottom: 0 !important;
  transform: none !important;
  z-index: 5 !important;
}


/* ==========================================
   FIX layout dashboard: sidebar + main
   ========================================== */
.dash-body {
  display: grid;
  grid-template-columns: 280px 1fr; /* sidebar | contenuto */
  min-height: calc(100vh - var(--H) - var(--F));
}

  .dash-sidebar {
    position: fixed;
    top: var(--H);
    bottom: var(--F);
    left: 0;
    width: var(--sidebar-w);   /* <= 50vw */
    max-width: 50vw;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 120;
    box-shadow: 4px 0 18px rgba(0,0,0,.4);
  }

.dash-main {
  overflow-y: auto;
  padding: 16px;
}

/* In mobile: sidebar a scomparsa */
@media (max-width: 980px) {
  .dash-body {
    display: block;
  }
}


.badge.alert {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--brand, #ff3b3b);
  color: #fff;
}

/*/* ===========================
   NEWS — CARD STILE BIKERZ
   =========================== */

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
}

.news-card {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: all .25s ease;
}

.news-card:hover {
    border-color: var(--brand);
    transform: translateY(-3px);
    box-shadow: 0 0 10px #000a;
}

/* Immagine in alto */
.news-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

/* Corpo */
.news-info {
    padding: 12px 14px 16px;
}

.news-date {
    font-size: .82rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.news-title {
    font-size: 1.1rem;
    margin: 0 0 6px;
    font-weight: 600;
    line-height: 1.3;
}

.news-sub {
    font-size: .9rem;
    margin: 0;
    color: var(--muted);
}

/* --- NEWS MOBILE: scorrimento orizzontale --- */
@media (max-width: 768px) {
    .news-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 14px;
        padding-bottom: 10px;
    }
    .news-grid::-webkit-scrollbar { height: 4px; }
    .news-grid::-webkit-scrollbar-track { background: transparent; }
    .news-grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

    .news-grid .news-card {
        flex: 0 0 200px;
        min-width: 200px;
        scroll-snap-align: start;
        border-radius: 12px;
    }
    .news-grid .news-card img {
        height: 120px;
    }
    .news-grid .news-card .news-info {
        padding: 8px 10px 12px;
    }
    .news-grid .news-card .news-title {
        font-size: .95rem;
    }
    .news-grid .news-card .news-sub {
        font-size: .8rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .news-grid .news-card .news-date {
        font-size: .75rem;
    }
}


/* ================================
   LAYOUT 90% / 10%
================================ */
.band-layout {
    display: grid;
    grid-template-columns: 85% 15%;
    gap: 30px;
    align-items: start;
}

/* Sidebar news */
.band-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 20px;
}

/* CARD NEWS IDENTICA A INDEX */
.band-sidebar .news-card {
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: .25s ease;
}

.band-sidebar .news-card:hover {
    border-color: var(--brand);
    transform: translateY(-3px);
    box-shadow: 0 0 10px #0004;
}

.band-sidebar .news-card .img {
    width: 100%;
    height: 150px; /* più piccola per sidebar */
    background-size: cover;
    background-position: center;
}

.band-sidebar .news-card .body {
    padding: 12px;
}

.band-sidebar .news-card .body h3 {
    margin: 0 0 6px 0;
    font-size: 1rem;
}

.band-sidebar .news-card .body p {
    margin: 0;
    font-size: .85rem;
    color: var(--muted);
}

/* MOBILE: sidebar sotto */
@media(max-width: 900px){
    .band-layout {
        grid-template-columns: 1fr;
    }
    .band-sidebar {
        position: static;
        margin-top: 30px;
    }
}


/* ====== LAYOUT 85/15 PER EVENTO ====== */
.evento-full-layout {
    display: grid;
    grid-template-columns: 85% 15%;
    gap: 30px;
    align-items: start;
}

/* Sidebar news */
.event-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 20px;
}

/* Card news identica alla home */
.event-sidebar .news-card {
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: .25s ease;
}

.event-sidebar .news-card:hover {
    border-color: var(--brand);
    transform: translateY(-3px);
    box-shadow: 0 0 10px #0004;
}

.event-sidebar .news-card .img {
    width: 100%;
    height: 150px;
    background-size: cover;
    background-position: center;
}

.event-sidebar .news-card .body {
    padding: 12px;
}

.event-sidebar .news-card .body h3 {
    margin: 0 0 6px 0;
    font-size: 1rem;
}

.event-sidebar .news-card .body p {
    margin: 0;
    font-size: .85rem;
    color: var(--muted);
}

/* Mobile → sidebar va sotto */
@media(max-width: 900px){
    .evento-full-layout {
        grid-template-columns: 1fr;
    }
    .event-sidebar {
        position: static;
        margin-top: 30px;
    }
}


.event-sidebar h3.hd {
    font-family: "Oswald", Inter, sans-serif;
    letter-spacing: .3px;
}


/* =========================
   IMCHAT — STILE DEFINITIVO
   ========================= */

#imchat-root{
  height: calc(100vh - 120px);
  min-height: 580px;
  display:flex;
  flex-direction:column;
  background:#0f0f0f;
  border-radius:18px;
  overflow:hidden;
}

#imchat-root .imchat-inner{
  flex:1;
  min-height:0;
  padding:16px 18px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

#imchat-root .imchat-layout{
  flex:1;
  display:grid;
  grid-template-columns:300px 1fr;
  border:1px solid var(--line);
  border-radius:16px;
  overflow:hidden;
}

#imchat-root .imchat-sidebar{
  background:#161616;
  overflow-y:auto;
  border-right:1px solid #2a2a2a;
}

#imchat-root .imchat-item{
  padding:14px 16px;
  border-bottom:1px solid rgba(255,255,255,.05);
  cursor:pointer;
}

#imchat-root .imchat-item.is-active{
  background:#262626;
}

#imchat-root .imchat-main{
  display:flex;
  flex-direction:column;
  background:#0d0d0d;
}

#imchat-root .imchat-messages{
  flex:1;
  overflow-y:auto;
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

#imchat-root .imchat-bubble{
  max-width:70%;
  padding:11px 16px;
  border-radius:18px;
  font-size:14px;
}

#imchat-root .imchat-bubble.user{
  align-self:flex-start;
  background:#2a2a2a;
}

#imchat-root .imchat-bubble.band{
  align-self:flex-end;
  background:linear-gradient(135deg,#ff3b3b,#e10600);
  color:#fff;
}

#imchat-root .imchat-input-bar{
  display:flex;
  gap:10px;
  padding:12px;
  border-top:1px solid var(--line);
  background:#111;
}

#imchat-root textarea{
  flex:1;
  background:#1a1a1a;
  color:#fff;
  border-radius:12px;
  padding:10px;
}

/* =========================================================
   IMCHAT — OVERRIDE COMPLETO TEMA LIGHT
   ========================================================= */

[data-theme="light"] #imchat-root {
  background: #ffffff;
  color: #121212;
  border: 1px solid #e5e7eb;
}

[data-theme="light"] #imchat-root .imchat-inner {
  background: linear-gradient(180deg, #ffffff, #f4f5f7);
  color: #121212;
}

[data-theme="light"] #imchat-root .imchat-layout {
  background: #ffffff;
  border-color: #e5e7eb;
}

[data-theme="light"] #imchat-root .imchat-sidebar {
  background: #f6f7f8;
  border-right: 1px solid #e5e7eb;
}

[data-theme="light"] #imchat-root .imchat-item {
  background: transparent;
  color: #121212;
  border-bottom: 1px solid #e5e7eb;
}

[data-theme="light"] #imchat-root .imchat-item:hover {
  background: #eceff3;
}

[data-theme="light"] #imchat-root .imchat-item.is-active {
  background: #e6f4ea;
}

[data-theme="light"] #imchat-root .imchat-item-preview {
  color: #555;
}

[data-theme="light"] #imchat-root .imchat-main {
  background: #ffffff;
}

[data-theme="light"] #imchat-root .imchat-header {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  color: #121212;
}

[data-theme="light"] #imchat-root .imchat-messages {
  background: #ffffff;
}

[data-theme="light"] #imchat-root .imchat-bubble.user {
  background: #f1f5f9;
  color: #121212;
}

[data-theme="light"] #imchat-root .imchat-bubble.band {
  background: linear-gradient(135deg, #9dd60f, #79b000);
  color: #111;
}

[data-theme="light"] #imchat-root .imchat-input-bar {
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

[data-theme="light"] #imchat-root textarea {
  background: #ffffff;
  color: #121212;
  border: 1px solid #d1d5db;
}

[data-theme="light"] #imchat-root textarea::placeholder {
  color: #888;
}

[data-theme="light"] #imchat-root .imchat-plan-badge {
  background: #e6f4ea;
  color: #111;
}

[data-theme="light"] #imchat-root .imchat-locked {
  background: #fff4e5;
  border-top: 1px solid #ffd89b;
  color: #111;
}

/* =========================================================
   IMCHAT — MOBILE RESPONSIVE
   ========================================================= */

#imchat-root .imchat-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
#imchat-root .imchat-title{
  margin:0;
  font-size:18px;
}
#imchat-root .imchat-plan-badge{
  font-size:12px;
  padding:4px 10px;
  border-radius:20px;
  background:rgba(255,255,255,.08);
}
#imchat-root .imchat-header{
  padding:12px 16px;
  font-weight:600;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  gap:10px;
}
#imchat-root .imchat-back{
  display:none; /* visibile solo su mobile */
  background:none;
  border:none;
  color:var(--text);
  font-size:18px;
  cursor:pointer;
  padding:4px 8px;
  border-radius:8px;
}
#imchat-root .imchat-back:hover{
  background:rgba(255,255,255,.1);
}
#imchat-root .imchat-item-name{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-weight:600;
  font-size:14px;
}
#imchat-root .imchat-item-preview{
  font-size:13px;
  opacity:.6;
  margin-top:4px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
#imchat-root .imchat-item-badge{
  background:#e10600;
  color:#fff;
  font-size:11px;
  min-width:20px;
  height:20px;
  border-radius:20px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0 6px;
}
#imchat-root .imchat-locked{
  padding:16px;
  text-align:center;
  border-top:1px solid var(--line);
  background:rgba(255,200,0,.08);
}

@media (max-width:980px){
  /* la dash-main toglie padding quando contiene la chat */
  .dash-main:has(#imchat-root),
  .dash-main.has-imchat{
    padding:0 !important;
    height:calc(100vh - var(--hdr-h, 64px) - var(--ftr-h, 40px)) !important;
    overflow:hidden !important;
  }
  #imchat-root{
    height:100%;
    min-height:0;
    border-radius:0;
  }
  #imchat-root .imchat-inner{
    padding:10px;
    gap:8px;
  }
  #imchat-root .imchat-title{
    font-size:15px;
  }
  #imchat-root .imchat-layout{
    grid-template-columns:1fr;
    position:relative;
  }
  /* di default su mobile: sidebar visibile, chat nascosta */
  #imchat-root .imchat-sidebar{
    display:block;
  }
  #imchat-root .imchat-main{
    display:none;
  }
  /* quando si apre una conversazione */
  #imchat-root.imchat-chat-open .imchat-sidebar{
    display:none;
  }
  #imchat-root.imchat-chat-open .imchat-main{
    display:flex;
  }
  #imchat-root .imchat-back{
    display:inline-flex;
  }
  #imchat-root .imchat-bubble{
    max-width:85%;
  }
  #imchat-root .imchat-messages{
    padding:12px;
  }
  #imchat-root .imchat-input-bar{
    padding:8px;
    gap:8px;
  }
  #imchat-root textarea{
    font-size:16px; /* evita zoom iOS */
  }
}

/* =========================================================
   MODALI PROFILO — TERMINI / MARKETING / NEWSLETTER
   ========================================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  z-index: 10000; /* sopra tutto */
  padding: 24px 12px;
}

.modal-backdrop.open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
}

/* Contenitore modale */
.modal-backdrop .modal {
  width: 100%;
  max-width: 820px;     /* larghezza lettura */
  margin-top: 6vh;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
  animation: modalFadeIn .25s ease;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

/* Header fisso */
.modal-backdrop .modal .header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 2;
  border-radius: 16px 16px 0 0;
}

/* Corpo scrollabile */
.modal-backdrop .modal .content {
  padding: 16px;
  overflow-y: auto;
}

/* iframe interno (termini, marketing, newsletter) */
.modal-backdrop iframe {
  width: 100%;
  height: 60vh;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
}

/* Bottone chiudi */
.modal-backdrop .btn.small {
  background: var(--pill);
}

/* Animazione */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* === DARK/LIGHT già automaticamente gestiti dai token === */


/* === Override larghezza modali profilo (termini / marketing / newsletter) === */

#genericModalBackdrop .modal,
#imageModalBackdrop .modal {
  width: min(960px, 96vw);   /* più larga, ma sempre responsive */
  max-width: 960px;
}

#intro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

#intro-video {
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  border-radius: 12px;
}


.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-box {
  background: var(--card);
  color: var(--text);
  padding: 24px;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}

/* =========================================================
   FIX TOKEN MANCANTI PER EVENTI (LIGHT + DARK)
   ========================================================= */

/* Token generici mancanti */
:root {
  --bg2: #222;          /* superfici secondarie DARK */
  --paper: var(--card);
  --surface: var(--card);
}

/* Override LIGHT */
[data-theme="light"] {
  --bg2: #f1f3f5;       /* grigio chiarissimo */
  --paper: #ffffff;
  --surface: #ffffff;
}


.media-empty {
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 10px;
}

/* =========================================================
   MODALI INFORMATIVE PAGINA (page-modal.js)
   Fix per visualizzazione su mobile
   ========================================================= */

#pageModal {
  /* Assicura che la modale sia sempre visibile */
  display: flex !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Media query per schermi piccoli (smartphone) */
@media (max-width: 768px) {
  #pageModal {
    padding: 8px !important;
    align-items: flex-start !important;
  }

  #pageModal > div {
    width: 100% !important;
    max-width: 100% !important;
    margin: 20px auto !important;
    padding: 20px 16px !important;
    max-height: 90vh !important;
  }

  #pageModal h2 {
    font-size: 1.3rem !important;
    padding-right: 50px !important;
  }

  #pageModal button {
    min-height: 44px !important;
    min-width: 44px !important;
  }
}

/* Per dispositivi molto piccoli */
@media (max-width: 480px) {
  #pageModal {
    padding: 4px !important;
  }

  #pageModal > div {
    border-radius: 8px !important;
    padding: 16px 12px !important;
  }

  #pageModal h2 {
    font-size: 1.1rem !important;
  }
}

/* ==========================================================================
   MODALE COLLABORATORI
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal .modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  cursor: pointer;
}

.modal .modal-content {
  position: relative;
  background: var(--card);
  color: var(--text);
  padding: 0;
  border-radius: 12px;
  width: calc(100% - 32px);
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
}

.modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal .modal-header h4 {
  margin: 0;
  font-size: 1.1rem;
}

.modal .modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0;
}

.modal .modal-close:hover {
  color: var(--text);
}

.modal .modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Badge small */
.badge.small {
  font-size: 0.7rem;
  padding: 2px 6px;
}

.badge.small.muted {
  background: var(--line);
  color: var(--muted);
}

/* ═════════════════════════════════════════════════════════════════
   RESPONSIVE CARD TABLE (opt-in utility)
   Avvolgere una <table class="table"> in <div class="responsive-card-table">
   per trasformarla in layout a card su viewport ≤800px.
   Ogni <td> dati deve avere data-label="..." (etichetta mostrata).
   Il <td> con i pulsanti azione deve avere class="col-actions".
   Desktop (>800px): zero effetto. ═══════════════════════════════════ */
@media (max-width: 800px) {
    .responsive-card-table { overflow: visible !important; }
    .responsive-card-table table.table { display: block; width: 100%; }
    .responsive-card-table table.table thead { display: none; }
    .responsive-card-table table.table tbody { display: block; }

    .responsive-card-table table.table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 10px;
        padding: 10px 12px;
        margin-bottom: 10px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: var(--bg);
    }
    .responsive-card-table table.table tbody td {
        display: block;
        padding: 2px 0;
        border: none;
        text-align: left !important;
        white-space: normal !important;
    }
    .responsive-card-table table.table tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: .68rem;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: .5px;
        font-weight: 600;
        margin-bottom: 2px;
    }
    .responsive-card-table table.table tbody td.col-actions {
        grid-column: 1 / -1;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 6px;
        padding-top: 8px;
        border-top: 1px solid var(--line);
    }
    .responsive-card-table table.table tbody td.col-actions .btn,
    .responsive-card-table table.table tbody td.col-actions a.btn {
        flex: 1 1 auto;
        min-width: 0;
    }
}










