@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* =========================================
   1. RESET E STRUTTURA
   ========================================= */
.aff-fullscreen-dark, .aff-fullscreen-dark * {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    box-sizing: border-box !important;
}

.aff-fullscreen-dark {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: #050505; color: white; 
    z-index: 990; /* FIX RECAPTCHA: Abbassato da 99999 a 990 per far apparire il logo Google e il banner privacy */
    display: flex; justify-content: center; align-items: flex-start;
    padding: 20px; overflow-y: auto;
}

.aff-glow-bg.purple {
    position: fixed; top: -20%; left: -20%; width: 60vw; height: 60vw;
    background: #bd00ff; filter: blur(150px); opacity: 0.15; pointer-events: none;
}

.aff-card-dark {
    background: #111; 
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px; 
    padding: 35px 40px; 
    width: 100%; max-width: 750px;
    margin: 40px auto; 
    position: relative; z-index: 10; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

/* =========================================
   2. HEADER E MAPPA
   ========================================= */
.aff-wizard-header { margin-bottom: 25px; text-align: left; }
.aff-step-title { font-size: 0.85rem; 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: 10px; overflow: hidden; }
.aff-progress-fill { height: 100%; background: #bd00ff; width: 20%; transition: width 0.4s ease; box-shadow: 0 0 10px rgba(189, 0, 255, 0.5); }

#aff_map_canvas, .aff-map-dark {
    width: 100% !important; height: 250px !important;
    border-radius: 12px; margin-top: 15px; background: #222; border: 1px solid #444;
    display: block !important;
}

/* =========================================
   3. INPUT, TENDINE E CONTATORI
   ========================================= */
.aff-input-group { margin-bottom: 25px; position: relative; width: 100%; }
.aff-input-group label { display: block; color: #ccc; margin-bottom: 10px; font-weight: 600; font-size: 0.95rem; margin-top: 0 !important; }

.aff-input-dark {
    background: #1a1a1a !important; border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px; display: flex; align-items: center; 
    padding: 0 15px; height: 55px; width: 100%; position: relative; transition: 0.2s;
}
.aff-input-dark:focus-within { border-color: #bd00ff; background: #222 !important; }
.aff-input-dark input, .aff-input-dark textarea {
    background: transparent !important; border: none; color: #fff !important; width: 100%; font-size: 1rem; outline: none; height: 100%;
}

.aff-input-dark select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-color: #1a1a1a !important; color: #fff !important;
    border: none; width: 100%; height: 100%; font-size: 1rem; cursor: pointer; outline: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 15px center; background-size: 16px; padding-right: 40px;
}
.aff-input-dark option { background-color: #111; color: #fff; padding: 10px; }

/* Stepper (+ / -) */
.aff-stepper {
    display: flex; align-items: center; justify-content: space-between;
    background: #1a1a1a; border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px; padding: 5px; width: 100%; height: 60px;
}
.aff-stepper-btn {
    width: 50px; height: 100%; background: #333; border: none;
    border-radius: 8px; color: #fff; font-size: 1.5rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: 0.2s;
}
.aff-stepper-btn:hover { background: #555; }
.aff-stepper-value {
    flex: 1; text-align: center; background: transparent; border: none;
    color: #fff; font-size: 1.2rem; font-weight: bold; pointer-events: none;
}

/* =========================================
   4. LISTE E RADIO
   ========================================= */
.aff-radio-grid { display: flex !important; flex-direction: column !important; gap: 12px !important; width: 100% !important; }
.aff-radio-card { width: 100%; }
.aff-radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.aff-radio-card label {
    display: flex !important; align-items: center !important; justify-content: flex-start !important;
    padding: 0 25px !important; gap: 15px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px !important; cursor: pointer; transition: 0.2s;
    font-weight: 600; font-size: 1rem !important; color: #ccc; 
    width: 100%; min-height: 60px !important;
}
.aff-radio-card input:checked + label {
    background: rgba(189, 0, 255, 0.15); border-color: #bd00ff; color: #fff;
    box-shadow: 0 0 15px rgba(189, 0, 255, 0.2) inset;
}

.aff-checkbox-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.aff-checkbox-item input { position: absolute; opacity: 0; pointer-events: none; }
.aff-checkbox-item label {
    display: flex; align-items: center; padding: 15px; border-radius: 10px;
    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.95rem;
}
.aff-checkbox-item label::before {
    content: ''; display: inline-block; width: 20px; height: 20px;
    border: 2px solid #555; border-radius: 4px; margin-right: 15px;
}
.aff-checkbox-item input:checked + label { background: rgba(189, 0, 255, 0.1); border-color: #bd00ff; color: #fff; }
.aff-checkbox-item input:checked + label::before { background: #bd00ff; border-color: #bd00ff; }

/* =========================================
   5. TASTI E NAVIGAZIONE
   ========================================= */
.aff-btn-inline {
    background: #bd00ff !important; color: #fff !important; border: none !important;
    padding: 0 20px !important; height: 38px !important; border-radius: 8px !important;
    font-weight: 700 !important; cursor: pointer; margin-left: 10px;
}
#aff_tenant_locate_btn { background: transparent; border: none; cursor: pointer; color: #bd00ff; font-size: 1.3rem; padding: 0 10px; }

.aff-wizard-nav { 
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); 
}
.aff-btn-back { background: transparent; color: #888; border: none; font-weight: 600; cursor: pointer; }
.aff-btn-next { 
    background: #bd00ff; color: #fff; border: none; padding: 14px 45px; 
    border-radius: 50px; font-weight: 700; font-size: 1rem; cursor: pointer; 
    transition: 0.3s; box-shadow: 0 4px 15px rgba(189, 0, 255, 0.3);
}
.aff-btn-next:hover { transform: translateY(-2px); background: #d04dff; }

/* =========================================
   6. ERRORI, SUCCESSO E STEP
   ========================================= */
label.error, .jquery-validation-error {
    display: block !important; width: 100%; text-align: left; margin-top: 6px;
    color: #ff4d4d !important; font-size: 0.85rem; position: static !important;
}
.aff-general-error {
    display: none; width: 100%; margin-top: 20px;
    background: rgba(255, 77, 77, 0.15); border: 1px solid #ff4d4d;
    color: #ff4d4d; padding: 15px; border-radius: 8px; text-align: center; font-weight: 600;
}

#aff_success_container { width: 100%; text-align: center; padding-top: 20px; }
.aff-step { display: none; width: 100%; }
.aff-step.active { display: block; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile */
@media(max-width: 600px) {
    .aff-card-dark { padding: 25px; width: 95%; margin: 20px auto; }
    .aff-checkbox-list { grid-template-columns: 1fr; }
    .aff-wizard-nav { flex-direction: column-reverse; gap: 15px; }
    .aff-btn-next, .aff-btn-back { width: 100%; }
}

/* =========================================
   CALENDARIO CUSTOM (FLATPICKR) - FIX NUCLEARE
   ========================================= */
/* Aggiungiamo .aff-fullscreen-dark davanti per vincere la priorità CSS */

/* BOX CALENDARIO */
.aff-fullscreen-dark .flatpickr-calendar,
.flatpickr-calendar {
    background: #1a1a1a !important;
    border: 1px solid rgba(189, 0, 255, 0.5) !important; /* Bordo Viola */
    border-radius: 16px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.9) !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    padding: 10px !important;
    width: 330px !important;
    max-width: 90vw !important; /* Mobile friendly */
    z-index: 9999999 !important;
}

.flatpickr-calendar.arrowTop:before, .flatpickr-calendar.arrowTop:after {
    border-bottom-color: #1a1a1a !important;
}

/* HEADER */
.flatpickr-month {
    color: #fff !important;
    fill: #fff !important;
    margin-bottom: 10px !important;
    height: 40px !important;
}
.flatpickr-current-month {
    padding-top: 5px !important;
    font-size: 1rem !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: #1a1a1a !important;
    color: #fff !important;
    font-weight: 700 !important;
    appearance: none;
}
.flatpickr-current-month input.cur-year {
    color: #fff !important;
    font-weight: 700 !important;
}

/* --- FIX FRECCE --- */
/* Target specifico per sovrascrivere tutto */
.flatpickr-month .flatpickr-prev-month, 
.flatpickr-month .flatpickr-next-month {
    top: 5px !important;
    padding: 10px !important;
}

/* STATO NORMALE: VIOLA */
.flatpickr-month .flatpickr-prev-month svg, 
.flatpickr-month .flatpickr-next-month svg,
.flatpickr-month .flatpickr-prev-month svg path, 
.flatpickr-month .flatpickr-next-month svg path {
    fill: #bd00ff !important;
    stroke: #bd00ff !important;
    color: #bd00ff !important;
    width: 14px !important; height: 14px !important;
    transition: all 0.2s ease !important;
}

/* STATO HOVER: ROSSO */
.flatpickr-month .flatpickr-prev-month:hover svg, 
.flatpickr-month .flatpickr-next-month:hover svg,
.flatpickr-month .flatpickr-prev-month:hover svg path, 
.flatpickr-month .flatpickr-next-month:hover svg path {
    fill: #ff0000 !important;
    stroke: #ff0000 !important;
    color: #ff0000 !important;
}

/* --- GRIGLIA GIORNI --- */
.flatpickr-innerContainer, .flatpickr-rContainer, .flatpickr-days, .dayContainer {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}
.dayContainer {
    display: flex !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    padding: 0 !important;
}

/* SINGOLO GIORNO */
.flatpickr-day {
    color: #ccc !important;
    border-radius: 8px !important;
    border: 1px solid transparent !important;
    transition: 0.2s;
    font-weight: 500;
    font-size: 0.95rem;
    
    /* Griglia perfetta 7 colonne */
    flex-basis: 14.28% !important; 
    max-width: 14.28% !important;
    height: 38px !important;
    line-height: 38px !important;
    margin: 0 !important;
}

.flatpickr-day:hover {
    background: rgba(255,255,255,0.1) !important;
    color: #fff !important;
}

.flatpickr-day.today {
    border-color: #bd00ff !important;
    color: #fff !important;
}

.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange,
.flatpickr-day.selected.inRange, .flatpickr-day.startRange.inRange, .flatpickr-day.endRange.inRange {
    background: #bd00ff !important;
    color: #fff !important;
    border-color: #bd00ff !important;
    box-shadow: 0 4px 10px rgba(189, 0, 255, 0.4);
}

.flatpickr-day.flatpickr-disabled {
    color: #333 !important;
    background: transparent !important;
}
/* =========================================
   AGGIUNTA: LISTA SUGGERIMENTI GOOGLE MAPS
   ========================================= */
#aff_suggestions_box {
    position: absolute;
    top: 100%; /* Subito sotto l'input */
    left: 0;
    width: 100%;
    background: #1a1a1a; /* Sfondo scuro come l'input */
    border: 1px solid rgba(255,255,255,0.15);
    border-top: none;
    border-radius: 0 0 12px 12px;
    z-index: 9999; /* Sopra a tutto, anche alla mappa */
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    display: none; /* Nascosto di base */
    margin-top: 5px;
}

.aff-suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #ccc;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.aff-suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 2px solid #bd00ff;
    border-top: none;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 30px rgba(189, 0, 255, 0.2);
}

.aff-suggestions-list::-webkit-scrollbar {
    width: 6px;
}

.aff-suggestions-list::-webkit-scrollbar-track {
    background: rgba(189, 0, 255, 0.1);
    border-radius: 10px;
}

.aff-suggestions-list::-webkit-scrollbar-thumb {
    background: #bd00ff;
    border-radius: 10px;
}

.aff-suggestions-list::-webkit-scrollbar-thumb:hover {
    background: #9a00cc;
}

.aff-suggestion-item:last-child {
    border-bottom: none;
}

.aff-suggestion-item:hover {
    background: rgba(189, 0, 255, 0.15); /* Viola Inquilino al passaggio */
    color: #fff;
    padding-left: 20px; /* Piccolo movimento sciccoso */
}
/* =========================================
   7. FIX DECISIVO PER CENTRARE IL FORM (PAGINA 54)
   ========================================= */

/* Questo prende il contenitore principale di Astra SOLO in questa pagina
   e lo trasforma in una "Card" centrata, ignorando il Full Width */

body.page-id-54 .entry-content,
body.page-id-54 .ast-container {
    max-width: 650px !important;       /* Stringe il form a una larghezza umana */
    margin: 40px auto !important;      /* Lo centra nello schermo */
    display: block !important;
    
    /* STILE "CARD" (Uguale al tuo .aff-card-dark) */
    background: #111 !important;       
    padding: 40px !important;          
    border-radius: 24px !important;    
    border: 1px solid rgba(255,255,255,0.1) !important; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.5) !important;
}

/* Fix per mobile: su schermi piccoli usa quasi tutto lo spazio */
@media (max-width: 768px) {
    body.page-id-54 .entry-content,
    body.page-id-54 .ast-container {
        max-width: 92% !important;
        padding: 20px !important;
        margin-top: 20px !important;
    }
}
/* =========================================
   TOGGLE PASSWORD (Occhietto)
   ========================================= */
.aff-toggle-pwd:hover {
    opacity: 1 !important;
    color: #bd00ff !important;
}
#otp_code_input:focus {
    box-shadow: 0 0 10px rgba(189, 0, 255, 0.4) !important;
    background: rgba(0, 0, 0, 0.8) !important;
}
/* Forza il logo reCAPTCHA a stare in primissimo piano sopra tutto */
.grecaptcha-badge {
    z-index: 9999999 !important;
    visibility: visible !important;
}

/* =========================================
   FIX UX: ALTEZZA FORM, SCROLL E PRIVACY
   ========================================= */

/* 1. Stabilizza l'altezza della card (Evita l'effetto "fisarmonica") */
.aff-card-dark {
    min-height: 700px; /* Altezza fissa minima per non far saltare l'occhio */
    display: flex;
    flex-direction: column;
}

/* 2. Spinge i bottoni di navigazione sempre in basso */
.aff-wizard-nav {
    margin-top: auto !important; /* Il trucco magico per incollarli sul fondo */
    padding-top: 30px;
}

/* 3. Design Premium per il Checkbox Privacy (Non si schiaccia su Mobile) */
.aff-legal-checkbox {
    display: flex;
    align-items: flex-start; /* Allinea il testo in alto rispetto al quadratino */
    gap: 15px;
    margin-top: 25px;
    padding: 18px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    transition: 0.3s;
}
.aff-legal-checkbox:hover { border-color: rgba(189, 0, 255, 0.5); background: rgba(189, 0, 255, 0.05); }

/* Personalizziamo il quadratino */
.aff-legal-checkbox input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 24px; height: 24px;
    border: 2px solid #bd00ff;
    border-radius: 6px;
    background: #111;
    cursor: pointer;
    position: relative;
    flex-shrink: 0; /* IMPEDISCE AL QUADRATINO DI SCHIACCIARSI! */
    margin-top: 2px;
    transition: 0.2s;
}
.aff-legal-checkbox input[type="checkbox"]:checked { background: #bd00ff; }
.aff-legal-checkbox input[type="checkbox"]:checked::after {
    content: '✔'; position: absolute; color: white; font-weight: bold;
    font-size: 14px; top: 50%; left: 50%; transform: translate(-50%, -50%);
}

.aff-legal-checkbox label { font-size: 0.9rem; color: #aaa; line-height: 1.5; cursor: pointer; margin: 0; width: 100%; }
.aff-legal-checkbox label a { color: #00c455; text-decoration: none; font-weight: bold; }
.aff-legal-checkbox label a:hover { text-decoration: underline; }

/* =========================================
   MODALE TESTI LEGALI (POPUP)
   ========================================= */
.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: #00c455; transform: scale(1.1); }

/* Area che scorre internamente */
.aff-legal-content-scroll {
    max-height: 70vh; overflow-y: auto; padding-right: 15px;
}

/* Scrollbar personalizzata Inquilino (Verde) */
.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: #00c455; border-radius: 10px; }

/* 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; }
}