/*
Orario Scuola, Copyright (C) 2025-2026 EmmeV.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see https://www.gnu.org/licenses/.
*/
/* Base styles */
body {
    font-family: Arial, sans-serif;
    padding: 15px;
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.8em;
}

/* ===== TABLE STYLES (DESKTOP ONLY) ===== */
table {
    table-layout: fixed; 
    width: 100%;
    /* Rispettiamo il limite del contenitore genitore */
    max-width: 100%; 
    margin: 15px 0;
    border-collapse: separate; 
    border-spacing: 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #d1d9e0;
    font-size: 1em; /* Riduzione globale per guadagnare spazio */
}

th, td {
    /* Padding ridotto: 8px sopra/sotto, 4px ai lati */
    padding: 8px 4px; 
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid #e1e8ed;
    border-right: 1px solid #e1e8ed;
    /* Forza il testo ad andare a capo se troppo lungo */
    word-break: break-word; 
    overflow-wrap: break-word;
}

th {
    background-color: #f4f7f9;
    font-size: 1em;
    padding: 10px 4px;
}

/* Classi specifiche per gestire gli spazi interni */
.subject {
    display: block;
    font-weight: bold;
    color: #1f618d;
    line-height: 1.1;
    margin-bottom: 2px;
}

.teacher {
    display: block;
    font-size: 0.9em;
    color: #34495e;
}

.room {
    margin-top: 4px;
    font-size: 0.7em;
    padding: 1px 5px;
}

/* Colonna orario/ID: la rendiamo il piÃ¹ stretta possibile */
th:first-child, td:first-child {
    width: 75px; 
    background-color: #fcfdfe;
    font-size: 1.1em;
}

/* Rimuove l'ultimo bordo a destra */
th:last-child, td:last-child {
    border-right: none;
}

/* Desktop/Mobile layout control */
.desktop-schedule {
    display: table;
    width: 100%;
    border-collapse: collapse;
}

.mobile-schedule {
    display: none;
}

/* Mobile styles */
@media (max-width: 768px) {
    .desktop-schedule {
        display: none;
    }
    
    .mobile-schedule {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .mobile-schedule .day {
        background: #f8f8f8;
        border-radius: 10px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
        padding: 1rem;
    }

    .mobile-schedule h2 {
        margin-top: 0;
        margin-bottom: 0.8rem;
        font-size: 1.2rem;
        color: #111;
        border-bottom: 1px solid #ddd;
        padding-bottom: 0.3rem;
    }

    .lesson {
        background: #fff;
        border: 1px solid #eee;
        border-radius: 8px;
        padding: 0.6rem 0.8rem;
        margin-bottom: 0.6rem;
    }

    .lesson.empty {
        opacity: 0.6;
    }

    .hour {
        font-size: 0.9rem;
        color: #666;
        margin-bottom: 3px;
    }

    .subject {
        font-weight: 600;
        color: #222;
    }

    .teacher {
        font-size: 0.85rem;
        color: #555;
    }

    .room {
        font-size: 0.8rem;
        color: #777;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.5em;
    }
}