/**
 * Configuratore Prodotti - Stili
 * Version: 1.0.0
 */

/* ========================================
   Variabili CSS
   ======================================== */
:root {
    --primary-color: #2271b1;
    --primary-hover: #135e96;
    --secondary-color: #f0f0f1;
    --success-color: #00a32a;
    --error-color: #d63638;
    --text-color: #1d2327;
    --border-color: #c3c4c7;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* ========================================
   Container principale
   ======================================== */
.configuratore-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.configuratore-container.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ========================================
   Barra di progressione
   ======================================== */
.configuratore-progress {
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--secondary-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    transition: width 0.5s ease;
    border-radius: 10px;
}

.progress-text {
    text-align: center;
    font-size: 16px;
    color: #666;
    font-weight: 600;
}

.progress-percentage {
    color: var(--primary-color);
    font-size: 18px;
}

/* ========================================
   Domande
   ======================================== */
.question-wrapper {
    min-height: 300px;
    animation: fadeIn 0.4s ease;
}

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

.question-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 15px;
    text-align: center;
}

.question-subtitle {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 30px;
    text-align: center;
}

.question-content {
    margin-bottom: 30px;
}

/* ========================================
   Opzioni - Image Cards
   ======================================== */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.option-card {
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.option-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.option-card.selected {
    border-color: var(--primary-color);
    background: #f0f6fc;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.option-image {
    width: 100%;
    height: 150px;
    margin-bottom: 15px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.option-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-top: 10px;
}

.additional-text-field {
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

/* ========================================
   Opzioni - Buttons
   ======================================== */
.options-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.option-button {
    padding: 15px 25px;
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

.option-button:hover {
    border-color: var(--primary-color);
    background: #f0f6fc;
}

.option-button.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
}

/* ========================================
   Input numerici
   ======================================== */
.number-input,
.number-select {
    width: 100%;
    max-width: 300px;
    padding: 12px 20px;
    font-size: 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    margin: 0 auto;
    display: block;
}

.number-input:focus,
.number-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.unknown-option {
    text-align: center;
    margin-top: 20px;
}

.unknown-option label {
    font-size: 16px;
    cursor: pointer;
}

.unknown-checkbox {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========================================
   Form finale
   ======================================== */
.configuratore-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-field {
    margin-bottom: 25px;
}

.form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-color);
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 15px;
    transition: var(--transition);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.form-field textarea {
    resize: vertical;
    min-height: 100px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 400 !important;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========================================
   Navigazione
   ======================================== */
.configuratore-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.btn-prev,
.btn-next,
.btn-submit {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-prev {
    background: var(--secondary-color);
    color: var(--text-color);
}

.btn-prev:hover {
    background: #dcdcde;
}

.btn-next,
.btn-submit {
    background: var(--primary-color);
    color: #fff;
    margin-left: auto;
}

.btn-next:hover,
.btn-submit:hover {
    background: var(--primary-hover);
}

.btn-submit {
    width: 100%;
    padding: 15px 30px;
    font-size: 18px;
    margin-top: 20px;
}

/* ========================================
   Completamento
   ======================================== */
.completion-message {
    text-align: center;
    padding: 60px 20px;
}

.completion-icon {
    width: 80px;
    height: 80px;
    background: var(--success-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto 30px;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

.completion-message h2 {
    font-size: 32px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.completion-message p {
    font-size: 18px;
    color: #666;
}

/* ========================================
   Riepilogo risposte
   ======================================== */
.response-summary {
    margin-top: 40px;
    padding: 25px;
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    text-align: left;
}

.response-summary h3 {
    font-size: 20px;
    margin-bottom: 20px;
}

.response-summary ul {
    list-style: none;
    padding: 0;
}

.response-summary li {
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

.response-summary li:last-child {
    border-bottom: none;
}

.response-summary strong {
    color: var(--text-color);
}

/* ========================================
   File Upload
   ======================================== */
.file-upload-wrapper {
    margin-top: 15px;
}

.file-upload {
    width: 100%;
    padding: 10px;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

.file-upload:hover {
    border-color: var(--primary-color);
}

/* ========================================
   Utility
   ======================================== */
.mt-2 {
    margin-top: 10px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .configuratore-container {
        padding: 20px;
        margin: 20px 10px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .question-title {
        font-size: 24px;
    }

    .question-subtitle {
        font-size: 18px;
    }

    .configuratore-navigation {
        flex-direction: column;
    }

    .btn-next {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .configuratore-container {
        padding: 15px;
    }

    .option-card {
        padding: 15px;
    }

    .option-image {
        height: 120px;
    }
}

/* ========================================
   Temi personalizzabili
   ======================================== */
.configuratore-container[data-tema="dark"] {
    --primary-color: #4a90e2;
    --text-color: #ffffff;
    background: #1e1e1e;
    color: #ffffff;
}

.configuratore-container[data-tema="dark"] .option-card {
    background: #2a2a2a;
    border-color: #444;
}

.configuratore-container[data-tema="dark"] .option-card.selected {
    background: #3a4a5c;
    border-color: var(--primary-color);
}
