/* =================================
   STILI HOME PAGE (MODERN)
   ================================= */

/* HERO SECTION - (Non Modificato) */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 120px 20px 100px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Effetto sfondo decorativo - (Non Modificato) */
.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 52px;
    font-weight: 800;
    margin-bottom: 25px;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.hero-subtitle {
    font-size: 20px;
    margin-bottom: 40px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* ADVANTAGES SECTION - (Non Modificato) */
.advantages-section {
    padding: 80px 20px;
    background: #f8f9fa;
}

.section-title {
    font-size: 36px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 15px;
    color: #333;
}

.section-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 60px;
    font-size: 18px;
}

.advantages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.advantage-card {
    background: white;
    padding: 40px 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
    border: 1px solid #eee;
}

.advantage-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.card-icon {
    font-size: 40px;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.advantage-card h3 {
    font-size: 22px;
    margin-bottom: 15px;
    color: #333;
}

.advantage-card p {
    color: #666;
    line-height: 1.6;
}

/* QR GENERATOR SECTION - (Non Modificato) */
.qr-generator-section {
    padding: 80px 20px;
    background: white;
}

.qr-generator-container {
    max-width: 700px;
    margin: 0 auto;
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 1px solid #eee;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #f1f1f1;
    padding-bottom: 10px;
}

.tab-button {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #888;
    border-radius: 8px;
    transition: all 0.3s;
}

.tab-button.active {
    background-color: #eef2ff;
    color: #667eea;
}

.tab-button:hover:not(.active) {
    background-color: #f9f9f9;
}

.tab-content { display: none; animation: fadeIn 0.3s; }
.tab-content.active { display: block; }

/* FORM ELEMENTS - (Non Modificato) */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #444; }
.form-group input, .form-group select {
    width: 100%; padding: 12px; border: 2px solid #eee; border-radius: 8px; font-size: 15px; transition: 0.3s;
}
.form-group input:focus, .form-group select:focus {
    border-color: #667eea; outline: none;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }

.btn-large {
    width: 100%; padding: 16px; font-size: 18px; margin-top: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 700;
    transition: transform 0.2s;
}
.btn-large:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3); }

/* FAQ SECTION - (Non Modificato) */
.faq-section { padding: 80px 20px; background: #f8f9fa; }
.faq-container { max-width: 800px; margin: 0 auto; }

.faq-item {
    margin-bottom: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
}

.faq-question {
    width: 100%; padding: 20px 25px; background: white; border: none; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 17px; font-weight: 600; color: #333; text-align: left;
}
.faq-question:hover { background-color: #fcfcfc; }

.faq-question i { color: #667eea; transition: transform 0.3s; }
.faq-question.active i { transform: rotate(180deg); }

.faq-answer {
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; background: #fff;
}
.faq-answer.show { max-height: 300px; border-top: 1px solid #f1f1f1; }
.faq-answer p { padding: 20px 25px; color: #666; margin: 0; line-height: 1.6; }

/* UTILS - (Non Modificato) */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* RESPONSIVE - (Non Modificato) */
@media (max-width: 768px) {
    .hero-title { font-size: 36px; }
    .form-row { grid-template-columns: 1fr; }
    .hero-buttons { flex-direction: column; }
}

/* STILI SELEZIONE FRAME - (Non Modificato) */
.frame-selector {
    display: flex;
    gap: 15px;
}

.frame-option {
    cursor: pointer;
}

.frame-option input {
    display: none;
}

.frame-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    color: #555;
    transition: all 0.3s;
}

/* Quando selezionato - (Non Modificato) */
.frame-option input:checked + .frame-box {
    border-color: #667eea;
    background-color: #eef2ff;
    color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* CSS PER SELETTORI VISIVI (Cornici e Stili) - (Non Modificato) */
.visual-selector {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.selector-option {
    cursor: pointer;
    position: relative;
}

.selector-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.selector-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90px;
    height: 90px;
    background: #fff;
    border: 2px solid #eee;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    gap: 8px;
}

.selector-box i {
    font-size: 24px;
    color: #999;
}

/* Stato Selezionato - (Non Modificato) */
.selector-option input:checked + .selector-box {
    border-color: #667eea;
    background-color: #f4f6ff;
    color: #667eea;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.selector-option input:checked + .selector-box i {
    color: #667eea;
}

/* Hover Effect - (Non Modificato) */
.selector-box:hover {
    border-color: #ccc;
    transform: translateY(-2px);
}

/* --- LAYOUT GENERATORE CON ANTEPRIMA --- */
.generator-wrapper {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.generator-form {
    flex: 1;
}

/* CORREZIONE 1: Da PC, eliminiamo lo sforamento riportando il padding a 30px */
.generator-preview {
    width: 350px;
    position: sticky;
    top: 100px;
    background: white;
    padding: 30px; /* Riportato a 30px (20px + 300px QR + 20px = 340px) */
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    text-align: center;
    border: 1px solid #eee;
}

.preview-image-container {
    /* CORREZIONE 2: Rimuoviamo la larghezza fissa di 340px e usiamo la larghezza massima. */
    min-height: 340px; 
    width: 100%; /* Si adatta alla larghezza del genitore (350px - 60px padding = 290px max) */
    max-width: 340px; /* Limite massimo per evitare che diventi troppo grande */
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa; /* Sfondo chiaro per vedere i margini */
    border-radius: 10px;
    overflow: hidden; /* Manteniamo l'overflow hidden, ma gestiamo la dimensione del QR */
    border: 1px dashed #ccc; /* Rimetto il bordo tratteggiato per visibilità */
}

/* CORREZIONE 3: Assicuriamo che l'SVG (il QR code) si adatti al contenitore in modo reattivo */
#qr-canvas svg {
    /* Il QR 300x300 NON DEVE superare la larghezza del suo contenitore, che è 290px da PC */
    max-width: 100%; 
    height: auto;
    display: block;
}

.preview-label {
    font-size: 14px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.preview-image-container img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* RESPONSIVE: Su mobile l'anteprima va sotto o sopra */
@media (max-width: 900px) {
    .generator-wrapper {
        flex-direction: column-reverse;
    }
    .generator-preview {
        width: 100%;
        position: static;
        padding: 20px; /* Ridotto il padding su mobile */
    }
    /* CORREZIONE 4: Su mobile, dobbiamo garantire un'area sufficiente per il QR 300x300 */
    .preview-image-container {
        width: 90%; /* Occupa il 90% del genitore (che è largo 100%) */
        max-width: 340px; /* Mantiene un limite massimo */
        min-height: 310px; /* Assicura spazio */
        margin: 0 auto 20px;
    }
}