/* ==========================
   QUESTIONARIO GUIDATO
========================== */
.questionario-page {
    background-color: #fcfaf9;
    min-height: 80vh;
    display: flex;
    justify-content: center;
    padding: 1.5rem 1rem; 
}

.questionario-container {
    width: 100%;
    max-width: 700px;
    text-align: center;
}

/* --- Progress Bar --- */
.q-progress {
    position: relative;
    max-width: 400px;
    margin: 0 auto 1.5rem auto; 
    height: 40px;
}

.q-progress-bar-bg {
    position: absolute;
    top: 50%; left: 0; width: 100%; height: 4px;
    background: #e6e0d8; transform: translateY(-50%);
    z-index: 1; border-radius: 4px;
}

.q-progress-bar-fill {
    height: 100%; background: #966038;
    width: 0%; transition: width 0.4s ease; border-radius: 4px;
}

.q-steps-indicator {
    position: relative; display: flex; justify-content: space-between;
    z-index: 2; width: 100%;
}

.q-indicator {
    width: 32px; height: 32px; background: #e6e0d8; color: #999;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px; transition: all 0.3s ease;
}
.q-indicator.active { background: #966038; color: white; transform: scale(1.1); }
.q-indicator.completed { background: #966038; color: white; }

/* --- Form Steps --- */
.q-step {
    display: none; border: none; padding: 0; margin: 0;
    animation: fadeInSlide 0.5s ease forwards;
}
.q-step.is-active { display: block; }

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

.q-header h1 {
    font-size: 1.8rem;
    color: #4b2e1e;
    margin-bottom: 0.5rem; font-weight: 800;
}
.q-header p { color: #777; margin-bottom: 2.5rem; }

/* --- Griglia Opzioni (Cards) --- */
.q-grid-options {
    display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 2rem;
}

/* Regole Desktop */
@media (min-width: 768px) {
    .q-grid-options { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
    .q-grid-options.q-grid-2 { grid-template-columns: repeat(2, 1fr); }
    
    .q-card {
        min-height: 220px;
        display: flex; align-items: center; justify-content: center;
        text-align: center; padding: 0 !important;
    }
    .q-card-inner {
        width: 100%; height: 100%; display: flex; flex-direction: column;
        align-items: center; justify-content: center; padding: 2rem;
    }
    .q-card-inner > * { margin-top: 0; margin-bottom: 0.5rem; }
    .q-card-inner > *:last-child { margin-bottom: 0; }
}

/* Stile Card */
.q-card {
    position: relative; cursor: pointer; background: white;
    border: 2px solid #eee; border-radius: 12px; padding: 2rem 1.5rem;
    transition: all 0.2s ease; display: block;
}
.q-card:hover { border-color: #dcc4ac; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.q-card input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.q-card:has(input:checked) { border-color: #966038; background-color: #fffbf8; box-shadow: 0 0 0 1px #966038; }
.q-card-inner { display: flex; flex-direction: column; align-items: center; gap: 1rem; color: #444; }
.q-icon-fallback { color: #8d735f; }
.q-label { font-weight: 700; font-size: 1.1rem; }

/* --- Step 5: Form Finale (Riquadro Unico) --- */
.q-step[data-step="5"].is-active .q-form-layout {
    background-color: #fff; border: 1px solid #e6e1d9;
    border-radius: 12px; padding: 2.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    max-width: 700px; margin: 0 auto; text-align: left;
}
@media (max-width: 600px) {
    .q-step[data-step="5"].is-active .q-form-layout { padding: 1.5rem; }
}

.form-group { margin-bottom: 1.2rem; position: relative; }
.q-form-layout label { font-weight: 700; color: #2f241a; margin-bottom: 0.4rem; display: block; }

/* Layout Indirizzo Split */
.form-row-split { display: grid; grid-template-columns: 120px 1fr; gap: 1rem; }
@media (max-width: 480px) { .form-row-split { grid-template-columns: 1fr 1fr; } }

/* Autocomplete */
.q-address-suggestions {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border: 1px solid #ccc; border-top: none;
    border-radius: 0 0 8px 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100; max-height: 250px; overflow-y: auto;
    list-style: none; padding: 0; margin: 0;
}
.q-address-suggestions li {
    padding: 10px 15px; cursor: pointer; border-bottom: 1px solid #eee;
    font-size: 0.95rem; color: #333; transition: background 0.2s; text-align: left;
}
.q-address-suggestions li:hover { background-color: #f2f2f2; color: #966038; }
.q-address-loader {
    position: absolute; right: 12px; top: 42px; width: 16px; height: 16px;
    border: 2px solid #ccc; border-top-color: #966038; border-radius: 50%;
    animation: q-spin 0.6s linear infinite;
}
@keyframes q-spin { to { transform: rotate(360deg); } }

/* Checkbox */
.q-checkbox-label {
    display: flex; align-items: flex-start; cursor: pointer;
    margin-bottom: 1rem; font-size: 0.95rem; line-height: 1.4;
}
.q-checkbox-label input[type="checkbox"] { position: absolute; opacity: 0; height: 0; width: 0; }
.q-checkbox-custom {
    display: inline-block; width: 20px; height: 20px;
    border: 2px solid #966038; border-radius: 4px; margin-right: 10px;
    flex-shrink: 0; position: relative; background-color: #fff;
}
.q-checkbox-label input[type="checkbox"]:checked + .q-checkbox-custom {
    background-color: #966038; border-color: #966038;
}
.q-checkbox-label input[type="checkbox"]:checked + .q-checkbox-custom:after {
    content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
    border: solid white; border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.q-checkbox-label span:not(.q-checkbox-custom) { font-weight: normal; color: #333; }
.q-checkbox-label a { font-weight: 600; color: hsl(25, 35%, 25%); text-decoration: underline; }

/* Pulsanti */
.q-actions-footer {
    display: flex; align-items: center; justify-content: space-between;
    max-width: 700px; margin: 2.5rem auto 0 auto; gap: 1rem;
}
.q-btn-back, .q-btn-submit {
    appearance: none; -webkit-appearance: none; box-sizing: border-box !important; margin: 0;
    font-family: inherit; font-weight: 600; border-radius: 6px; cursor: pointer;
    transition: all 0.3s ease; font-size: 1rem; text-decoration: none !important;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1 !important; height: 54px !important; padding: 0 2rem !important;
}
.q-btn-back {
    background-color: transparent !important; color: hsl(25, 35%, 25%) !important;
    border: 2px solid hsl(25, 35%, 25%) !important;
}
.q-btn-back:hover { background-color: hsl(25, 35%, 25%) !important; color: #fff !important; }

.q-btn-submit {
    background: linear-gradient(to right, #8B5E3C, #5A3C2A) !important;
    color: #fff !important; border: none !important;
    border-radius: 8px !important; box-shadow: 0 2px 10px rgba(91, 60, 42, 0.25);
    flex-grow: 1;
}
.q-btn-submit:hover {
    background: hsl(20, 90%, 40%) !important; transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
@media (max-width: 480px) {
    .q-actions-footer { flex-direction: column-reverse; }
    .q-btn-back, .q-btn-submit { width: 100%; }
}

/* Colore di sfondo per i campi bloccati (CAP e Città) */
#q-cap[readonly], 
#q-citta[readonly] {
    background-color: #faf3eb !important; /* Marroncino chiaro */
    border-color: #e6dac8; /* Bordo leggermente più scuro per definizione */
    color: #5a4a42; /* Testo marrone scuro */
}