/* Stili personalizzati – Yuki Associazione Web App */

/* ─── Palette ufficiale Yuki ─── */
:root {
  --yuki-rosa:     #f2d4d7;   /* Rosa Yuki */
  --yuki-blue:     #203440;   /* Blu Petrolio Yuki */
  --yuki-red:      #f23d3d;   /* Rosso Yuki */
  --yuki-gray:     #f2f2f2;   /* Grigio Chiaro Yuki */

  /* Alias usati nell'app — Tema SCURO (default) */
  --dojo-dark:     #0e1a22;
  --dojo-card:     #162028;
  --dojo-accent:   var(--yuki-red);
  --dojo-presente: #10b981;
  --dojo-assente:  var(--yuki-red);
  --dojo-border:   #2e4455;
  --dojo-text:     #f8fafc;
  --dojo-muted:    #94a3b8;
  --dojo-header:   #1a2e3e;
  --dojo-input-bg: #1e2f3d;
  --dojo-nav-bg:   var(--yuki-blue);
}

/* ─── Tema CHIARO ─── */
body.theme-light {
  --dojo-dark:     #f0f4f8;
  --dojo-card:     #ffffff;
  --dojo-border:   #cbd5e1;
  --dojo-text:     #0f172a;
  --dojo-muted:    #475569;
  --dojo-header:   #e2e8f0;
  --dojo-input-bg: #f8fafc;
  --dojo-nav-bg:   #ffffff;   /* navbar chiara nel tema chiaro */
}

/* Header (top bar) nel tema chiaro: sfondo bianco/chiaro limpido, testi e icone nitidi */
body.theme-light header {
  background-color: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
}
body.theme-light header h1,
body.theme-light header .text-white {
  color: #0f172a !important;
}
body.theme-light header .text-slate-200,
body.theme-light header #user-name {
  color: #1e293b !important;
}
body.theme-light header .text-slate-400,
body.theme-light header #user-role-badge {
  color: #64748b !important;
}
/* Selettori istruttore / sede nella navbar */
body.theme-light header .bg-slate-800\/90,
body.theme-light header .bg-slate-800 {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}
body.theme-light header select {
  background-color: transparent !important;
  color: #0f172a !important;
}
body.theme-light header select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}
/* Bottoni e controlli header */
body.theme-light header button {
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}
body.theme-light header button:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}
body.theme-light #btn-logout:hover {
  color: #e11d48 !important;
  background-color: #ffe4e6 !important;
}
/* Badge "Live" o badge ruolo nella barra */
body.theme-light #mode-badge {
  background-color: #dcfce7 !important;
  color: #15803d !important;
  border-color: #86efac !important;
}

/* Sfondo e testo base nel tema chiaro */
body.theme-light {
  background-color: var(--dojo-dark);
  color: var(--dojo-text);
}

/* Card e pannelli nel tema chiaro */
body.theme-light .bg-slate-900,
body.theme-light .bg-slate-950,
body.theme-light [class*="bg-slate-900"] {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}
body.theme-light .bg-slate-800,
body.theme-light [class*="bg-slate-800"] {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}
body.theme-light .bg-slate-700,
body.theme-light [class*="bg-slate-700"] {
  background-color: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
}

/* Testi nel tema chiaro */
body.theme-light .text-white   { color: #0f172a !important; }
body.theme-light .text-slate-100,
body.theme-light .text-slate-200,
body.theme-light .text-slate-300 { color: #1e293b !important; }
body.theme-light .text-slate-400 { color: #475569 !important; }
body.theme-light .text-slate-500 { color: #64748b !important; }

/* Bordi nel tema chiaro */
body.theme-light .border-slate-700,
body.theme-light .border-slate-800 { border-color: #cbd5e1 !important; }

/* Input nel tema chiaro */
body.theme-light input,
body.theme-light select,
body.theme-light textarea {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* Sticky columns tabella presenze nel tema chiaro */
body.theme-light .attendance-table th.sticky-col,
body.theme-light .attendance-table td.sticky-col,
body.theme-light .attendance-table th.sticky-col-2,
body.theme-light .attendance-table td.sticky-col-2 {
  background-color: #ffffff;
}
body.theme-light .attendance-table thead th.sticky-col,
body.theme-light .attendance-table thead th.sticky-col-2 {
  background-color: #e2e8f0;
}

/* Scrollbar nel tema chiaro */
body.theme-light ::-webkit-scrollbar-track { background: #e2e8f0; }
body.theme-light ::-webkit-scrollbar-thumb { background: #94a3b8; }
body.theme-light ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Toast nel tema chiaro */
body.theme-light .toast {
  background-color: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  color: #0f172a;
}

/* Sidebar mobile — rimane scura in entrambi i temi per coerenza con navbar */


/* Base resets & typography */
body {
  background-color: var(--dojo-dark);
  color: var(--dojo-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Touch targets (mobile/tablet) ─── */
.touch-btn {
  min-height: 48px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  user-select: none;
}

/* ─── Bottoni presenze P / A ─── */
.btn-presence {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 44px;
  min-height: 44px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 640px) {
  /* Su mobile i pulsanti P/A sono più grandi per il tocco */
  .btn-presence {
    min-width: 52px;
    min-height: 52px;
    font-size: 1rem;
  }
}

.btn-presence:active {
  transform: scale(0.92);
}

.btn-presence.is-p {
  background-color: #10b981 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.btn-presence.is-a {
  background-color: var(--yuki-red) !important;
  border-color: #d62e2e !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(242, 61, 61, 0.4);
}

/* ─── Tabella presenze con sticky columns ─── */
.attendance-table th,
.attendance-table td {
  white-space: nowrap;
}

/* Colonna 1: Cognome */
.attendance-table th.sticky-col,
.attendance-table td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: var(--dojo-card);
  border-right: 1px solid var(--dojo-border);
  min-width: 120px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Colonna 2: Nome */
.attendance-table th.sticky-col-2,
.attendance-table td.sticky-col-2 {
  position: sticky;
  left: 120px;
  z-index: 10;
  background-color: var(--dojo-card);
  border-right: 1px solid var(--dojo-border);
  min-width: 110px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Intestazioni sticky: z-index più alto */
.attendance-table thead th.sticky-col,
.attendance-table thead th.sticky-col-2 {
  z-index: 20;
  background-color: #1a2e3e;
}

/* ─── Scrollbar personalizzata ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--dojo-dark); }
::-webkit-scrollbar-thumb { background: #2e4455; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3d5a6e; }

/* ─── Animazioni ─── */
@keyframes pulse-success {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.animate-pop { animation: pulse-success 0.25s ease-in-out; }

/* ─── Gradi delle cinture ─── */
.belt-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.belt-bianca   { background-color: #f1f5f9; color: #0f172a; }
.belt-gialla   { background-color: #fef08a; color: #854d0e; }
.belt-arancione{ background-color: #fed7aa; color: #9a3412; }
.belt-verde    { background-color: #bbf7d0; color: #166534; }
.belt-blu      { background-color: #bfdbfe; color: #1e40af; }
.belt-marrone  { background-color: #d6b896; color: #432818; }
.belt-nera     { background-color: #18181b; color: #f4f4f5; border: 1px solid #52525b; }
.belt-default  { background-color: #334155; color: #cbd5e1; }

/* ─── Toast Notifications ─── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 90vw;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 280px;
  padding: 12px 16px;
  border-radius: 8px;
  background-color: var(--dojo-card);
  border-left: 4px solid #3b82f6;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  animation: slide-in 0.2s ease-out;
}
.toast-success { border-left-color: #10b981; }
.toast-error   { border-left-color: var(--yuki-red); }
.toast-warning { border-left-color: #f59e0b; }

@keyframes slide-in {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ─── Hamburger Menu / Mobile Sidebar ─── */
#mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 40;
  backdrop-filter: blur(2px);
}
#mobile-menu-overlay.open { display: block; }

#mobile-sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: var(--yuki-blue);
  z-index: 50;
  transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0,0,0,0.5);
}
#mobile-sidebar.open { left: 0; }

#mobile-sidebar .sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

#mobile-sidebar .sidebar-section {
  padding: 14px 16px 8px;
}
#mobile-sidebar .sidebar-section label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--yuki-rosa);
  margin-bottom: 6px;
  opacity: 0.8;
}
#mobile-sidebar select {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  padding: 10px 12px;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}
#mobile-sidebar .sidebar-user {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hamburger: sempre visibile (sidebar contiene selettori su mobile) */
#btn-hamburger { display: flex; }

/* ═══════════════════════════════════════════
   HUB VIEW – Schermata centrale bilanciata (senza scroll)
   ═══════════════════════════════════════════ */

#view-hub {
  max-width: 480px;
  margin: auto;
  padding: 1rem 1rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: calc(100dvh - 56px - 64px);
}

#view-hub.hidden,
#view-attendance.hidden,
#view-events.hidden,
#view-projects.hidden,
#view-redazione.hidden {
  display: none !important;
}

#hub-cards-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.hub-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 1.25rem 0.75rem;
  background: #162028;
  border: 1.5px solid rgba(46, 68, 85, 0.9);
  border-radius: 16px; /* rounded-2xl */
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.2s ease;
  text-decoration: none;
  color: inherit;
  width: 100%;
  aspect-ratio: 1 / 0.92;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.hub-card:hover {
  transform: translateY(-2px);
}

.hub-card:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

.hub-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.hub-card:hover .hub-card-icon {
  transform: scale(1.06);
}

/* Colori icone e bordi tint per modulo */
.hub-card-icon.attendance { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.hub-card-icon.events     { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.hub-card-icon.projects   { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.hub-card-icon.redazione  { background: rgba(236, 72, 153, 0.15); color: #f472b6; }

/* Bordi tint per modulo (stato default) */
.hub-card[data-module="attendance"] { border-color: rgba(16, 185, 129, 0.25); }
.hub-card[data-module="events"]     { border-color: rgba(99, 102, 241, 0.25); }
.hub-card[data-module="projects"]   { border-color: rgba(245, 158, 11, 0.25); }
.hub-card[data-module="redazione"]  { border-color: rgba(236, 72, 153, 0.25); }

.hub-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.015em;
  transition: color 0.2s ease;
}

/* Hover: bordo e ombra colorati */
.hub-card[data-module="attendance"]:hover {
  border-color: rgba(16, 185, 129, 0.7);
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.2);
}
.hub-card[data-module="attendance"]:hover .hub-card-title { color: #34d399; }

.hub-card[data-module="events"]:hover {
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.2);
}
.hub-card[data-module="events"]:hover .hub-card-title { color: #a5b4fc; }

.hub-card[data-module="projects"]:hover {
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: 0 10px 28px rgba(245, 158, 11, 0.2);
}
.hub-card[data-module="projects"]:hover .hub-card-title { color: #fbbf24; }

.hub-card[data-module="redazione"]:hover {
  border-color: rgba(236, 72, 153, 0.7);
  box-shadow: 0 10px 28px rgba(236, 72, 153, 0.2);
}
.hub-card[data-module="redazione"]:hover .hub-card-title { color: #f9a8d4; }

.hub-card.disabled {
  opacity: 0.4;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
  border-color: rgba(46, 68, 85, 0.9) !important;
}

body.theme-light .hub-card {
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
body.theme-light .hub-card-title { color: #0f172a; }

.yuki-logo-box {
  background-color: #ffffff !important;
  border: 2px solid var(--yuki-red);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.yuki-logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ═══════════════════════════════════════════
   PWA: STILI D'INSTALLAZIONE & ADATTAMENTO MOBILE
   ═══════════════════════════════════════════ */

/* Supporto Safe Area & Bottom Navigation Bar (iOS) */
body {
  padding-bottom: max(5.5rem, calc(env(safe-area-inset-bottom, 0px) + 5rem));
}

/* Animazione comparsa banner d'installazione */
.pwa-banner-card {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: env(safe-area-inset-bottom, 0px);
}

.pwa-banner-card.pwa-banner-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Animazione modal iOS */
@keyframes pwaModalSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-slide-up {
  animation: pwaModalSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Quando l'app è in modalità standalone (PWA installata), nascondi i prompt */
@media (display-mode: standalone) {
  #pwa-install-banner,
  #pwa-ios-banner,
  #btn-header-install,
  #btn-sidebar-install {
    display: none !important;
  }
}

/* Indicatore stato Offline */
body.is-offline #mode-badge {
  background-color: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

/* ═══════════════════════════════════════════
   ADMIN PANEL – Stili pannello gestione utenti
   ═══════════════════════════════════════════ */

/* Scrollbar sottile nella lista utenti admin e nella lista checkbox */
#admin-users-list::-webkit-scrollbar,
#admin-form-teachers-checkboxes::-webkit-scrollbar,
#modal-user-form .flex-1::-webkit-scrollbar {
  width: 4px;
}
#admin-users-list::-webkit-scrollbar-track,
#admin-form-teachers-checkboxes::-webkit-scrollbar-track,
#modal-user-form .flex-1::-webkit-scrollbar-track {
  background: transparent;
}
#admin-users-list::-webkit-scrollbar-thumb,
#admin-form-teachers-checkboxes::-webkit-scrollbar-thumb,
#modal-user-form .flex-1::-webkit-scrollbar-thumb {
  background: #2e4455;
  border-radius: 4px;
}

/* Checkbox del form admin in tema scuro */
#admin-form-teachers-checkboxes input[type="checkbox"] {
  accent-color: #d97706;
}

/* ═══════════════════════════════════════════
   BOTTOM NAVIGATION BAR (iOS Native Style)
   ═══════════════════════════════════════════ */

#module-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(22, 32, 40, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(46, 68, 85, 0.85);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 40;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}

.module-nav-btn {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.1s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.module-nav-btn:hover {
  color: #e2e8f0;
}

.module-nav-btn:active {
  transform: scale(0.92);
}

.module-nav-btn i,
.module-nav-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.module-nav-btn.active {
  color: #f23d3d;
}

.module-nav-btn.active i,
.module-nav-btn.active svg {
  transform: translateY(-1px);
}

body.theme-light #module-nav-bar {
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid #cbd5e1;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

body.theme-light .module-nav-btn {
  color: #64748b;
}

body.theme-light .module-nav-btn.active {
  color: #f23d3d;
}

/* ═══════════════════════════════════════════
   PROJECTS VIEW – Tabelle, KPI, modali
   ═══════════════════════════════════════════ */

#view-projects {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

/* ═══════════════════════════════════════════
   EVENTS VIEW – Calendario, tabella, modali
   ═══════════════════════════════════════════ */

#view-events {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

/* FullCalendar dark theme overrides */
#events-calendar-container {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2e4455;
  background: #162028;
}

#events-calendar-container .fc {
  background: #162028;
  color: #e2e8f0;
  font-family: inherit;
}

#events-calendar-container .fc-toolbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
}

#events-calendar-container .fc-button {
  background: #1e2e3c;
  border: 1px solid #2e4455;
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: capitalize;
}

#events-calendar-container .fc-button:hover,
#events-calendar-container .fc-button-active,
#events-calendar-container .fc-button-primary:not(:disabled).fc-button-active {
  background: #f23d3d;
  border-color: #f23d3d;
  color: #fff;
  box-shadow: none;
}

#events-calendar-container .fc-daygrid-day {
  border-color: #2e4455;
}

#events-calendar-container .fc-day-today {
  background: rgba(242, 61, 61, 0.07) !important;
}

#events-calendar-container .fc-col-header-cell {
  background: #1a2e3e;
  border-color: #2e4455;
}

#events-calendar-container .fc-col-header-cell-cushion {
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

#events-calendar-container .fc-daygrid-day-number {
  color: #cbd5e1;
  font-size: 0.75rem;
  text-decoration: none;
}

#events-calendar-container .fc-event {
  border-radius: 4px;
  font-size: 0.7rem;
  padding: 1px 4px;
  border: none;
}

#events-calendar-container .fc-list-event-title {
  color: #f1f5f9;
}

#events-calendar-container .fc-list-day-cushion {
  background: #1a2e3e;
  color: #94a3b8;
  font-size: 0.75rem;
}

/* Responsive FullCalendar Mobile */
@media (max-width: 640px) {
  #events-calendar-container {
    padding: 6px;
  }
  #events-calendar-container .fc-header-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 0.5rem !important;
  }
  #events-calendar-container .fc-toolbar-chunk:nth-child(1) {
    display: flex;
    align-items: center;
    gap: 3px;
  }
  #events-calendar-container .fc-toolbar-chunk:nth-child(2) {
    order: 3;
    width: 100%;
    text-align: center;
    margin: 2px 0 4px 0;
  }
  #events-calendar-container .fc-toolbar-chunk:nth-child(3) {
    display: flex;
    align-items: center;
    gap: 3px;
  }
  #events-calendar-container .fc-toolbar-title {
    font-size: 1rem !important;
    text-transform: capitalize;
  }
  #events-calendar-container .fc-button {
    font-size: 0.72rem !important;
    padding: 4px 8px !important;
  }
  #events-calendar-container .fc-col-header-cell-cushion {
    font-size: 0.68rem;
    padding: 2px !important;
  }
  #events-calendar-container .fc-daygrid-day-number {
    font-size: 0.7rem;
    padding: 2px 4px;
  }
  #events-calendar-container .fc-daygrid-day-frame {
    min-height: 48px;
  }
  #events-calendar-container .fc-event {
    font-size: 0.65rem !important;
    padding: 1px 2px !important;
    border-radius: 3px;
  }
  #events-calendar-container .fc-list-event-title {
    font-size: 0.78rem;
  }
  #events-calendar-container .fc-list-event-time {
    font-size: 0.72rem;
  }
}

/* Legenda colori */
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Tabella timeline */
#events-table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #2e4455;
  background: #162028;
}

#events-table-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  color: #cbd5e1;
}

#events-table-container thead th {
  background: #1a2e3e;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.7rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #2e4455;
  white-space: nowrap;
}

#events-table-container tbody tr {
  border-bottom: 1px solid #1e2e3c;
}

#events-table-container tbody tr:last-child {
  border-bottom: none;
}

/* Scrollbar evento nella tabella */
#events-table-container::-webkit-scrollbar { height: 4px; }
#events-table-container::-webkit-scrollbar-track { background: #162028; }
#events-table-container::-webkit-scrollbar-thumb { background: #2e4455; border-radius: 4px; }

/* Modali eventi */
.events-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
}

.events-modal-box {
  background: #162028;
  border: 1px solid #2e4455;
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  position: relative;
}

.events-modal-box::-webkit-scrollbar { width: 4px; }
.events-modal-box::-webkit-scrollbar-track { background: transparent; }
.events-modal-box::-webkit-scrollbar-thumb { background: #2e4455; border-radius: 4px; }

.events-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #2e4455;
}

.events-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.events-form-group label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.events-form-group input,
.events-form-group select,
.events-form-group textarea {
  background: #1e2e3c;
  border: 1px solid #2e4455;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.events-form-group input:focus,
.events-form-group select:focus,
.events-form-group textarea:focus {
  border-color: #f23d3d;
}

.events-form-group select option {
  background: #1a2e3e;
  color: #f1f5f9;
}

/* Scegli media gallery */
#scegli-media-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
}

@media (max-width: 480px) {
  #scegli-media-gallery { grid-template-columns: repeat(2, 1fr); }
}
