* {
    box-sizing: border-box;
    margin: 0;
    padding: 5px;
}

body {
    font-family: Montserrat, Arial, sans-serif;
    line-height: 1.6;
    background: #f4f4f4;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.search-box {
    margin: 20px 0;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-box input[type="text"] {
    padding: 12px;
    width: 70%;
    max-width: 500px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.search-box button {
    padding: 12px 25px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.cantiere-section {
    margin: 30px 0;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rapporti-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.rapporti-table th,
.rapporti-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.rapporti-table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 10px;
    }

    .search-box input[type="text"] {
        width: 100%;
        margin-bottom: 10px;
    }

    .rapporti-table {
        display: block;
        overflow-x: auto;
    }

    .rapporti-table th,
    .rapporti-table td {
        padding: 10px;
    }
}


/* Stili per il form principale */
.form-group {
    margin-bottom: 20px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.form-group input[type="date"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.checkbox-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.checkbox-group label {
    display: inline;
    font-weight: normal;
}

.btn-save {
    background-color: #4CAF50;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
}

.btn-save:hover {
    background-color: #45a049;
}

.btn-download {
    display: inline-block;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin: 10px 0;
}

.btn-download:hover {
    background: #0056b3;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 300px;
    background: #f8f9fa;
    padding: 20px;
    border-right: 1px solid #dee2e6;
}

.main-content {
    flex: 1;
    padding: 20px;
}

.cantiere-form {
    margin-bottom: 20px;
}

.cantiere-form input {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
}

.cantiere-item {
    padding: 10px;
    border-bottom: 1px solid #dee2e6;
    cursor: pointer;
}

.cantiere-item:hover {
    background: #e9ecef;
}

.expandable-row {
    cursor: pointer;
}

.expandable-row:hover {
    background: #f8f9fa;
}

.measurement-form {
    padding: 15px;
    background: #f8f9fa;
}

.measurement-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.measurement-inputs input {
    width: 100px;
    padding: 5px;
}

.measurement-inputs .risultato {
    background: #e9ecef;
}

textarea {
    width: 100%;
    height: 80px;
    padding: 8px;
}

.success-message {
    background-color: #4CAF50;
    color: white;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.btn-saving {
    position: relative;
    pointer-events: none;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}


.total-area {
    margin: 15px 0;
    font-weight: bold;
    font-size: 1.1em;
    color: #2196F3;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
}

.cantiere-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
}

.delete-cantiere {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.button-group {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 15px;
}

.btn-download {
    margin-right: auto;
}

.btn-delete-report {
    background-color: #ff4444;
    color: white;
    padding: 8px 16px;
    margin-left: auto;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-delete-report:hover {
    background-color: #cc0000;
}

.main-header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo h1 {
    margin: 0;
    font-size: 24px;
}

.nav-menu {
    display: flex;
    gap: 20px;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
}

.nav-menu a:hover {
    background-color: #34495e;
    color:#FFF;
}

.nav-menu a.active {
    background-color: #3498db;
}

.logout-btn {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background-color: #e74c3c;
    border-radius: 4px;
}

.logout-btn:hover {
    background-color: #c0392b;
}

.save-measurements {
    background-color: #27ae60;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 20px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.save-measurements:hover {
    background-color: #219a52;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}

@media screen and (max-width: 768px) {
    .layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .main-content {
        width: 100%;
        padding: 10px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .rapporti-table {
        display: block;
        overflow-x: auto;
    }
    
    .header-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-menu {
        flex-direction: column;
        align-items: center;
    }
}

@media screen and (max-width: 768px) {
    .login-container {
        width: 100%;
        height: 100vh;
        margin: 0;
        padding: 20px;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .login-form {
        width: 100%;
        padding: 20px;
    }

    .login-form input {
        width: 100%;
        padding: 15px;
        margin: 10px 0;
        font-size: 16px;
    }

    .login-form button {
        width: 100%;
        padding: 15px;
        font-size: 16px;
        margin-top: 20px;
    }

    body {
        margin: 0;
        padding: 0;
        background: #f5f5f5;
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 900px;
    border-radius: 8px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

@media screen and (max-width: 768px) {
    body {
        margin: 10px; /* Ridotto il margine */
    }

    #calendar {
        width: 100%; /* Calendario a piena larghezza */
        padding: 5px;
        margin: 0;
        font-size: 14px; /* Ridotto font size generale */
    }
    
    /* Ottimizzazione toolbar */
    .fc .fc-toolbar {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }
    
    .fc .fc-toolbar-title {
        font-size: 1.1em;
        margin: 5px 0;
    }
    
    /* Bottoni più grandi e spaziati per touch */
    .fc .fc-button {
        padding: 8px 12px;
        font-size: 14px;
        margin: 2px;
        height: auto;
    }
    
    /* Celle del calendario */
    .fc td, .fc th {
        padding: 1px !important;
    }
    
    .fc .fc-daygrid-day-number {
        padding: 2px;
        font-size: 12px;
    }
    
    /* Eventi nel calendario */
    .fc-event {
        margin: 1px 0;
        padding: 2px !important;
    }
    
    .fc-event-title {
        font-size: 11px;
        line-height: 1.2;
    }
    
    .fc-event-notes {
        max-height: 1.8em;
        font-size: 10px;
    }

    /* Modal per eventi */
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 10px;
    }

    /* Legenda */
    .calendar-legend {
        width: 100%;
        padding: 5px;
        gap: 10px;
    }

    .legend-item {
        font-size: 12px;
    }

    .color-box {
        width: 15px;
        height: 15px;
    }
    
    /* Header ottimizzato */
    .main-header {
        margin-bottom: 10px;
    }
    
    .header-container {
        padding: 0.5rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .logo h1 {
        font-size: 24px;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Ottimizzazioni per schermi molto piccoli */
@media screen and (max-width: 480px) {
    .fc-header-toolbar {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .fc-toolbar-chunk {
        margin: 5px 0;
    }

    .calendar-legend {
        flex-direction: column;
        align-items: flex-start;
    }
}
/* Rendi tutte le colonne dei giorni della stessa larghezza */
.fc-daygrid-day {
    width: calc(100% / 7) !important; /* Dividi lo spazio equamente tra i 7 giorni */
}

.fc .fc-col-header-cell {
    width: calc(100% / 7) !important;
}

/* Per fix specifico di domenica e sabato */
.fc .fc-day-sun, .fc .fc-day-sat {
    width: calc(100% / 7) !important;
}

/* Forza tutte le celle ad avere la stessa larghezza */
.fc-scrollgrid-sync-table {
    width: 100% !important;
}

.fc table {
    table-layout: fixed !important;
    width: 100% !important;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.btn-cancel {
    background-color: #6c757d;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-cancel:hover {
    background-color: #5a6268;
}

.btn-confirm {
    background-color: #28a745;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-confirm:hover {
    background-color: #218838;
}

.restore-modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.restore-modal-content h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.restore-form textarea {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
}

.restore-form textarea:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 5px rgba(44, 62, 80, 0.2);
}

.button-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0;
}

.left-buttons {
    display: flex;
    gap: 10px;
}

.right-buttons {
    display: flex;
    gap: 10px;
}

.btn-download, .btn-archive, .btn-delete-report {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: background-color 0.3s;
}

.btn-download {
    background-color: #4CAF50;
    color: white;
}

.btn-download:hover {
    background-color: #34495e;
}

.btn-archive {
    background-color: #f39c12;
    color: white;
}

.btn-archive:hover {
    background-color: #d68910;
}

.btn-delete-report {
    background-color: #e74c3c;
    color: white;
}

.btn-delete-report:hover {
    background-color: #c0392b;
}