/* ===== RESET BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: Arial, Helvetica, sans-serif; 
    font-size: 16px; 
    line-height: 1.6; 
    color: #000; 
    background: #fff; 
    padding: 15px;
    max-width: 1800px; /* ESPANSO: era 1400px */
    margin: 0 auto;
}

/* ===== HEADER ===== */
.header { 
    padding: 25px 0; /* RIDOTTO: era 30px */
    border-bottom: 2px solid #000; 
    margin-bottom: 25px; /* RIDOTTO: era 30px */
}

.header h1 { 
    font-size: 42px; 
    font-weight: bold;
    margin-bottom: 5px;
}

.header p { 
    font-size: 22px; 
    color: #666; 
}

/* ===== NAVIGAZIONE SETTIMANA ===== */
.week-nav { 
    display: table;
    width: 100%;
    margin-bottom: 25px; /* RIDOTTO: era 30px */
    padding-bottom: 15px; /* RIDOTTO: era 20px */
    border-bottom: 1px solid #ccc; 
}

.week-nav > div {
    display: table-cell;
    vertical-align: middle;
}

.week-nav > div:first-child {
    width: 60%;
    font-size: 22px;
    font-weight: bold;
}

.week-nav > div:last-child {
    width: 40%;
    text-align: right;
}

.week-nav button { 
    padding: 10px 20px; 
    background: #fff; 
    border: 1px solid #000; 
    color: #000; 
    cursor: pointer; 
    font-size: 18px;
    margin-left: 5px;
}

.week-nav button:hover { 
    background: #000; 
    color: #fff; 
}

/* ===== GRIGLIA SETTIMANALE ===== */
#weekGrid { 
    display: table;
    width: 100%;
    border-collapse: separate;
    border-spacing: 12px; /* AUMENTATO: era 10px */
    margin-bottom: 35px; /* RIDOTTO: era 40px */
}

.week-row {
    display: table-row;
}

/* ===== CARTA GIORNO ===== */
.day-card { 
    display: table-cell;
    width: 14.28%; /* 100% / 7 giorni */
    border: 1px solid #ccc; 
    background: #fff; 
    vertical-align: top;
}

.day-card.today { 
    border: 2px solid #000; 
}

.day-card.weekend { 
    background: #f5f5f5; 
}

/* ===== HEADER GIORNO ===== */
.day-header { 
    padding: 10px; 
    border-bottom: 1px solid #ccc; 
    background: #f8f8f8; 
}

.day-name { 
    font-size: 22px; 
    font-weight: bold;
    text-transform: uppercase;
}

.day-number { 
    font-size: 20px; 
    color: #666; 
    margin-top: 3px;
}

/* ===== CONTENUTO GIORNO ===== */
.day-content { 
    padding: 0;
}

.notes-textarea { 
    width: 100%; 
    min-height: 550px; /* ESPANSO: era 400px */
    height: 550px; /* FISSO per uniformità */
    padding: 10px; 
    font-family: Arial, sans-serif; 
    font-size: 20px; 
    line-height: 1.5; 
    color: #000; 
    background: #fff; 
    border: none; 
    resize: vertical;
}

.notes-textarea:focus { 
    outline: 1px solid #000;
    background: #fcfcfc; 
}

.notes-textarea.weekend { 
    background: #f5f5f5; 
}

/* ===== FOOTER GIORNO ===== */
.day-footer { 
    padding: 8px 10px; 
    border-top: 1px solid #ccc; 
    background: #f8f8f8; 
    font-size: 14px; 
    color: #666; 
}

.day-footer table {
    width: 100%;
    border-collapse: collapse;
}

.day-footer td:first-child {
    text-align: left;
}

.day-footer td:last-child {
    text-align: right;
}

.save-indicator.saved { 
    color: #000;
    font-weight: bold;
}

/* ===== CONTATORE CARATTERI AVVISO ===== */
.char-count.warning {
    color: #c00;
    font-weight: bold;
}

/* ===== NOTE NON SALVATE ===== */
.notes-textarea.unsaved {
    border-right: 3px solid #f00;
}

/* ===== CONTROLLI ===== */
.controls {
    display: table;
    width: 100%;
    margin-bottom: 25px; /* RIDOTTO: era 30px */
    padding-top: 15px; /* RIDOTTO: era 20px */
    border-top: 1px solid #ccc;
}

.controls a {
    display: table-cell;
    color: #000;
    text-decoration: none;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 0;
    width: 25%;
    text-align: center;
}

.controls a:nth-child(1) {
    text-align: left;
}

.controls a:nth-child(4) {
    text-align: right;
}

.controls a:hover {
    text-decoration: underline;
}

/* ===== FOOTER ===== */
.footer { 
    padding: 25px 0; /* RIDOTTO: era 30px */
    border-top: 2px solid #000; 
    margin-top: 10px; 
    font-size: 18px; 
    color: #666;
    text-align: center;
}

.footer a { 
    color: #666; 
    text-decoration: none; 
}

.footer a:hover { 
    color: #000; 
    text-decoration: underline;
}

/* ===== MESSAGGIO DI STATO ===== */
#statusMessage { 
    position: fixed; 
    top: 20px; 
    right: 20px; 
    padding: 15px 25px; 
    background: #000; 
    color: #fff; 
    font-size: 14px; 
    display: none;
    z-index: 1000;
}

#statusMessage.show { 
    display: block;
}

/* ===== PAGINA SERVICE ===== */
.service-content {
    text-align: center;
    padding: 60px 20px;
}

.service-content h2 {
    font-size: 28px;
    font-weight: normal;
    margin-bottom: 30px;
}

.service-content p {
    font-size: 16px;
    color: #666;
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.service-buttons {
    margin-bottom: 40px;
}

.service-buttons button,
.service-buttons a {
    display: inline-block;
    padding: 15px 40px;
    margin: 10px;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.service-buttons button:hover,
.service-buttons a:hover {
    background: #000;
    color: #fff;
}

.btn-import {
    border-color: #c00 !important;
    color: #c00 !important;
}

.btn-import:hover {
    background: #c00 !important;
    color: #fff !important;
}

.btn-export {
    border-color: #060 !important;
    color: #060 !important;
}

.btn-export:hover {
    background: #060 !important;
    color: #fff !important;
}

.warning {
    background: #fffacd;
    border: 1px solid #ff0;
    color: #666;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    font-size: 14px;
    text-align: left;
}

/* ===== LOADER ===== */
.loader {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}