/* =========================================
   1. RESET & STRUTTURA DARK (Background)
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

.aff-fullscreen-dark {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh;
    background: #050505; 
    color: white; 
    z-index: 990; 
    overflow-y: auto; 
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: flex; 
    justify-content: center; 
    align-items: flex-start;
    padding: 60px 20px; 
    box-sizing: border-box;
    color-scheme: dark; 
}

.aff-glow-bg.blue {
    position: fixed; 
    top: -20%; 
    right: -20%; 
    width: 60vw; 
    height: 60vw;
    background: #4cc9f0; 
    filter: blur(150px); 
    opacity: 0.15; 
    pointer-events: none;
    z-index: 0;
}

/* La Card Principale - FIX ALTEZZA FISSA */
.aff-card-dark {
    background: #111; 
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px; 
    padding: 50px; 
    width: 100%; 
    max-width: 600px;
    position: relative; 
    z-index: 10; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    margin: 0 auto; 
    
    /* FIX UX: Altezza stabile */
    min-height: 800px; 
    display: flex;
    flex-direction: column;
}
.aff-card-dark.wide { max-width: 950px; }

/* FIX UX: Occupare lo spazio vuoto per bloccare i bottoni in basso */
#aff_landlord_form {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.aff-step.active {
    display: block;
    flex: 1; 
}

.aff-wizard-nav { 
    margin-top: auto !important; 
    padding-top: 30px;
    display: flex; 
    justify-content: space-between; 
    border-top: 1px solid rgba(255,255,255,0.1); 
}

/* =========================================
   2. HEADER & PROGRESS BAR
   ========================================= */
.aff-wizard-header { margin-bottom: 30px; }

.aff-step-title { 
    font-size: 0.9rem; color: #888; font-weight: 600; 
    text-transform: uppercase; letter-spacing: 1px; 
}

.aff-progress-track {
    width: 100%; height: 6px; background: rgba(255,255,255,0.1);
    border-radius: 10px; margin-top: 15px; overflow: hidden;
}

.aff-progress-fill {
    height: 100%; background: #4cc9f0; width: 20%; 
    border-radius: 10px; transition: width 0.4s ease;
    box-shadow: 0 0 10px rgba(76, 201, 240, 0.5);
}

.aff-step { display: none; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   3. INPUT & CAMPI
   ========================================= */
.aff-input-group { margin-bottom: 25px; position: relative; }
.aff-input-group label { display: block; color: #ccc; margin-bottom: 10px; font-weight: 600; font-size: 0.9rem; }

.aff-input-dark {
    position: relative; 
    background: rgba(255,255,255,0.05) !important; 
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 12px !important; 
    display: flex; 
    align-items: center !important; 
    padding: 0 15px !important;
    height: 55px !important; 
    transition: 0.3s; 
    width: 100%; 
    box-sizing: border-box;
}

.aff-input-dark[style*="display: none"] { display: none !important; }
.aff-input-dark:focus-within { border-color: #4cc9f0 !important; background: rgba(255,255,255,0.08) !important; }

.aff-card-dark input[type="text"],
.aff-card-dark input[type="number"],
.aff-card-dark input[type="email"],
.aff-card-dark input[type="password"],
.aff-card-dark input[type="date"],
.aff-card-dark select,
.aff-card-dark textarea {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    box-shadow: none !important;
    outline: none !important;
    width: 100% !important;
    font-size: 1rem !important;
    font-family: inherit !important;
    padding: 0 !important;
    margin: 0 !important;
}

.aff-card-dark input[type="text"],
.aff-card-dark input[type="number"],
.aff-card-dark input[type="email"],
.aff-card-dark input[type="password"],
.aff-card-dark input[type="date"],
.aff-card-dark select { height: 100% !important; }

.aff-card-dark select option { background-color: #1a1a1a !important; color: #ffffff !important; }

.aff-card-dark input:-webkit-autofill,
.aff-card-dark input:-webkit-autofill:hover, 
.aff-card-dark input:-webkit-autofill:focus, 
.aff-card-dark select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px #1a1a1a inset !important;
    -webkit-text-fill-color: #ffffff !important;
    transition: background-color 5000s ease-in-out 0s;
}

.icon { margin-right: 12px; opacity: 0.7; font-size: 1.2rem; display: flex; align-items: center; }

/* TENDINA INDIRIZZI */
.aff-suggestions-list {
    position: absolute; top: 100%; left: 0; width: 100%;
    background: #1a1a1a !important; border: 1px solid #444; border-radius: 0 0 12px 12px;
    z-index: 9999999 !important; max-height: 250px; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.9); display: none; 
}
.aff-suggestion-item { padding: 15px; border-bottom: 1px solid #333; cursor: pointer; font-size: 0.95rem; color: #ddd; transition: 0.2s; display: flex; align-items: center; background: #1a1a1a; }
.aff-suggestion-item:hover { background: #333; color: #fff; }
.aff-suggestion-item:last-child { border-bottom: none; }

#aff_locate_btn { opacity: 0.7; transition: 0.2s; }
#aff_locate_btn:hover { opacity: 1; transform: scale(1.1); }
.aff-map-dark { width: 100%; height: 250px; border-radius: 12px; margin-top: 15px; background: #222; border: 1px solid #333; }

/* =========================================
   4. RADIO CARDS E CHECKBOX (Desktop)
   ========================================= */
.aff-radio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; width: 100%; }
.aff-check-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; }

.aff-radio-card, .aff-check-card { position: relative; height: 100%; width: 100%; }
.aff-radio-card input, .aff-check-card input { position: absolute; opacity: 0; width: 0; height: 0; }

.aff-radio-card label, .aff-check-card label {
    display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 10px; 
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; 
    padding: 15px 10px; cursor: pointer; transition: 0.2s; font-weight: 600; color: #ccc; text-align: center; 
    height: 100%; min-height: 60px; box-sizing: border-box;
}

.aff-check-card label { height: 45px; min-height: 45px; border-radius: 8px; font-size: 0.85rem; padding: 0 10px; white-space: nowrap; }

.aff-radio-card label:hover, .aff-check-card label:hover { background: rgba(255,255,255,0.1); border-color: #666; transform: translateY(-1px); }

.aff-radio-card input:checked + label, .aff-check-card input:checked + label {
    background: rgba(76, 201, 240, 0.15); border-color: #4cc9f0; color: #fff; box-shadow: 0 0 15px rgba(76, 201, 240, 0.2) inset;
}

.aff-checkbox-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aff-checkbox-item { position: relative; }
.aff-checkbox-item input { position: absolute; opacity: 0; }
.aff-checkbox-item label {
    display: flex; align-items: center; padding: 12px 15px; border-radius: 8px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1); cursor: pointer; color: #aaa; transition: 0.2s; font-size: 0.9rem;
}
.aff-checkbox-item label::before {
    content: ''; display: inline-block; width: 18px; height: 18px; border: 2px solid #555; border-radius: 4px; margin-right: 10px; transition: 0.2s;
}
.aff-checkbox-item input:checked + label { background: rgba(76, 201, 240, 0.1); border-color: #4cc9f0; color: #fff; }
.aff-checkbox-item input:checked + label::before { background: #4cc9f0; border-color: #4cc9f0; }

/* =========================================
   5. TITOLI, CONTATORI E TEXTAREA
   ========================================= */
.aff-card-dark h2 { color: #ffffff !important; }
.aff-card-dark h3, .aff-card-dark h4 { color: #4cc9f0 !important; }
.aff-card-dark p { color: #aaaaaa !important; }

.aff-stepper { 
    display: flex !important; align-items: center !important; justify-content: space-between !important; 
    background: rgba(255,255,255,0.05) !important; border: 1px solid rgba(255,255,255,0.1) !important; 
    border-radius: 12px !important; padding: 5px !important; width: 100% !important; height: 55px !important; box-sizing: border-box !important; 
}
.aff-stepper-btn { 
    width: 45px !important; height: 100% !important; background: rgba(255,255,255,0.1) !important; border: none !important; border-radius: 8px !important; 
    color: #fff !important; font-size: 1.5rem !important; font-weight: 300 !important; cursor: pointer !important; display: flex !important; 
    align-items: center !important; justify-content: center !important; transition: 0.2s !important; padding: 0 !important; margin: 0 !important;
}
.aff-stepper-btn:hover { background: rgba(255,255,255,0.2) !important; transform: scale(1.05); }
.aff-stepper-value { 
    flex: 1 !important; text-align: center !important; background: transparent !important; border: none !important; color: #fff !important; 
    -webkit-text-fill-color: #fff !important; font-size: 1.2rem !important; font-weight: 700 !important; pointer-events: none !important; height: 100% !important; 
}

.aff-input-dark.textarea-box { height: auto !important; min-height: 140px; align-items: flex-start !important; padding: 15px !important; }
.aff-input-dark.textarea-box textarea { width: 100% !important; height: 100% !important; min-height: 110px; resize: vertical !important; }

/* =========================================
   6. BOTTONI NAVIGAZIONE
   ========================================= */
.aff-btn-back { background: transparent !important; color: #888 !important; border: none !important; font-weight: 600; cursor: pointer; font-size: 1rem; padding: 10px 20px; }
.aff-btn-back:hover { color: #fff !important; }
.aff-btn-next { border: none !important; padding: 12px 35px !important; border-radius: 50px !important; font-weight: 800 !important; cursor: pointer; transition: all 0.3s ease !important; font-size: 1rem !important; }
#nextBtn.aff-btn-next { background: #4cc9f0 !important; color: #000 !important; }
#nextBtn.aff-btn-next:hover { background: #5ee0ff !important; transform: translateX(5px) !important; box-shadow: 0 0 20px rgba(76,201,240,0.6) !important; }
#aff_landlord_submit.aff-btn-next { background: #00c455 !important; color: #fff !important; }
#aff_landlord_submit.aff-btn-next:hover { background: #00d95e !important; transform: translateX(5px) !important; box-shadow: 0 0 20px rgba(0,196,85,0.6) !important; }

/* =========================================
   7. PRIVACY PREMIUM LANDLORD
   ========================================= */
.aff-legal-checkbox-box {
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-top: 25px;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
}

.aff-legal-checkbox-box:focus-within,
.aff-legal-checkbox-box:hover {
    border-color: #4cc9f0; /* Azzurro Proprietario */
}

.aff-legal-checkbox-box input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid #4cc9f0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    position: relative;
    margin-top: 2px;
    transition: all 0.3s ease;
}

.aff-legal-checkbox-box input[type="checkbox"]:checked {
    background: #4cc9f0;
}

/* Spunta nera a V */
.aff-legal-checkbox-box input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.aff-legal-checkbox-box label {
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.5;
    cursor: pointer;
    margin: 0;
}

.aff-legal-checkbox-box label a {
    color: #4cc9f0; 
    text-decoration: none;
    font-weight: 700;
    transition: opacity 0.3s;
}

.aff-legal-checkbox-box label a:hover {
    opacity: 0.7;
}

/* =========================================
   8. OTP E VERIFICA EMAIL
   ========================================= */
.aff-btn-inline { background: #4cc9f0 !important; color: #000 !important; border: none !important; padding: 0 15px !important; height: 36px !important; border-radius: 8px !important; font-size: 0.8rem !important; font-weight: 800 !important; cursor: pointer; margin-left: 10px; white-space: nowrap; }
.aff-otp-box { background: rgba(76, 201, 240, 0.1); border: 1px solid #4cc9f0; padding: 15px; border-radius: 12px; margin-top: 15px; text-align: center; }
.aff-otp-box label { display: block !important; color: #ffffff !important; font-size: 1rem !important; font-weight: 600 !important; margin-bottom: 10px !important; text-align: center !important; }
#ll_otp_code { background: rgba(0, 0, 0, 0.5) !important; border: 2px solid #4cc9f0 !important; border-radius: 8px !important; color: #fff !important; height: 45px !important; font-size: 1.2rem !important; letter-spacing: 4px !important; }
.aff-toggle-pwd:hover { opacity: 1 !important; color: #4cc9f0 !important; }

/* =========================================
   9. FOTO & LIGHTBOX
   ========================================= */
.aff-upload-dark { background: rgba(255,255,255,0.05); border: 2px dashed rgba(255,255,255,0.2); border-radius: 12px; padding: 20px; color: #888; transition: 0.3s; }
.aff-upload-dark:hover { border-color: #4cc9f0; color: #fff; background: rgba(255,255,255,0.08); }
#aff_preview_container { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.aff-photo-item { position: relative; width: 90px; height: 90px; border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,0.2); cursor: zoom-in; }
.aff-photo-item img { width: 100%; height: 100%; object-fit: cover; }
.aff-remove-photo { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; background: #ff4d4d; color: white; border-radius: 50%; text-align: center; line-height: 20px; font-size: 14px; font-weight: bold; cursor: pointer; z-index: 5; }

/* =========================================
   9. LIGHTBOX (ZOOM FOTO) ULTRA-CENTRATO
   ========================================= */
.aff-lightbox { position: fixed !important; top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important; background: rgba(0,0,0,0.95) !important; z-index: 9999999 !important; display: none; align-items: center !important; justify-content: center !important; flex-direction: column !important; margin: 0 !important; padding: 0 !important; box-sizing: border-box !important; }
.aff-lightbox-content { position: relative !important; display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important; width: 100% !important; height: 100% !important; }
.aff-lightbox-content img { max-width: 90vw !important; max-height: 80vh !important; border-radius: 8px !important; box-shadow: 0 0 30px rgba(0,0,0,0.8) !important; object-fit: contain !important; margin: auto !important; }
.aff-lb-prev, .aff-lb-next { position: absolute !important; top: 50% !important; transform: translateY(-50%) !important; background: rgba(255,255,255,0.1) !important; color: white !important; width: 60px !important; height: 60px !important; border-radius: 50% !important; display: flex !important; align-items: center !important; justify-content: center !important; font-size: 28px !important; cursor: pointer !important; transition: 0.3s !important; z-index: 10 !important;}
.aff-lb-prev:hover, .aff-lb-next:hover { background: rgba(76, 201, 240, 0.5) !important; }
.aff-lb-prev { left: 40px !important; } 
.aff-lb-next { right: 40px !important; }
.aff-lightbox-close { position: absolute !important; top: 30px !important; right: 40px !important; font-size: 45px !important; cursor: pointer !important; color: #fff !important; z-index: 10 !important; transition: 0.3s !important; line-height: 1 !important; }
.aff-lightbox-close:hover { color: #ff4d4d !important; }

/* =========================================
   📱 10. MOBILE OPTIMIZATION (IL FIX VERO)
   ========================================= */
@media (max-width: 768px) {
    .aff-fullscreen-dark { padding: 0 !important; align-items: flex-start; }
    .aff-card-dark { 
        padding: 25px 20px !important; margin: 0 auto !important; width: 100% !important; 
        border-radius: 0 0 24px 24px !important; border-left: none !important; border-right: none !important; min-height: 100vh; 
    }
    
    .aff-step h2 { font-size: 1.4rem !important; }
    .aff-input-group label { font-size: 0.85rem !important; }
    .aff-input-dark { height: 50px !important; }

    /* FIX: TUTTE le griglie in 1 colonna */
    .aff-grid-2, .aff-grid-3, .aff-grid-4, .aff-checkbox-list, .aff-accessories-grid,
    .aff-step div[style*="grid-template-columns"],
    .aff-radio-grid, .aff-check-grid { 
        grid-template-columns: 1fr !important; 
        gap: 10px !important;
        display: grid !important;
    }

    /* FIX: Sblocca testo schiacciato e accavallato */
    .aff-check-card label, .aff-radio-card label {
        white-space: normal !important; /* Libera il testo! */
        height: auto !important;
        min-height: 55px !important;
        line-height: 1.3 !important;
        padding: 12px 15px !important;
    }

    /* FIX: Spezza i campi in linea forzati (es: Città / CAP) */
    .aff-step > div[style*="display: flex"],
    .aff-step > div[style*="display:flex"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    .aff-wizard-nav { flex-direction: column-reverse !important; gap: 15px !important; margin-top: 20px !important; padding-bottom: 30px !important; }
    .aff-btn-next, .aff-btn-back { width: 100% !important; padding: 16px !important; font-size: 1.1rem !important; text-align: center; }

    .aff-otp-box > div[style*="flex"] { flex-direction: column !important; }
    #ll_otp_code { width: 100% !important; margin-bottom: 10px !important; }
    #ll_verifyOtpBtn { width: 100% !important; padding: 15px !important; }
    
    .aff-input-dark.has-button { flex-direction: column; height: auto !important; background: transparent !important; border: none !important; }
    .aff-input-dark.has-button input { background: #1a1a1a !important; border: 1px solid rgba(255,255,255,0.15) !important; padding: 15px !important; border-radius: 12px !important; margin-bottom: 10px; }
    .aff-input-dark.has-button .icon { display: none; }
    #ll_sendOtpBtn { width: 100% !important; margin: 0 !important; padding: 15px !important; height: auto !important; }

    /* =========================================
       📸 FIX ANTEPRIME E LIGHTBOX MOBILE
       ========================================= */
    #aff_preview_container { 
        justify-content: center; 
    }
    
    /* 3 foto per riga perfette su cellulare */
    .aff-photo-item { 
        width: calc(33.333% - 10px) !important; 
        height: 90px !important; 
    }
    
    /* Ridimensiona lo zoom per non uscire dallo schermo */
    .aff-lightbox-content img { 
        max-width: 95vw !important; 
        max-height: 70vh !important; 
    }
    
    /* Rimpicciolisce le freccette laterali e le rende più visibili */
    .aff-lb-prev, .aff-lb-next { 
        width: 40px !important; 
        height: 40px !important; 
        font-size: 18px !important; 
        background: rgba(0,0,0,0.6) !important; /* Sfondo scuro per contrasto */
    }
    .aff-lb-prev { left: 10px !important; }
    .aff-lb-next { right: 10px !important; }
    .aff-lightbox-close { top: 15px !important; right: 20px !important; font-size: 35px !important; }
}

/* =========================================
   11. MODALE TESTI LEGALI (POPUP) PROPRIETARIO
   ========================================= */
.aff-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 9999999 !important; /* Sopra a tutto il resto */
    display: none; justify-content: center; align-items: center;
}

.aff-legal-box {
    background: #111; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px; width: 95%; max-width: 850px;
    padding: 40px 30px; position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.aff-modal-close {
    position: absolute; top: 20px; right: 20px;
    background: transparent; border: none; color: #fff; cursor: pointer;
    transition: 0.3s; z-index: 10;
}
.aff-modal-close:hover { color: #4cc9f0; transform: scale(1.1); } /* Colore azzurro */

/* Area che scorre internamente */
.aff-legal-content-scroll {
    max-height: 70vh; overflow-y: auto; padding-right: 15px;
}

/* Scrollbar personalizzata Proprietario (Azzurro) */
.aff-legal-content-scroll::-webkit-scrollbar { width: 6px; }
.aff-legal-content-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 10px; }
.aff-legal-content-scroll::-webkit-scrollbar-thumb { background: #4cc9f0; border-radius: 10px; } /* Colore azzurro */

/* Testi interni */
.legal-text-content h2 { font-size: 2rem; color: #fff; margin-top: 0; margin-bottom: 25px; text-align: left; }
.legal-body { color: #ccc; font-size: 1rem; line-height: 1.7; text-align: left; }
.legal-body h3, .legal-body strong { color: #fff; margin-top: 25px; margin-bottom: 10px; display: block; }
.legal-body p { margin-bottom: 15px; }

@media (max-width: 768px) {
    .aff-legal-box { padding: 30px 20px; }
    .legal-text-content h2 { font-size: 1.6rem; }
    .legal-body { font-size: 0.95rem; }
    .aff-legal-content-scroll { max-height: 75vh; }
}