/* ==========================================================================
   1. REGISTRAZIONE VARIABILI, RESET RETINA ED IMPAGINAZIONE DISPLAY
   ========================================================================== */
:root {
    --bg-main: #060913;
    --card-surface: rgba(13, 20, 38, 0.75);
    --border-neon: rgba(255, 255, 255, 0.06);
    --text-pure: #ffffff;
    --text-dimmed: #94a3b8;
    --neon-purple: #a855f7;
    --neon-violet: #d946ef;
    --neon-cyan: #06b6d4;
    --color-todo: #3b82f6;
    --color-progress: #f59e0b;
    --color-done: #10b981;
}

* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; /* Rimuove il flash azzurro al tocco su iPad/smartphone */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main); 
    color: var(--text-pure);
    margin: 0; 
    padding: 0 0 75px 0; /* Spazio inferiore per la barra di navigazione mobile */
    min-height: 100vh; 
    overflow-x: hidden;
}

/* Sfondi Ambientali Luminescenti */
.neon-orb { 
    position: absolute; 
    border-radius: 50%; 
    filter: blur(100px); 
    pointer-events: none; 
    z-index: 0; 
    opacity: 0.1; 
}
.orb-purple { width: 300px; height: 300px; background: var(--neon-violet); top: -50px; left: -50px; }
.orb-cyan { width: 300px; height: 300px; background: var(--neon-cyan); bottom: 50px; right: -50px; }

.app-viewport { position: relative; z-index: 1; }

/* Contenitori Principali del Layout */
.workspace-grid { display: flex; flex-direction: column; gap: 15px; padding: 15px; }
.main-display-area { flex-grow: 1; width: 100%; }
/* ==========================================================================
   2. INTAVOLAZIONE SUPERIORE E NAV-ITEM NAVBAR PRINCIPALE
   ========================================================================== */
.dashboard-progress-hub {
    background: rgba(8, 12, 26, 0.9); 
    padding: 12px 20px; 
    border-bottom: 1px solid var(--border-neon);
    backdrop-filter: blur(15px); 
    -webkit-backdrop-filter: blur(15px); 
    position: sticky; 
    top: 0; 
    z-index: 10;
}
.hub-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.hub-subtitle { font-size: 9px; letter-spacing: 2px; font-weight: 800; color: var(--neon-cyan); }
.hub-percentage { font-size: 14px; font-weight: 900; }
.hub-track { background: rgba(255, 255, 255, 0.04); height: 4px; border-radius: 10px; overflow: hidden; }
.hub-fill { 
    background: linear-gradient(90deg, var(--neon-violet), var(--neon-cyan), var(--color-done)); 
    width: 0%; 
    height: 100%; 
    transition: width 0.4s ease; 
}

.main-navbar { 
    padding: 15px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid var(--border-neon); 
    gap: 10px; 
    flex-wrap: wrap; 
}
.brand h1 { 
    margin: 0; 
    font-size: 18px; 
    font-weight: 900; 
    background: linear-gradient(120deg, #fff, #64748b); 
    -webkit-background-clip: text; 
    background-clip: text; 
    -webkit-text-fill-color: transparent; 
}
.badge-neon { font-size: 8px; background: rgba(217, 70, 239, 0.15); border: 1px solid rgba(217, 70, 239, 0.3); color: #f472b6; padding: 1px 6px; border-radius: 30px; }
.brand p { margin: 2px 0 0 0; color: var(--text-dimmed); font-size: 11px; }

/* Impostazioni base pulsanti e Navbar Actions */
button { font-family: inherit; font-weight: 700; border-radius: 10px; cursor: pointer; transition: all 0.2s ease; border: none; }
.btn-action-glass { background: rgba(255,255,255,0.04); border: 1px solid var(--border-neon); color: white; padding: 6px 12px; font-size: 11px; }
.btn-action-glass:hover { background: rgba(255,255,255,0.08); }
.navbar-actions { display: flex; gap: 8px; }
/* ==========================================================================
   3. SIDEBAR CONTROLS ED STRUTTURA GRAFICA CALENDARIO MATRICE (TOUCH ADAPTIVE)
   ========================================================================== */
.control-box { background: var(--card-surface); border-radius: 16px; border: 1px solid var(--border-neon); padding: 18px; margin-bottom: 16px; box-shadow: 0 15px 30px rgba(0,0,0,0.5); }
.control-box h2 { margin: 0 0 15px 0; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dimmed); }

/* Box Statistiche e Condivisione */
.stats-grid-local { display: flex; gap: 10px; margin-bottom: 15px; }
.stat-item-box { flex: 1; background: rgba(0,0,0,0.3); padding: 10px; border-radius: 10px; text-align: center; border: 1px solid rgba(255,255,255,0.02); }
.stat-num { display: block; font-size: 18px; font-weight: 900; color: var(--neon-cyan); }
.stat-lbl { font-size: 9px; color: var(--text-dimmed); text-transform: uppercase; }
.backup-actions-zone { display: flex; gap: 8px; margin-bottom: 15px; }
.subject-distribution-list { display: flex; flex-direction: column; gap: 6px; }
.subject-stat-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dimmed); background: rgba(255,255,255,0.02); padding: 4px 8px; border-radius: 6px; }

/* Allineamento perfetto anti-sballamento per iPad e iPhone */
.input-wrapper { margin-bottom: 14px; }
.input-wrapper label { display: block; font-size: 10px; font-weight: 700; margin-bottom: 6px; color: var(--text-dimmed); text-transform: uppercase; }
.input-wrapper input, .input-wrapper select {
    width: 100%; 
    height: 44px; /* Altezza fissa touch-friendly per i campi Apple */
    padding: 11px 14px; 
    background: rgba(0,0,0,0.4); 
    border: 1px solid rgba(255,255,255,0.06); 
    border-radius: 10px; 
    color: white; 
    font-size: 13px; 
    box-sizing: border-box; 
    -webkit-appearance: none; 
    appearance: none;
}
.input-wrapper input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

.btn-neon-trigger { background: linear-gradient(135deg, var(--neon-purple), #6366f1); color: white; width: 100%; padding: 14px; font-size: 13px; }
.btn-neon-abort { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: #f87171; width: 100%; padding: 10px; font-size: 12px; margin-top: 6px; }

/* Filtro e Barra di Ricerca */
.filter-header-action { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.btn-subtle-toggle { background: transparent; color: var(--neon-cyan); font-size: 11px; padding: 4px 8px; border: 1px solid rgba(6, 182, 212, 0.3); border-radius: 6px; }
.search-neon { width: 100%; padding: 11px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; color: white; font-size: 13px; box-sizing: border-box; }
.advanced-panel { margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(255, 255, 255, 0.06); display: flex; flex-direction: column; gap: 10px; max-height: 200px; transition: max-height 0.25s ease; overflow: hidden; }
.hidden-panel { max-height: 0; padding-top: 0; margin-top: 0; border-top: none; opacity: 0; }
.filter-group-row { display: flex; align-items: center; justify-content: space-between; }
.filter-options { display: flex; gap: 3px; background: rgba(0,0,0,0.3); padding: 2px; border-radius: 8px; }
.filter-chip { padding: 4px 8px; font-size: 10px; background: transparent; color: var(--text-dimmed); border: none; border-radius: 6px; }
.filter-chip.active { background: rgba(255, 255, 255, 0.08); color: white; }

/* VISTA CALENDARIO MENSILE SCURO */
.calendar-view-container { background: var(--card-surface); border-radius: 20px; border: 1px solid var(--border-neon); padding: 20px; box-shadow: 0 20px 40px rgba(0,0,0,0.5); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); width: 100%; margin-bottom: 20px; }
.calendar-header-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.calendar-header-controls h2 { margin: 0; font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: white; }
.calendar-weekdays-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; font-weight: 700; color: var(--text-dimmed); text-transform: uppercase; margin-bottom: 10px; }
.calendar-days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }

/* Casella Singolo Giorno */
.calendar-day-cell { background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255,255,255,0.03); min-height: 70px; border-radius: 12px; padding: 6px; display: flex; flex-direction: column; justify-content: space-between; position: relative; }
.calendar-day-number { font-size: 12px; font-weight: 700; color: var(--text-dimmed); }
.calendar-day-cell.day-today { background: rgba(6, 182, 212, 0.06); border: 1px solid rgba(6, 182, 212, 0.3); }
.calendar-day-cell.day-today .calendar-day-number { color: var(--neon-cyan); }
.calendar-day-cell.day-empty { background: transparent; border: none; pointer-events: none; }

/* Indicatori a punti colorati del mese */
.calendar-events-dots-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.calendar-dot-marker { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.calendar-dot-marker.dot-verifica { border-radius: 2px; transform: scale(1.2); } /* Le verifiche appaiono leggermente più grandi */
.hidden-display { display: none !important; }
/* ==========================================================================
   4. KANBAN DECK, TASK CARD E MEDIA QUERY RESPONSIVE COMPORTAMENTO PC
   ========================================================================== */
.sidebar-controls { width: 100%; }
.kanban-deck { display: flex; flex-direction: column; width: 100%; }
.mobile-column, .mobile-panel { display: none; width: 100%; }
.mobile-column.mobile-active, .mobile-panel.mobile-active { display: block; }

/* Contenitori Colonne */
.deck-column { background: rgba(9, 14, 28, 0.6); border-radius: 16px; padding: 14px; margin-bottom: 15px; }
.column-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.title-flow { display: flex; align-items: center; gap: 8px; }
.neon-glow-dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-todo { background: var(--color-todo); }
.dot-progress { background: var(--color-progress); }
.dot-done { background: var(--color-done); }
.column-top h2 { margin: 0; font-size: 13px; font-weight: 800; text-transform: uppercase; color: var(--text-pure); }

/* Tasto Svuota e Contatore */
.done-header-actions { display: flex; align-items: center; gap: 8px; }
.btn-clear-column-action { background: rgba(239, 68, 68, 0.08); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.badge-counter { background: rgba(255,255,255,0.04); color: var(--text-dimmed); font-size: 10px; padding: 1px 6px; border-radius: 20px; }
.task-dropzone { min-height: 200px; }

/* Scheda del Compito */
.task-card { background: rgba(18, 26, 47, 0.8); border-radius: 14px; padding: 14px; margin-bottom: 10px; border: 1px solid rgba(255, 255, 255, 0.04); border-left: 4px solid transparent; box-shadow: 0 8px 20px rgba(0,0,0,0.4); }
.task-badge-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.task-type-label { font-size: 8px; font-weight: 900; text-transform: uppercase; color: var(--neon-cyan); }
.priority-tag { font-size: 8px; font-weight: 800; padding: 2px 6px; border-radius: 4px; color: white; }
.tag-alta { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid #ef4444; }
.tag-media { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid #f59e0b; }
.tag-bassa { background: rgba(6, 182, 212, 0.15); color: #67e8f9; border: 1px solid #06b6d4; }
.task-card-title { font-size: 13px; font-weight: 600; margin: 0 0 8px 0; color: white; }
.task-card-date { font-size: 10px; color: var(--text-dimmed); margin-bottom: 10px; }

.task-actions { display: flex; gap: 4px; border-top: 1px solid rgba(255,255,255,0.04); padding-top: 8px; }
.btn-card { padding: 6px 10px; font-size: 11px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); color: var(--text-dimmed); border-radius: 6px; }
.btn-card-delete { margin-left: auto; color: #f87171; }

.panel-header-mobile { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.btn-close-panel { display: block; background: transparent; color: var(--text-dimmed); font-size: 16px; padding: 5px; }

/* Barra di Navigazione Mobile Touch */
.mobile-nav-bar {
    position: fixed; bottom: 0; left: 0; right: 0; height: 60px; background: rgba(8, 12, 26, 0.95); border-top: 1px solid var(--border-neon); display: flex; justify-content: space-around; align-items: center; z-index: 100; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.nav-item { background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-dimmed); padding: 5px; width: 22%; height: 100%; font-size: 10px; font-weight: 500; }
.nav-icon { font-size: 16px; margin-bottom: 2px; }
.nav-item.active { color: var(--neon-cyan); }
.nav-item-add { color: var(--neon-violet) !important; font-weight: 700; }
.hidden { display: none !important; }

/* ==========================================================================
   MEDIA QUERY: SBLOCCO AUTOMATICO SCHERMI GRANDI (PC E TABLET ORIZZONTALI)
   ========================================================================== */
@media (min-width: 1025px) {
    body { padding-bottom: 0; }
    .mobile-nav-bar, .btn-close-panel { display: none !important; }
    .mobile-column, .mobile-panel { display: block !important; }
    .workspace-grid { display: flex; flex-direction: row; gap: 30px; padding: 30px 40px; }
    .sidebar-controls { width: 320px; }
    .kanban-deck { flex-direction: row; gap: 24px; }
}
