/* Stile Globale - Tecnico e in scala di grigi */
body {
    font-family: 'Courier New', Courier, monospace;
    background-color: #e0e0e0;
    color: #1a1a1a;
    margin: 0;
    padding: 20px;
    line-height: 1.5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: #f5f5f5;
    border: 1px solid #999;
    padding: 20px;
    box-shadow: 2px 2px 0px #888;
}

/* Header Globale */
.page-header {
    border-bottom: 2px dashed #666;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

    .page-header h1 {
        margin: 0 0 10px 0;
        font-size: 24px;
        text-transform: uppercase;
    }

/* Stile degli Step */
.step {
    border: 1px solid #ccc;
    background-color: #ffffff;
    padding: 20px;
    margin-bottom: 30px; /* Margine per tenerli separati finché sono tutti visibili */
}

.step-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

    .step-header h2 {
        font-size: 18px;
        margin: 0 0 5px 0;
        color: #333;
    }

.step-description {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Form Controls */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 8px;
    font-family: 'Courier New', Courier, monospace;
    border: 1px solid #999;
    background-color: #fafafa;
    box-sizing: border-box;
}

,
/* Stile specifico per la Select della lingua */
select {
    width: 100%; /* Mantiene la larghezza uguale agli altri campi */
    padding: 12px 15px; /* Aumentato lo spazio interno (sopra/sotto e lati) */
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px; /* Testo leggermente più grande e leggibile */
    border: 1px solid #999;
    background-color: #fafafa;
    box-sizing: border-box;
    color: #1a1a1a;
    cursor: pointer;
    /* Rimuove lo stile di default e crea la freccia tecnica */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #666 50%), linear-gradient(135deg, #666 50%, transparent 50%);
    /* Riposiziona la freccia tenendo conto del nuovo padding */
    background-position: calc(100% - 20px) calc(1em + 6px), calc(100% - 15px) calc(1em + 6px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

    /* Effetto hover per far capire che è cliccabile */
    select:hover {
        background-color: #f0f0f0;
        border-color: #666;
    }

input[type="file"] {
    font-family: 'Courier New', Courier, monospace;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Pulsantiera */
.button-group {
    margin-top: 25px;
    display: flex;
    justify-content: space-between;
    border-top: 1px dashed #ccc;
    padding-top: 15px;
}

    .button-group.right {
        justify-content: flex-end;
    }

button {
    font-family: 'Courier New', Courier, monospace;
    background-color: #e0e0e0;
    color: #000;
    border: 1px solid #666;
    padding: 8px 16px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
}

    button:hover {
        background-color: #ccc;
    }

/* Gestione Tabs per Step 2 (Pure CSS per struttura visiva) */
.tabs {
    margin-top: 15px;
}

.tab-headers {
    display: flex;
    border-bottom: 1px solid #999;
}

.tab-button {
    padding: 10px 20px;
    border: 1px solid #999;
    border-bottom: none;
    background-color: #e0e0e0;
    cursor: pointer;
    margin-right: 5px;
}

    .tab-button.active {
        background-color: #ffffff;
        font-weight: bold;
        border-bottom: 1px solid #ffffff;
        margin-bottom: -1px;
    }

.tab-content {
    border: 1px solid #999;
    border-top: none;
    padding: 20px;
    background-color: #ffffff;
}

.proposal-radio {
    margin-top: 15px;
    padding: 10px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
}

/* Stile Finale Bio */
.final-bio-container {
    border-left: 4px solid #666;
    padding-left: 15px;
    background-color: #f9f9f9;
    padding: 20px;
    white-space: pre-wrap; /* Mantiene le interruzioni di riga */
}

/* Overlay per caricamento / Spinner */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(224, 224, 224, 0.85); /* Grigio semi-trasparente */
    z-index: 9999; /* Sta sopra a tutto */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

    /* Classe per nascondere l'overlay */
    #loading-overlay.hidden {
        display: none;
    }

/* Contenitore dello spinner per dare un effetto "finestra di sistema" */
.spinner-box {
    background-color: #f5f5f5;
    border: 2px solid #333;
    padding: 30px 50px;
    text-align: center;
    box-shadow: 4px 4px 0px #666;
}

/* L'animazione visiva dello spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ccc;
    border-top: 4px solid #1a1a1a;
    border-radius: 50%;
    margin: 0 auto 20px auto;
    animation: spin 1s linear infinite;
}

/* Testo in stile terminale */
.spinner-text {
    font-weight: bold;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: blink 1.5s infinite;
}

/* Keyframes per le animazioni */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* --- Nuove regole per Upload Immagine e Preview --- */

.image-upload-wrapper {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Spazio tra pulsante e preview */
}

/* Stile per il pulsante nativo di scelta file (file-selector-button) */
input[type="file"]::file-selector-button {
    font-family: 'Courier New', Courier, monospace;
    background-color: #e0e0e0;
    color: #000;
    border: 1px solid #666;
    padding: 8px 16px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    margin-right: 15px;
}

    input[type="file"]::file-selector-button:hover {
        background-color: #ccc;
    }

/* Box Anteprima (Piccola Preview) */
.preview-box {
    max-width: 120px; /* Dimensione "piccola" definita */
    max-height: 120px;
    border: 2px dashed #999; /* Bordo grezzo/tecnico */
    background-color: #fafafa;
    padding: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Taglia se sfora le dimensioni fisiche */
    box-shadow: 2px 2px 0px #aaa;
    position: relative;
}

    /* Classe per nascondere, coerente con lo spinner */
    .preview-box.hidden {
        display: none !important;
    }

/* L'immagine all'interno */
#image-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Mantiene proporzioni */
    image-rendering: pixelated; /* Tocco tecnico per renderla "grezza" se ingrandita */
}

/* Testo informativo sotto l'immagine (opzionale) */
.file-info-text {
    display: none; /* Nascondiamo il nome file per pulizia visiva in questa demo */
}

/* --- Regole per il Popup di Errore --- */

/* Overlay scuro come lo spinner */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7); /* Scuro e trasparente */
    z-index: 10000; /* Leggermente superiore allo spinner se necessario */
    display: flex;
    justify-content: center;
    align-items: center;
}

    .popup-overlay.hidden {
        display: none !important;
    }

/* Scatola del contenuto */
.popup-content {
    background-color: #f5f5f5;
    border: 3px solid #ff4444; /* Bordo rosso scuro tecnico per segnale errore */
    padding: 30px;
    width: 90%;
    max-width: 500px;
    box-shadow: 6px 6px 0px #333;
    position: relative; /* Necessario per posizionare la X */
    color: #1a1a1a;
}

/* La X di chiusura */
.close-popup {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    line-height: 1;
}

    .close-popup:hover {
        color: #000;
    }

.popup-header {
    border-bottom: 1px dashed #ff4444;
    margin-bottom: 15px;
    padding-bottom: 5px;
}

    .popup-header h3 {
        margin: 0;
        font-size: 18px;
        text-transform: uppercase;
        color: #ff0000; /* Testo rosso per l'intestazione errore */
    }

.popup-body {
    font-size: 14px;
    margin-bottom: 20px;
    white-space: pre-wrap; /* Mantiene formattazione se passiamo errori multilinea */
}

/* Pulsante OK rosso per errore */
.popup-actions button {
    background-color: #f0f0f0;
    border: 1px solid #ff4444;
    color: #ff0000;
}

.popup-actions button:hover {
    background-color: #ffe0e0;
}

/* --- Regole per il Footer --- */
.site-footer {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-top: 20px;
    padding-top: 15px;
    padding-bottom: 20px;
    border-top: 1px dashed #aaa;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    text-transform: uppercase;
    letter-spacing: 1px;
}