/* ========================================
   SLANCIO - STILI QUESTIONARIO
   Versione: 2.0 - Ottobre 2025
   ======================================== */

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

:root {
    --teal: #226A68;
    --crema: #F5E8D8;
    --rosso: #D93838;
    --arancione: #D98C38;
    --blu-chiaro: #7BB7B5;
    --grigio-scuro: #333333;
}

/* === BODY E LAYOUT PRINCIPALE === */
body {
    font-family: 'Montserrat', sans-serif;
    color: var(--grigio-scuro);
    background: linear-gradient(135deg, var(--crema) 0%, #fff 50%, var(--crema) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === HEADER === */
header {
    background-color: white;
    padding: 0.6rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-between; /* Modificato per allineare logo e menu */
    align-items: center;
    width: 100%;
    max-width: 1200px; /* Aggiunto per coerenza */
    margin: 0 auto;
}

.logo {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.02);
}

.logo img {
    height: 135px;
    width: auto;
    max-width: 350px;
}

/* Menu Utente nell'Header */
.header-user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-email-display {
    font-size: 0.9rem;
    color: var(--teal);
    font-weight: 600;
}

.btn-dashboard {
    background: var(--teal);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-dashboard:hover {
    background: var(--blu-chiaro);
    transform: translateY(-2px);
}

.btn-logout {
    background: var(--rosso);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #b82929;
    transform: translateY(-2px);
}

/* === MAIN CONTENT === */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Modificato per iniziare dall'alto */
    padding: 2rem;
}

/* === CONTAINER QUESTIONARIO === */
.questionnaire-container {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    max-width: 800px;
    width: 100%;
}

/* === BARRA PROGRESSO === */
.progress-wrapper {
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: var(--crema);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--blu-chiaro));
    transition: width 0.4s ease;
    width: 5.88%; /* 1/17 = ~5.88% */
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--teal);
    font-weight: 600;
}

/* === STEPS E ANIMAZIONI === */
.question-step {
    display: none;
}

.question-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* === TITOLI E SOTTOTITOLI === */
.question-title {
    font-family: 'Oswald', sans-serif;
    font-size: 2rem;
    color: var(--teal);
    margin-bottom: 0.5rem;
}

.question-subtitle {
    font-size: 1rem;
    color: var(--grigio-scuro);
    margin-bottom: 2rem;
    opacity: 0.8;
}

/* === INPUT GROUPS === */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--teal);
    font-size: 0.95rem;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--crema);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: 'Montserrat', sans-serif;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(34, 106, 104, 0.1);
}

.input-group input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.input-helper-text {
    font-size: 0.85rem;
    color: var(--teal);
    margin-top: 0.3rem;
    font-style: italic;
}

/* === RANGE SLIDERS === */
.input-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--crema);
    border-radius: 5px;
    outline: none;
    padding: 0;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--teal);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.input-group input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--arancione);
    transform: scale(1.2);
}

/* === OPTION CARDS === */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-card {
    padding: 1.5rem;
    border: 3px solid var(--crema);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    background: white;
}

.option-card:hover {
    border-color: var(--blu-chiaro);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.option-card.selected {
    border-color: var(--teal);
    background-color: rgba(34, 106, 104, 0.05);
    box-shadow: 0 0 0 3px rgba(34, 106, 104, 0.15);
}

/* === CHECKBOX GRID === */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.8rem;
    border: 2px solid var(--crema);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

/* === FILE UPLOAD === */
.file-upload {
    border: 3px dashed var(--teal);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.file-upload input[type="file"] {
    display: none;
}

/* === BUTTON GROUP === */
.button-group {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    gap: 1rem;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--teal), var(--blu-chiaro));
    color: white;
    flex: 1;
}

.btn-secondary {
    background: white;
    color: var(--teal);
    border: 2px solid var(--teal);
    flex: 1;
}

/* === LOADING E SPINNER === */
.loading {
    text-align: center;
    padding: 3rem 2rem;
}

.spinner {
    border: 5px solid var(--crema);
    border-top: 5px solid var(--arancione);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

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

/* === RESULTS CONTAINER === */
.results-container {
    padding: 2rem;
    background: linear-gradient(135deg, var(--teal) 0%, var(--blu-chiaro) 100%);
    border-radius: 15px;
    color: white;
}

/* === ERROR MESSAGE === */
.error-message {
    background: rgba(217, 56, 56, 0.1);
    border: 2px solid var(--rosso);
    color: var(--rosso);
    padding: 1.5rem;
    border-radius: 10px;
    margin: 1rem 0;
    text-align: center;
}

/* === FOOTER === */
footer {
    background-color: var(--grigio-scuro);
    color: var(--crema);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

/* === RESPONSIVE MOBILE === */
@media (max-width: 768px) {
    .questionnaire-container { padding: 2rem 1.5rem; }
    .question-title { font-size: 1.5rem; }
    .options-grid, .checkbox-grid { grid-template-columns: 1fr; }
    .logo img { height: 100px; max-width: 250px; }
    .button-group { flex-direction: column; }
    .btn { width: 100%; }
    main { padding: 1rem; }
}
