/* =============================================================
   Valutatore Immobiliare — Frontend Form Styles
   Scoped to .vl-form-wrap to avoid conflicts with the theme.
   ============================================================= */

.vl-form-wrap {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 400;
    line-height: 1.5;
}

.vl-form-wrap * {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure all text elements use Inter */
.vl-form-wrap input,
.vl-form-wrap select,
.vl-form-wrap textarea,
.vl-form-wrap button,
.vl-form-wrap .btn,
.vl-form-wrap label,
.vl-form-wrap .dropdown-input,
.vl-form-wrap .dropdown-option {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;
}

/* Container */
.vl-form-wrap .multi-step-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 15px;
    background: transparent;
    position: relative;
    z-index: 1;
}

/* Force form elements behind dropdowns */
.vl-form-wrap .step-content,
.vl-form-wrap .step-content *:not(.dropdown-menu):not(.dropdown-option):not(.searchable-dropdown) {
    z-index: 10;
}

/* ---- Progress Bar ---- */
.vl-form-wrap .progress-container {
    margin-bottom: 30px;
}

.vl-form-wrap .progress-bar {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 15px;
}

.vl-form-wrap .progress-bar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #e9ecef;
    z-index: 1;
}

.vl-form-wrap .progress-bar .progress-line {
    position: absolute;
    top: 50%;
    left: 0;
    height: 2px;
    background: #216b32;
    transition: width 0.3s ease;
    z-index: 2;
}

.vl-form-wrap .progress-step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #666;
    position: relative;
    z-index: 3;
    transition: all 0.3s ease;
}

.vl-form-wrap .progress-step.active {
    background: #216b32;
    color: white;
}

.vl-form-wrap .progress-step.completed {
    background: #28a745;
    color: white;
}

/* ---- Step Content ---- */
.vl-form-wrap .step-content {
    display: none;
    animation: vlFadeIn 0.3s ease;
    min-height: 280px;
    position: relative;
}

.vl-form-wrap .step-content.active {
    display: block;
}

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

.vl-form-wrap .step-title {
    font-size: 22px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 25px;
    text-align: center;
}

.vl-form-wrap .section-title {
    font-size: 17px;
    font-weight: 600;
    color: #2c3e50;
    margin: 28px 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e8e8e8;
}

.vl-form-wrap .section-title:first-child {
    margin-top: 0;
}

/* ---- Form Groups ---- */
.vl-form-wrap .form-row {
    display: flex;
    gap: 2%;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.vl-form-wrap .form-row .form-group { flex: 1; }
.vl-form-wrap .form-group.width-25  { flex: 0 0 calc(25% - 1.5%); }
.vl-form-wrap .form-group.width-33  { flex: 0 0 calc(33% - 1.33%); }
.vl-form-wrap .form-group.width-40  { flex: 0 0 calc(40% - 1.2%); }
.vl-form-wrap .form-group.width-50  { flex: 0 0 calc(50% - 1%); }
.vl-form-wrap .form-group.width-60  { flex: 0 0 calc(60% - 0.8%); }
.vl-form-wrap .form-group.width-66  { flex: 0 0 calc(66% - 0.68%); }
.vl-form-wrap .form-group.width-75  { flex: 0 0 calc(75% - 0.5%); }

.vl-form-wrap .form-group {
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.vl-form-wrap .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #2c3e50;
}

/* Inputs */
.vl-form-wrap input[type="text"],
.vl-form-wrap input[type="number"],
.vl-form-wrap input[type="email"],
.vl-form-wrap input[type="tel"],
.vl-form-wrap select,
.vl-form-wrap .form-group input,
.vl-form-wrap .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e9ecef;
    border-radius: 6px !important;
    font-size: 15px;
    transition: border-color 0.3s ease;
    background: white;
    box-sizing: border-box;
    height: 43px;
}

.vl-form-wrap .form-group input:focus,
.vl-form-wrap .form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: none;
}

.vl-form-wrap .required { color: #e74c3c; }

/* ---- intl-tel-input overrides (v25) ---- */
.vl-form-wrap .iti {
    width: 100%;
    display: block;
}

/* Match input height/border to the rest of the form */
.vl-form-wrap .iti__tel-input {
    height: 43px !important;
    border: 2px solid #e9ecef !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    box-sizing: border-box !important;
}

.vl-form-wrap .iti__tel-input:focus {
    border-color: #007bff !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Dropdown above everything */
.vl-form-wrap .iti__dropdown-content {
    z-index: 9999 !important;
}

.vl-form-wrap .iti__country.iti__highlight,
.vl-form-wrap .iti__country:hover {
    background: #f0f7f0;
}

/* Checkbox pertinenze */
.vl-form-wrap .checkbox-label {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    margin: 0;
    padding: 4px 0;
    line-height: 1.2;
}

.vl-form-wrap .checkbox-label input[type="checkbox"] {
    margin-right: 6px;
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    background-color: #fff;
    position: relative;
    outline: none;
}

.vl-form-wrap .checkbox-label input[type="checkbox"]:checked {
    background-color: #007bff;
    border-color: #007bff;
}

.vl-form-wrap .checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    color: white;
    font-size: 10px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Navigation Buttons */
.vl-form-wrap .form-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.vl-form-wrap .btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 180px;
    z-index: 1 !important;
    position: relative !important;
    height: 43px;
    box-sizing: border-box;
}

.vl-form-wrap .btn-secondary { background: #6c757d; color: white; }
.vl-form-wrap .btn-secondary:hover { background: #5a6268; }
.vl-form-wrap .btn-primary { background: #239300; color: white; }
.vl-form-wrap .btn-primary:hover { background: #00740C; }
.vl-form-wrap .btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* GDPR */
.vl-form-wrap .gdpr-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
}

.vl-form-wrap .gdpr-checkbox input[type="checkbox"] {
    width: auto;
    height: auto;
    margin-top: 4px;
    flex-shrink: 0;
}

.vl-form-wrap .gdpr-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #666;
}

/* Loading / Success / Calculation states */
.vl-form-wrap .loading-state,
.vl-form-wrap .success-state,
.vl-form-wrap .calculation-state {
    display: none;
    text-align: center;
    padding: 40px 20px;
}

.vl-form-wrap .loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: vlSpin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes vlSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.vl-form-wrap .success-icon {
    width: 80px;
    height: 80px;
    background: #28a745;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.vl-form-wrap .success-icon svg {
    width: 40px;
    height: 40px;
    fill: white;
}

/* Calculation progress */
.vl-form-wrap .calculation-progress {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #e9ecef;
    border-radius: 6px;
    margin: 20px auto;
    overflow: hidden;
}

.vl-form-wrap .calculation-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007bff 0%, #0056b3 100%);
    border-radius: 6px;
    width: 0%;
    transition: width 0.3s ease;
}

.vl-form-wrap .calculation-icon {
    width: 60px;
    height: 60px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0;
    animation: vlPulse 1.5s ease-in-out infinite;
}

.vl-form-wrap .calculation-icon svg {
    width: 60px;
    height: 60px;
    fill: white;
}

.vl-form-wrap .calculation-icon img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 50%;
}

@keyframes vlPulse {
    0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.4); }
    50%  { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(0, 123, 255, 0); }
    100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0); }
}

/* Error */
.vl-form-wrap .error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: none;
}

/* Year help */
.vl-form-wrap .year-help {
    color: #6c757d;
    font-size: 14px;
    margin-top: 5px;
}

.vl-form-wrap .year-help.required { color: #e74c3c; }

/* Hidden class */
.vl-form-wrap .hidden {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Hide reCAPTCHA badge */
.grecaptcha-badge {
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
}

/* ---- Searchable Dropdowns ---- */
.vl-form-wrap .searchable-dropdown {
    position: relative;
    width: 100%;
    z-index: 999998 !important;
}

.vl-form-wrap .searchable-dropdown.open {
    z-index: 999999999 !important;
    overflow: visible !important;
}

.vl-form-wrap .form-group:has(.searchable-dropdown.open),
.vl-form-wrap .form-row:has(.searchable-dropdown.open),
.vl-form-wrap .step-content:has(.searchable-dropdown.open),
.vl-form-wrap .multi-step-container:has(.searchable-dropdown.open) {
    overflow: visible !important;
    z-index: 999999999 !important;
    position: relative !important;
}

.vl-form-wrap .dropdown-input {
    width: 100%;
    padding: 10px 35px 10px 14px;
    border: 2px solid #e9ecef;
    border-radius: 6px !important;
    font-size: 15px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    height: 43px;
    box-sizing: border-box;
}

.vl-form-wrap .dropdown-input:focus {
    outline: none;
    border-color: #007bff;
}

.vl-form-wrap .dropdown-input:disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.vl-form-wrap .dropdown-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    pointer-events: none;
    transition: transform 0.3s ease;
}

.vl-form-wrap .dropdown-arrow svg {
    width: 100%;
    height: 100%;
    fill: #666;
}

.vl-form-wrap .searchable-dropdown.open .dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.vl-form-wrap .dropdown-menu {
    position: absolute !important;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 99999999 !important;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.vl-form-wrap .searchable-dropdown.open .dropdown-menu {
    display: block;
}

.vl-form-wrap .dropdown-option {
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
    border-radius: 0 !important;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vl-form-wrap .dropdown-option:hover  { background: #f8f9fa; }
.vl-form-wrap .dropdown-option.selected { background: #007bff; color: white; }
.vl-form-wrap .dropdown-option.hidden  { display: none; }

.vl-form-wrap .no-results {
    padding: 10px 14px;
    color: #666;
    font-style: italic;
    text-align: center;
}

/* Nav buttons always behind dropdowns (exclude iti flag button) */
.vl-form-wrap .btn,
.vl-form-wrap #nextBtn,
.vl-form-wrap #prevBtn,
.vl-form-wrap #submitBtn {
    z-index: 1 !important;
    position: relative !important;
}

/* iti flag button must sit above the input */
.vl-form-wrap .iti__country-container {
    z-index: 20 !important;
}

/* Reset theme button styles on the iti flag button */
.vl-form-wrap .iti__selected-country {
    position: relative !important;
    z-index: 20 !important;
    background-color: white !important;
    border: none !important;
    border-right: 1px solid #e9ecef !important;
    border-radius: 6px 0 0 6px !important;
    color: #2c3e50 !important;
    cursor: pointer !important;
    padding: 0 8px !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.vl-form-wrap .iti__selected-country:hover {
    background-color: #f8f9fa !important;
}

/* Country list dropdown reset */
.vl-form-wrap .iti__dropdown-content button,
.vl-form-wrap .iti__country-list button {
    background-color: white !important;
    border: none !important;
    color: #2c3e50 !important;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .vl-form-wrap .multi-step-container {
        margin: 5px;
        padding: 0;
    }

    .vl-form-wrap .form-row { gap: 1.5%; }

    .vl-form-wrap .form-group input,
    .vl-form-wrap .form-group select,
    .vl-form-wrap .dropdown-input {
        font-size: 16px !important;
        -webkit-appearance: none;
    }

    .vl-form-wrap .form-group label { font-size: 12px; font-weight: 500 !important; }
    .vl-form-wrap .dropdown-option  { font-size: 16px; padding: 12px 14px; }

    .vl-form-wrap .form-navigation { gap: 10px; }

    .vl-form-wrap .btn {
        flex: 1;
        max-width: 50%;
        font-size: 16px;
    }

    .vl-form-wrap .progress-step { width: 30px; height: 30px; font-size: 12px; }
    .vl-form-wrap .step-title    { font-size: 20px; }

    .vl-form-wrap .hidden {
        position: fixed !important;
        left: -100vw !important;
        top: -100vh !important;
    }

    .vl-form-wrap .step-content { overflow-x: hidden; overflow-y: visible; }
}
