/* ==========================================================================
   STILE GRAFICO DELLA FINESTRA POP-UP (MODALE CODICI ACQUISTO)
   ========================================================================== */
.modale-sfondo-oscurato {
    display: none; /* Nascosto di default, viene attivato dal click */
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(1, 5, 51, 0.85) !important; /* Oscuramento scuro bluastro coordinato */
    z-index: 999999 !important; /* In primissimo piano sopra ogni cosa */
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modale-finestra-contenitore {
    background-color: #1e044b !important;
    width: 100%;
    max-width: 850px;
    max-height: 85vh;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: comparsaPopUp 0.3s ease-out;
}

@keyframes comparsaPopUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- HEADER POP-UP --- */
.modale-header {
    background-color: #fff6ca !important; /* Giallo crema coordinato */
    padding: 20px 25px !important;
    border-bottom: 3px solid #cd940f !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modale-header h2 {
    color: #010533 !important;
    font-size: 1.3rem !important;
    font-weight: 900 !important;
    margin: 0 !important;
    letter-spacing: 0.5px;
}

.pulsante-chiudi-modale {
    color: #a0a0a0;
    font-size: 2.2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.pulsante-chiudi-modale:hover { color: #EA0000; }

/* --- CORPO FLUIDO CON SCROLL INTERNO --- */
.modale-body-scroll {
    padding: 25px !important;
    overflow-y: auto !important; /* Crea la barra di scorrimento interna se i marchi sono molti */
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.categoria-pop-blocco h3 {
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.95rem !important;
    color: #cd940f !important; /* Colore oro per i titoli delle categorie */
    font-weight: 700 !important;
    border-left: 4px solid #004094;
    padding-left: 10px !important;
    margin-bottom: 15px !important;
    letter-spacing: 0.5px;
}

/* --- GRIGLIA INTERNA DEI MARCHI --- */
.griglia-marchi-pop {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important; /* Disposizione intelligente */
    gap: 12px !important;
}

/* --- CONFIGURAZIONE RIQUADRO SINGOLO MARCHIO (Fusa e Corretta) --- */
.marchio-item {
    background-color: #ffffff !important; /* Fondo bianco candido per esaltare i loghi */
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    height: 55px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center;
    padding: 6px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: #010533 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03) !important;
    overflow: hidden !important;
    transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out, border-color 0.15s ease-in-out !important;
}

/* Effetto zoom controllato se l'utente ci passa sopra con il mouse */
.marchio-item:hover {
    transform: scale(1.5) !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
    border-color: #cd940f !important; /* Evidenzia il contorno con l'oro antico */
}

/* --- INTEGRAZIONE INTEGRALE LOGHI (Regola fondamentale anti-deformazione) --- */
.logo-marchio {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;  /* Impedisce al logo di toccare il bordo destro/sinistro */
    max-height: 100% !important; /* Impedisce al logo di toccare il bordo superiore/inferiore */
    object-fit: contain !important; /* Mantiene rigorosamente le proporzioni geometriche native */
}

/* ==========================================================================
   OTTIMIZZAZIONE RESPONSIVE PER SMARTPHONE (Schermi < 600px)
   ========================================================================== */
@media (max-width: 600px) {
    .modale-finestra-contenitore { max-height: 90vh; }
    .modale-header h2 { font-size: 1.05rem !important; }
    .griglia-marchi-pop { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; } /* Due colonne stabili su mobile */
    .modale-body-scroll { padding: 15px !important; gap: 20px; }
    
    /* Riduce proporzionalmente l'altezza del riquadro sui telefoni per non allungare le immagini */
    .marchio-item { height: 48px !important; padding: 4px !important; } 
}


