:root {
    --primary: #d32f2f;
    --secondary: #f57c00;
    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #F44336;
    --light: #f8f9fa;
    --dark: #212529;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    min-height: 100vh;
    padding: 15px;
    color: var(--dark);
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 20px auto;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--primary);
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

h1 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--primary);
    font-weight: 700;
    font-size: 24px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.image-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.spiedo-img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--secondary);
    transition: all 0.3s ease;
}

.image-container:hover .spiedo-img {
    transform: scale(1.02);
}

.programma-box {
    background-color: #fff8e1;
    border-left: 4px solid var(--secondary);
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 0 6px 6px 0;
}

.programma-title {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.menu-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    gap: 6px;
    font-size: 0.95em;
}

.emoji {
    font-size: 1em;
}

.avviso-importante {
    background-color: #ffebee;
    border: 1px dashed var(--danger);
    padding: 12px;
    border-radius: 6px;
    margin: 15px 0;
    text-align: center;
    font-weight: 600;
    font-size: 0.9em;
}

.modifica-box {
    background-color: #e3f2fd;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #2196F3;
    font-size: 0.9em;
}

.hidden {
    display: none;
}

.hidden-buttons {
    display: none !important;
}

.visible-buttons {
    display: flex !important;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Stile per il blocco prenotazioni */
.booking-blocked {
    background-color: #ffebee;
    border-left: 4px solid var(--danger);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    color: var(--danger);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(244, 67, 54, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0); }
}

.disabled-form {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.disabled-form::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 10;
    border-radius: 6px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9em;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    transition: all 0.3s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.2);
}

/* UNIFORM PLACEHOLDER STYLES */
input::placeholder,
textarea::placeholder {
    color: #adb5bd;
    opacity: 1;
    font-size: 0.85em;
}

@media (min-width: 992px) {
    input::placeholder,
    textarea::placeholder {
        font-size: 0.9em;
    }
}
/* END PLACEHOLDER STYLES */

.char-counter {
    font-size: 0.8em;
    color: #adb5bd;
    text-align: right;
    margin-top: 2px;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.radio-option {
    flex: 1 1 auto;
}

.radio-option input {
    display: none;
}

.radio-option label {
    display: block;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #e9ecef;
    font-size: 0.9em;
}

.radio-option input:checked + label {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

button {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: white !important;
    border: none;
    padding: 12px 15px;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s;
    margin-top: 8px;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.button-group button {
    flex: 1;
}

.btn-calendar {
    background: linear-gradient(90deg, #FF416C, #FF4B2B);
}

.btn-map {
    background: linear-gradient(90deg, #00b09b, #96c93d);
}

.btn-statistica {
    background: linear-gradient(90deg, #2196F3, #03A9F4);
}

.btn-modifiedb {
    background: linear-gradient(90deg, #9C27B0, #673AB7);
}

#confirmation {
    background-color: #e8f5e9;
    color: var(--success);
    text-align: center;
    display: none;
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
    font-weight: 600;
    font-size: 0.9em;
    opacity: 1;
    transition: opacity 0.4s ease-in-out;
    border-left: 4px solid var(--success);
}

#error {
    background-color: #ffebee;
    color: var(--danger);
    text-align: center;
    display: none;
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
    font-weight: 600;
    font-size: 0.9em;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

#existing-booking {
    background-color: #fff3e0;
    border-left: 3px solid var(--warning);
    margin-top: 5px;
    padding: 8px 12px;
    border-radius: 4px;
}

#non-partecipo-msg {
    background-color: #fff3e0;
    border-left: 4px solid var(--warning);
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 0.9em;
    font-weight: 600;
}

.riepilogo-box {
    background-color: #e8f5e9;
    border-left: 4px solid var(--success);
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 0.9em;
    line-height: 1.8;
}

.required::after {
    content: " *";
    color: var(--danger);
    font-size: 0.9em;
}

.spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

.ui-autocomplete {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    z-index: 1000 !important;
    font-family: 'Poppins', sans-serif;
}

.ui-autocomplete .ui-menu-item {
    padding: 8px 12px;
    font-size: 0.9em;
    border-bottom: 1px solid #f1f1f1;
}

.ui-autocomplete .ui-menu-item:last-child {
    border-bottom: none;
}

.ui-autocomplete .ui-state-active {
    background-color: #f5f5f5;
    color: var(--primary);
    border-color: #f1f1f1;
    margin: 0;
}

.ui-helper-hidden-accessible {
    display: none;
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .container {
        margin: 10px auto;
        padding: 15px;
    }
    .image-container {
        margin-bottom: 10px;
    }
    .spiedo-img {
        max-height: 150px;
    }
    button {
        padding: 10px 12px;
    }
    .booking-blocked {
        padding: 12px;
        font-size: 0.9em;
    }
}

@media (min-width: 481px) {
    .radio-group {
        flex-direction: row;
    }
    .button-group {
        flex-direction: row;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 800px;
        margin: 30px auto;
        padding: 25px;
    }
    h1 {
        font-size: 28px;
        margin-bottom: 15px;
    }
    .image-container {
        max-width: 800px;
        margin: 0 auto 25px;
        height: 350px;
    }
    .spiedo-img {
        width: 100%;
        height: 100%;
        max-height: none;
        object-position: center;
    }
    .programma-box {
        padding: 15px;
        margin-bottom: 20px;
    }
    .menu-item {
        font-size: 1em;
        margin-bottom: 8px;
    }
    .avviso-importante {
        padding: 15px;
        margin: 20px 0;
        font-size: 0.95em;
    }
    .modifica-box {
        padding: 15px;
        margin-bottom: 20px;
        font-size: 0.95em;
    }
    .booking-blocked {
        padding: 18px;
        font-size: 1em;
        margin-bottom: 25px;
    }
    .form-group {
        margin-bottom: 20px;
    }
    label {
        font-size: 1em;
        margin-bottom: 8px;
    }
    input, select, textarea {
        padding: 12px 15px;
        font-size: 1.1em;
    }
    .radio-group {
        gap: 10px;
        margin-top: 10px;
    }
    .radio-option label {
        padding: 12px;
        font-size: 1em;
    }
    button {
        padding: 14px 18px;
        font-size: 1.1em;
        margin-top: 10px;
    }
    .button-group {
        flex-direction: row;
        gap: 15px;
        margin-top: 20px;
    }
    #confirmation, #error, #existing-booking {
        padding: 18px;
        margin-top: 20px;
        font-size: 1em;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 960px;
    }
    .image-container {
        max-width: 960px;
        height: 400px;
    }
}