/**
 * ============================================================================
 * CALENDARIO LEZIONI - RESPONSIVE ENHANCEMENTS
 * ============================================================================
 * Sistema completo di responsive design per desktop, tablet e smartphone
 * Include: CSS Variables, Typography, Calendar Table, Navigation, Forms, Modals
 * Autore: Claude Code
 * Versione: 1.0.0
 * ============================================================================
 */

/* ============================================================================
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================================================ */
:root {
    /* Colori primari */
    --color-primary: #043F69;
    --color-primary-light: #0a5a96;
    --color-primary-dark: #022840;
    --color-secondary: #6c757d;
    --color-accent: #E7E140;
    --color-accent-dark: #c9c336;

    /* Colori di stato */
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
    --color-info: #17a2b8;

    /* Colori neutri */
    --color-white: #ffffff;
    --color-black: #000000;
    --color-gray-100: #f8f9fa;
    --color-gray-200: #e9ecef;
    --color-gray-300: #dee2e6;
    --color-gray-400: #ced4da;
    --color-gray-500: #adb5bd;
    --color-gray-600: #6c757d;
    --color-gray-700: #495057;
    --color-gray-800: #343a40;
    --color-gray-900: #212529;

    /* Bordi */
    --border-color: #CEC3AD;
    --border-radius-sm: 0.25rem;
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    --border-radius-xl: 1rem;

    /* Tipografia responsive (base 16px) */
    --font-family-base: 'Arial', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: clamp(0.625rem, 0.5rem + 0.5vw, 0.75rem);      /* 10-12px */
    --font-size-sm: clamp(0.75rem, 0.625rem + 0.5vw, 0.875rem);    /* 12-14px */
    --font-size-base: clamp(0.875rem, 0.75rem + 0.5vw, 1rem);       /* 14-16px */
    --font-size-md: clamp(1rem, 0.875rem + 0.5vw, 1.125rem);        /* 16-18px */
    --font-size-lg: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);         /* 18-20px */
    --font-size-xl: clamp(1.25rem, 1.125rem + 0.5vw, 1.5rem);       /* 20-24px */
    --font-size-xxl: clamp(1.5rem, 1.25rem + 1vw, 2rem);            /* 24-32px */

    /* Spaziatura responsive */
    --spacing-xs: clamp(0.25rem, 0.125rem + 0.5vw, 0.5rem);
    --spacing-sm: clamp(0.5rem, 0.25rem + 0.5vw, 0.75rem);
    --spacing-md: clamp(0.75rem, 0.5rem + 0.5vw, 1rem);
    --spacing-lg: clamp(1rem, 0.75rem + 0.5vw, 1.5rem);
    --spacing-xl: clamp(1.5rem, 1rem + 1vw, 2rem);
    --spacing-xxl: clamp(2rem, 1.5rem + 1vw, 3rem);

    /* Breakpoints (per riferimento) */
    --breakpoint-xs: 0;
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    --breakpoint-xxl: 1400px;

    /* Touch target minimo (WCAG) */
    --touch-target-min: 44px;

    /* Transizioni */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;

    /* Ombre */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.15);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.2);

    /* Z-index layers */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-orientation-banner: 9999;
}


/* ============================================================================
   2. ORIENTATION BANNER - SUGGERIMENTO LANDSCAPE PER SMARTPHONE
   ============================================================================ */

/* Banner per suggerire orientamento orizzontale su smartphone */
#orientation-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-orientation-banner);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: var(--color-white);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

#orientation-banner.hiding {
    animation: slideUp 0.3s ease-out forwards;
}

#orientation-banner .banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    max-width: 100%;
    margin: 0 auto;
    flex-wrap: wrap;
}

#orientation-banner .rotate-icon {
    width: 32px;
    height: 32px;
    animation: rotatePhone 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes rotatePhone {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    50% { transform: rotate(90deg); }
    75% { transform: rotate(75deg); }
}

#orientation-banner .banner-text {
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-align: center;
    line-height: 1.4;
}

#orientation-banner .banner-text strong {
    display: block;
    font-size: var(--font-size-base);
    margin-bottom: 2px;
}

#orientation-banner .banner-dismiss {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--color-white);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    white-space: nowrap;
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
}

#orientation-banner .banner-dismiss:hover,
#orientation-banner .banner-dismiss:focus {
    background: rgba(255,255,255,0.3);
}

/* Mostra banner solo su smartphone in portrait (< 576px width, portrait) */
@media screen and (max-width: 575.98px) and (orientation: portrait) {
    #orientation-banner.show {
        display: block;
    }

    /* Sposta il contenuto della pagina quando il banner e' visibile */
    body.orientation-banner-visible {
        padding-top: calc(50px + 80px) !important; /* navbar + banner */
    }
}

/* Nascondi sempre in landscape */
@media screen and (orientation: landscape) {
    #orientation-banner {
        display: none !important;
    }

    body.orientation-banner-visible {
        padding-top: 50px !important;
    }
}

/* ============================================================================
   3. RESPONSIVE TYPOGRAPHY
   ============================================================================ */

/* Base typography */
html {
    font-size: 16px; /* Base per rem */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: 1.5;
}

/* Headings responsive */
h1, .h1 { font-size: var(--font-size-xxl); }
h2, .h2 { font-size: var(--font-size-xl); }
h3, .h3 { font-size: var(--font-size-lg); }
h4, .h4 { font-size: var(--font-size-md); }
h5, .h5 { font-size: var(--font-size-base); }
h6, .h6 { font-size: var(--font-size-sm); }

/* Small text */
small, .small, .text-sm {
    font-size: var(--font-size-sm);
}

.text-xs {
    font-size: var(--font-size-xs);
}


/* ============================================================================
   4. HEADER & NAVIGATION RESPONSIVE
   ============================================================================ */

/* Fix header logo per mobile */
#topbar .navbar-brand {
    padding: 0;
    margin-right: var(--spacing-sm);
    max-width: 60%;
}

#topbar .navbar-brand .d-flex {
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

/* Container loghi header */
.header-logos-container {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
}

/* Stili specifici per i loghi header */
.header-logo {
    height: 40px;
    width: auto;
    max-width: none;
    flex-shrink: 0;
    transition: height var(--transition-fast);
}

.header-logo-main {
    height: 45px;
}

.header-logo-secondary {
    height: 38px;
}

/* Logo responsive su schermi piccoli */
@media screen and (max-width: 991.98px) {
    .header-logos-container {
        gap: 12px;
    }

    .header-logo {
        height: 38px;
    }

    .header-logo-main {
        height: 42px;
    }

    .header-logo-secondary {
        height: 36px;
    }
}

@media screen and (max-width: 767.98px) {
    /* ✅ Header SEMPRE FISSO in alto - NON scrolla mai */
    #topbar {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        background: #fff !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    /* ✅ Header: loghi e menu sulla stessa riga, tutto visibile */
    #topbar .container-fluid {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        padding: 8px 12px;
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }

    #topbar .navbar-brand {
        flex: 0 1 auto;
        max-width: 75%;
        margin-right: 10px;
        overflow: visible;
    }

    .header-logos-container {
        gap: 8px;
        flex-wrap: nowrap;
        overflow: visible;
    }

    /* ✅ Loghi grandi ma che stiano nell'header */
    .header-logo {
        height: 32px;
    }

    .header-logo-main {
        height: 36px;
    }

    .header-logo-secondary {
        height: 30px;
    }

    /* ✅ Icona menu sempre visibile */
    #topbar .navbar-toggler {
        flex-shrink: 0;
        margin-left: auto;
        border: 2px solid var(--color-primary);
        background: white;
        padding: 6px 10px;
    }

    #topbar .navbar-toggler .navbar-toggler-icon {
        width: 22px;
        height: 22px;
    }

    /* ✅ Spazio per header fixed - il contenuto inizia sotto l'header */
    body {
        padding-top: 60px !important;
    }

    /* ✅ Il contenuto principale può scorrere */
    #main-content,
    #page-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ✅ Calendario scrollabile orizzontalmente SOLO il calendario */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;
    }
}

@media screen and (max-width: 575.98px) {
    #topbar .container-fluid {
        padding: 6px 10px;
    }

    .header-logos-container {
        gap: 8px;
    }

    /* ✅ Loghi ANCORA PIÙ GRANDI su smartphone */
    .header-logo {
        height: 34px;
    }

    .header-logo-main {
        height: 38px;
    }

    .header-logo-secondary {
        height: 32px;
    }
}

/* Smartphone landscape - header FISSO, calendario scrolla */
@media screen and (max-width: 896px) and (orientation: landscape) {
    /* ✅ Header FISSO in alto - sempre visibile per intero */
    #topbar {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        background: #fff !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    #topbar .container-fluid {
        padding: 4px 10px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        overflow: visible;
    }

    .header-logos-container {
        gap: 10px;
        flex-wrap: nowrap;
    }

    .header-logo {
        height: 28px;
    }

    .header-logo-main {
        height: 32px;
    }

    .header-logo-secondary {
        height: 26px;
    }

    /* ✅ Spazio per header fixed in landscape */
    body {
        padding-top: 45px !important;
    }

    /* ✅ Calendario scrollabile orizzontalmente */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;
    }
}

@media screen and (max-width: 400px) {
    .header-logos-container {
        gap: 6px;
    }

    .header-logo {
        height: 30px;
    }

    .header-logo-main {
        height: 34px;
    }

    .header-logo-secondary {
        height: 28px;
    }
}

/* Navbar toggler migliorato per touch */
.navbar-toggler {
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    padding: var(--spacing-sm);
    border: 2px solid var(--color-gray-400);
    border-radius: var(--border-radius);
}

.navbar-toggler:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Menu dropdown responsive */
@media screen and (max-width: 767.98px) {
    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-white);
        box-shadow: var(--shadow-lg);
        padding: var(--spacing-md);
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        z-index: var(--z-dropdown);
    }

    .navbar-nav {
        flex-direction: column;
        width: 100%;
    }

    .navbar-nav .nav-item {
        width: 100%;
        border-bottom: 1px solid var(--color-gray-200);
    }

    .navbar-nav .nav-link {
        padding: var(--spacing-md) var(--spacing-sm);
        min-height: var(--touch-target-min);
        display: flex;
        align-items: center;
    }

    .navbar-nav .dropdown-menu {
        position: static;
        float: none;
        width: 100%;
        box-shadow: none;
        border: none;
        background: var(--color-gray-100);
        padding-left: var(--spacing-lg);
    }

    /* Pulsanti header su mobile */
    #topbar .btn {
        margin: var(--spacing-xs) 0;
        width: 100%;
        justify-content: center;
    }
}


/* ============================================================================
   5. CALENDAR TABLE RESPONSIVE
   ============================================================================ */

/* Container wrapper per scroll orizzontale */
.calendar-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--spacing-md);
}

/* Indicator di scroll */
.calendar-wrapper.has-scroll::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    pointer-events: none;
}

/* Tabella calendario base */
.tab_calendario {
    width: 100%;
    min-width: 800px; /* Larghezza minima per evitare compressione eccessiva */
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

/* NON sovrascrivere colori - mantiene stili originali di custom-style.css */

/* Responsive calendar per tablet - solo dimensioni, NO colori */
@media screen and (max-width: 991.98px) {
    .tab_calendario {
        min-width: 700px;
    }
}

/* Mobile calendar - scroll orizzontale */
@media screen and (max-width: 767.98px) {
    .calendar-wrapper {
        position: relative;
    }

    .tab_calendario {
        min-width: 600px;
    }
}

/* Small mobile */
@media screen and (max-width: 575.98px) {
    .tab_calendario {
        min-width: 500px;
    }
}

/* Landscape mode su smartphone */
@media screen and (max-width: 896px) and (orientation: landscape) {
    .tab_calendario {
        min-width: 100%;
    }
}


/* ============================================================================
   6. FORMS RESPONSIVE - Solo layout mobile
   ============================================================================ */

/* Su mobile: form orizzontali diventano verticali */
@media screen and (max-width: 767.98px) {
    /* Form con layout col-sm-4 / col-sm-8 - rendi verticale */
    .form-group .row .col-sm-4,
    .form-group .row .col-sm-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.25rem;
    }

    .form-group .row .col-sm-8,
    .form-group .row .col-sm-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Form inline diventa verticale */
    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline .form-control,
    .form-inline .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}


/* ============================================================================
   7. MODALS RESPONSIVE - Solo form layout fix
   ============================================================================ */

/* Form dentro modali: layout verticale su mobile */
@media screen and (max-width: 767.98px) {
    .modal-body .form-group .row .col-sm-4,
    .modal-body .form-group .row .col-sm-3,
    .inline-page .form-group .row .col-sm-4,
    .inline-page .form-group .row .col-sm-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.25rem;
    }

    .modal-body .form-group .row .col-sm-8,
    .modal-body .form-group .row .col-sm-9,
    .inline-page .form-group .row .col-sm-8,
    .inline-page .form-group .row .col-sm-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Container dentro modali - rimuovi padding eccessivo */
    .modal-body .container,
    .modal-body .container-fluid,
    .inline-page .container,
    .inline-page .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }
}


/* ============================================================================
   8. UTILITIES RESPONSIVE
   ============================================================================ */

/* Visibility utilities */
.d-mobile-none {
    display: block;
}

.d-mobile-block {
    display: none;
}

@media screen and (max-width: 575.98px) {
    .d-mobile-none {
        display: none !important;
    }

    .d-mobile-block {
        display: block !important;
    }
}

/* Spacing utilities responsive */
@media screen and (max-width: 575.98px) {
    .p-mobile-sm { padding: var(--spacing-sm) !important; }
    .px-mobile-sm { padding-left: var(--spacing-sm) !important; padding-right: var(--spacing-sm) !important; }
    .py-mobile-sm { padding-top: var(--spacing-sm) !important; padding-bottom: var(--spacing-sm) !important; }
    .m-mobile-sm { margin: var(--spacing-sm) !important; }
    .mx-mobile-sm { margin-left: var(--spacing-sm) !important; margin-right: var(--spacing-sm) !important; }
    .my-mobile-sm { margin-top: var(--spacing-sm) !important; margin-bottom: var(--spacing-sm) !important; }
}

/* Text utilities responsive */
@media screen and (max-width: 575.98px) {
    .text-mobile-center { text-align: center !important; }
    .text-mobile-left { text-align: left !important; }
    .text-mobile-sm { font-size: var(--font-size-sm) !important; }
    .text-mobile-xs { font-size: var(--font-size-xs) !important; }
}

/* Flex utilities responsive */
@media screen and (max-width: 575.98px) {
    .flex-mobile-column { flex-direction: column !important; }
    .flex-mobile-wrap { flex-wrap: wrap !important; }
    .w-mobile-100 { width: 100% !important; }
}


/* ============================================================================
   16. LED DISPLAY EXCLUSION (50-55" LCD)
   ============================================================================ */

/* La pagina ledisplay e' ottimizzata per display LCD fissi 50-55"
   NON applicare stili responsive - deve mostrare tutto senza scroll */

body.lezioni-ledisplay,
body.lezioni-led_calendario {
    /* Reset responsive enhancements per LED display */
    font-size: 16px !important;
}

body.lezioni-ledisplay #orientation-banner,
body.lezioni-led_calendario #orientation-banner {
    display: none !important;
}

body.lezioni-ledisplay .calendar-wrapper,
body.lezioni-led_calendario .calendar-wrapper {
    overflow: visible !important;
}

body.lezioni-ledisplay .tab_calendario,
body.lezioni-led_calendario .tab_calendario,
body.lezioni-ledisplay .tab_calendario_lcd,
body.lezioni-led_calendario .tab_calendario_lcd {
    min-width: 100% !important;
    width: 100% !important;
}


/* ============================================================================
   17. MOBILE CALENDAR ACTIONS - Touch-friendly controls
   ============================================================================ */

/* Su mobile: disabilita drag & drop visivamente, mostra pulsanti azione */
@media screen and (max-width: 767.98px) {
    /* Dashboard header: pulsanti separati su mobile */
    .header-body .row {
        gap: 8px;
    }
    .header-body .col-auto .btn {
        margin-bottom: 8px;
        display: block;
        width: 100%;
    }

    /* Rimuovi cursore drag su mobile */
    .touch-device .lesson-cell,
    .touch-device .lesson-item,
    .touch-device [draggable="true"] {
        cursor: pointer !important;
    }

    /* Lezione nel calendario - più touch-friendly */
    .touch-device .tab_calendario td {
        min-height: 60px;
        padding: 4px !important;
    }

    /* Pulsanti azione nelle celle - più grandi su mobile */
    .touch-device .tab_calendario .btn-sm,
    .touch-device .lesson-actions .btn {
        min-width: 36px;
        min-height: 36px;
        padding: 6px 8px;
        font-size: 14px;
        margin: 2px;
    }

    /* Container azioni lezione su mobile */
    .mobile-lesson-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
        margin-top: 6px;
        padding-top: 6px;
        border-top: 1px solid rgba(0,0,0,0.1);
    }

    .mobile-lesson-actions .btn {
        flex: 1 1 auto;
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--border-radius);
        font-size: 16px;
    }

    /* Pulsante sposta - evidenziato */
    .mobile-lesson-actions .btn-move {
        background: var(--color-primary);
        color: white;
        border: none;
    }

    .mobile-lesson-actions .btn-move:active {
        background: var(--color-primary-dark);
        transform: scale(0.95);
    }

    /* Modale di spostamento per mobile */
    .mobile-move-modal {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
        z-index: var(--z-modal);
        padding: var(--spacing-lg);
        transform: translateY(100%);
        transition: transform 0.3s ease;
        max-height: 70vh;
        overflow-y: auto;
    }

    .mobile-move-modal.show {
        transform: translateY(0);
    }

    .mobile-move-modal .modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: var(--spacing-md);
        padding-bottom: var(--spacing-sm);
        border-bottom: 1px solid var(--color-gray-200);
    }

    .mobile-move-modal .modal-title {
        font-size: var(--font-size-lg);
        font-weight: 600;
        margin: 0;
    }

    .mobile-move-modal .close-btn {
        width: 40px;
        height: 40px;
        border: none;
        background: var(--color-gray-200);
        border-radius: 50%;
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    /* Opzioni rapide di spostamento */
    .mobile-move-options {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-md);
    }

    .mobile-move-option {
        padding: var(--spacing-md);
        border: 2px solid var(--color-gray-300);
        border-radius: var(--border-radius);
        background: var(--color-gray-100);
        text-align: center;
        cursor: pointer;
        transition: all var(--transition-fast);
        min-height: 60px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .mobile-move-option:active {
        background: var(--color-primary);
        color: white;
        border-color: var(--color-primary);
        transform: scale(0.98);
    }

    .mobile-move-option .option-icon {
        font-size: 24px;
        margin-bottom: 4px;
    }

    .mobile-move-option .option-label {
        font-size: var(--font-size-sm);
        font-weight: 500;
    }

    /* Form spostamento avanzato */
    .mobile-move-form {
        margin-top: var(--spacing-md);
    }

    .mobile-move-form .form-group {
        margin-bottom: var(--spacing-md);
    }

    .mobile-move-form label {
        display: block;
        font-weight: 500;
        margin-bottom: var(--spacing-xs);
        font-size: var(--font-size-sm);
    }

    .mobile-move-form select,
    .mobile-move-form input {
        width: 100%;
        padding: var(--spacing-sm) var(--spacing-md);
        border: 2px solid var(--color-gray-300);
        border-radius: var(--border-radius);
        font-size: var(--font-size-base);
        min-height: 48px;
    }

    .mobile-move-form .btn-submit {
        width: 100%;
        padding: var(--spacing-md);
        background: var(--color-primary);
        color: white;
        border: none;
        border-radius: var(--border-radius);
        font-size: var(--font-size-md);
        font-weight: 600;
        min-height: 52px;
        margin-top: var(--spacing-md);
    }

    .mobile-move-form .btn-submit:active {
        background: var(--color-primary-dark);
    }

    /* Overlay quando modale è aperto */
    .mobile-move-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: calc(var(--z-modal) - 1);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .mobile-move-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    /* Nascondi resize handle su mobile */
    .touch-device .resize-handle {
        display: none !important;
    }

    /* Feedback visivo quando si tocca una lezione */
    .touch-device .lesson-cell:active,
    .touch-device .lesson-item:active {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
}

/* Tablet - mantieni drag & drop ma migliora touch targets */
@media screen and (min-width: 768px) and (max-width: 991.98px) {
    .touch-device .tab_calendario .btn-sm {
        min-width: 32px;
        min-height: 32px;
        padding: 4px 6px;
    }

    .touch-device .lesson-cell,
    .touch-device .lesson-item {
        min-height: 50px;
    }
}

/* ============================================================================
   18. SWIPE GESTURES INDICATORS
   ============================================================================ */

/* Indicatore swipe per navigazione calendario */
@media screen and (max-width: 767.98px) {
    .swipe-indicator {
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(0,0,0,0.6);
        color: white;
        padding: 8px 12px;
        border-radius: 4px;
        font-size: 12px;
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }

    .swipe-indicator.left {
        left: 10px;
    }

    .swipe-indicator.right {
        right: 10px;
    }

    .swipe-indicator.show {
        opacity: 1;
    }

    /* Hint iniziale per swipe */
    .swipe-hint {
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--color-primary);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: var(--font-size-sm);
        display: flex;
        align-items: center;
        gap: 8px;
        animation: pulseHint 2s infinite;
        z-index: 100;
    }

    @keyframes pulseHint {
        0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
        50% { opacity: 1; transform: translateX(-50%) scale(1.02); }
    }

    .swipe-hint .swipe-icon {
        animation: swipeAnimation 1.5s ease-in-out infinite;
    }

    @keyframes swipeAnimation {
        0%, 100% { transform: translateX(0); }
        50% { transform: translateX(-5px); }
    }

    /* Animazioni hint mobile */
    @keyframes slideUpHint {
        from {
            transform: translate(-50%, 100%);
            opacity: 0;
        }
        to {
            transform: translate(-50%, 0);
            opacity: 1;
        }
    }

    @keyframes slideDownHint {
        from {
            transform: translate(-50%, 0);
            opacity: 1;
        }
        to {
            transform: translate(-50%, 100%);
            opacity: 0;
        }
    }
}

/* ============================================================================
   19. PRINT STYLES
   ============================================================================ */

@media print {
    #orientation-banner,
    .navbar,
    #topbar,
    .flash-msg-container,
    .btn-group,
    .pagination {
        display: none !important;
    }

    body {
        padding-top: 0 !important;
        font-size: 12pt;
    }

    .tab_calendario {
        min-width: 100%;
        font-size: 10pt;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
}


/* ============================================================================
   20. CLICK-TO-MOVE STYLES
   ============================================================================ */

/* Barra istruzioni click-to-move */
.click-move-instructions {
    position: fixed;
    top: 60px; /* Sotto la navbar */
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 1025;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 14px;
    animation: slideInFromTop 0.3s ease;
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.click-move-instructions span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.click-move-instructions .btn-cancel {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: white;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease;
}

.click-move-instructions .btn-cancel:hover {
    background: rgba(255,255,255,0.3);
}

/* Mobile - barra più compatta */
@media screen and (max-width: 767.98px) {
    .click-move-instructions {
        top: 55px;
        padding: 8px 12px;
        font-size: 13px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .click-move-instructions .btn-cancel {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Modalità click-to-move attiva */
.click-move-mode {
    cursor: crosshair;
}

.click-move-mode .td_cella:not(.lesson-selected) {
    cursor: crosshair;
}

/* Hover preview (solo bordo, no sfondo solido) */
.hover-preview {
    transition: all 0.1s ease !important;
}

/* ============================================================================
   END OF RESPONSIVE ENHANCEMENTS
   ============================================================================ */
