/*
 * Loop Forms - Base Styles (De-duplicated & Coherent CSS)
 * Provides structural and presentational styling for the dark slide-in modal form.
 */

:root {
    /* SCSS Variables converted to CSS Custom Properties */
    --lf-modal-width: 550px;
    --lf-modal-z-index: 8005;
    --lf-modal-container-z-index: 8006;
    --lf-modal-transition-timing: cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- Core Modal Positioning --- */

.loop-forms-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 8005;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.loop-forms-modal.loop-forms-modal--active {
    opacity: 1;
    visibility: visible;
}

.lf-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* --- Container (Modal Drawer) Styling and Functionality --- */

.lf-container {
    /* Modal drawer positioning and visual theme */
    position: fixed;
    top: 0;
    right: 0;
    width: 550px; /* Base width */
    height: 100vh;
    max-height: 100vh;
    background: #333; /* Main background */
    overflow: hidden;
    transform: translateX(100%); /* Start position: Off-screen */
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25);
    z-index: 8006;
    display: flex;
    flex-direction: column;
    padding: 56px;
    box-sizing: border-box;
}


/* Responsive Design */
@media (max-width: 768px) {
    .lf-container {
        width: 100%;
        padding: 24px;
    }
}



.loop-forms-modal.loop-forms-modal--active .lf-container {
    transform: translateX(0); /* Slide-in on active */
}

/* --- Header, Close Button, and Body --- */

.lf-header {
    position: relative;
    padding-bottom: 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lf-title {
    margin: 0;
}

.lf-close {
    position: absolute;
    top: 0;
    right: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.lf-form .submit-area .button svg {
    stroke: #ffffff;
}

.lf-close svg {
    stroke: #fff; /* Force close icon to white */
    width: 24px;
    height: 24px;
    transition: color 0.2s ease;
}

.lf-close:hover svg {
    color: #ccc; /* Subtle hover effect on icon */
}

.lf-body {
    /* flex: 1; */
    overflow-y: auto;
    /* display: flex; */
    /* flex-direction: column; */
    /* min-height: 0; */
    
    /* Scrollbar hiding (structural) */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.lf-intro {
    margin-bottom: 20px;
}

/* --- Form Layout and Fields --- */

.loop-forms {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.loop-forms .fields {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

/* Base Label Styling (Hides non-checkbox labels for placeholder use) */
.loop-forms label {
    display: block;
    margin-bottom: 20px;
    position: relative;
    font-size: 0;
    /* color: transparent; */
}

.loop-form__success-container {
    text-align:center; 
}

/* Input, Textarea, Select, and Date Field Styling */
.loop-forms-modal .loop-forms label input:not([type="checkbox"]),
.loop-forms-modal .loop-forms label textarea,
.loop-forms-modal .loop-forms label select,
.loop-forms-modal .loop-forms label input[type="date"] {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 12px 10px;
    border: 2px solid #333; 
    border-radius: 4px;
    font-size: 16px;
    background: transparent; 
    color: #333;
    box-sizing: border-box;
    /* Date specific structural rule */
    position: relative;
    cursor: pointer;
}

/* Input Focus State */
.loop-forms label input:focus,
.loop-forms label textarea:focus,
.loop-forms label select:focus {
    outline: none;
    box-shadow: 0 0 0 1px #fff;
}

.loop-forms label textarea {
    resize: vertical;
    min-height: 80px;
}

/* --- Date Input Overrides for Custom Calendar Icon --- */

.loop-forms label input[type="date"]::-webkit-calendar-picker-indicator {
    /* Makes the entire input clickable for calendar popup, hiding native icon */
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

/* Style the custom SVG icon white (inside the relative div wrapper) */
.loop-forms label div[style*="position: relative"] svg {
    color: #fff !important; 
    stroke: #fff;
}

/* Labels that need visible text (e.g. date picker with no placeholder) */
.loop-forms label.has-visible-label {
    font-size: 14px;
    color: #333;
}

.loop-forms label.has-visible-label .label-text {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

/* --- Checkbox and Fieldset Styling --- */

fieldset {
    border: none;
    padding: 0;
    margin: 0;
    min-width: 0;
}

.loop-forms .service-legend {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding: 0;
    display: block;
    width: 100%;
    float: none;
}



/* Fieldset/Legend for time slots (Visibility overrides) */
.loop-forms .fieldset.time-slots-fieldset {
    display: block;
    margin-bottom: 20px;
}

.loop-forms legend {
    margin-bottom: 10px;
}

.loop-forms .fieldset.time-slots-fieldset legend {
    display: block;
    font-size: 16px;
    margin-bottom: 10px;
}

/* Time Slot and Consent Checkboxes (Visible Labels) */
.loop-forms label.checkbox {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    margin-bottom: 10px;
    font-size: 16px; 
}

.loop-forms label.checkbox input[type="checkbox"] {
    flex-shrink: 0;
    margin: 3px 10px 0 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.loop-forms label.checkbox .service-checkbox {
    color:red;
}

.loop-forms label.checkbox .checkbox-text {
    font-size: 16px;
    line-height: 1.4;
}

.loop-forms label.checkbox .checkbox-text a {
    text-decoration: underline;
}

/* First two service options - Always in a row (50/50 or 100% if only one) */
.modal-type-generic-valuation .service-checkboxes-first-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-bottom: 10px;
}

/* If only one option in first row, take full width */
.modal-type-generic-valuation .service-checkboxes-first-row:has(.checkbox:only-child) {
    grid-template-columns: 1fr;
}

/* Remaining options - Always full width */
.modal-type-generic-valuation .service-checkboxes-remaining .checkbox {
    margin-bottom: 10px;
}

/* Mobile - stack first row vertically */
@media (max-width: 600px) {
    .modal-type-generic-valuation .service-checkboxes-first-row {
        grid-template-columns: 1fr;
    }
}

/* Divider & Note */
.loop-forms .divider {
    border: none;
    height: 1px;
    background: #666;
    margin: 20px 0;
}

.loop-forms .note {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 20px;
}

/* --- Submit Button Area --- */

.submit-area {
    margin-top: auto;
    padding-top: 20px;
    margin-bottom: 50px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.submit-area .button {
    width: 100%;
}

.submit-area .button svg {
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.submit-area .button:hover svg {
    transform: translateX(2px);
}

/* =======================================================================
   RESPONSIVE DESIGN & THEME OVERRIDES
   ======================================================================= */

/* Desktop-only enhanced shadow (above 767px) */
@media (min-width: 768px) {
    .lf-container {
        box-shadow: -12px 0 48px rgba(0, 0, 0, 0.3);
    }
}

/* Mobile adjustments (767px and below) */
@media (max-width: 767px) {
    .lf-container {
        width: 100vw;
        box-shadow: none; /* Remove shadow on mobile */
    }
    
    .loop-forms-modal {
        backdrop-filter: blur(2px); /* Reduced blur on mobile */
    }
}

/* =======================================================================
   THEME OVERRIDE STYLES - Match Flyout Menu Design
   ======================================================================= */

/* CSS Variables for theme integration */
:root {
    /* These will be overridden by theme SCSS variables */
    --loop-forms-bg: #333;
    --loop-forms-text: #fff;
    --loop-forms-overlay: rgba(0, 0, 0, 0.65);
    --loop-forms-input-bg: #fff;
    --loop-forms-input-text: #333;
    --loop-forms-button-bg: #fff;
    --loop-forms-button-text: #333;
    --loop-forms-border: rgba(255, 255, 255, 0.1);
}

/* Theme-aware styling that matches flyout menu */
.lf-container {
    background: var(--loop-forms-bg);
}

.loop-forms-modal {
    background: var(--loop-forms-overlay);
}

.lf-header {
    border-bottom: 1px solid var(--loop-forms-border);
}



.lf-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lf-intro {
    opacity: 0.9;
}

/* Form field styling */
.loop-forms-modal input,
.loop-forms-modal textarea,
.loop-forms-modal select {
    background: var(--loop-forms-input-bg);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.loop-forms-modal input:focus,
.loop-forms-modal textarea:focus,
.loop-forms-modal select:focus {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}




/* Submit button area */
.submit-area {
    border-top: 1px solid var(--loop-forms-border);
}

.submit-area .button svg {
    stroke: currentColor;
}

/* =======================================================================
   PROPERTY MATCHING FORM SPECIFIC STYLES
   ======================================================================= */

/* Fix input text color override for property matching form in sections */
section.module form.loop-form--loop-forms-property-matching label input,
section.module form.loop-form--loop-forms-property-matching label textarea, 
section.module form.loop-form--loop-forms-property-matching label select {
    color: #333;
}

/* Fix checkbox text color override for property matching form in sections */
section.module form.loop-form--loop-forms-property-matching .checkbox .checkbox-text {
    color: #333;
}

/* Two-column form rows for property matching form */
.loop-form--loop-forms-property-matching .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 768px) {
    .loop-form--loop-forms-property-matching .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Spacing between checkboxes for property matching form */
.loop-form--loop-forms-property-matching label.checkbox {
    margin-bottom: 15px!important;
}

/* Consent section styling */
.loop-form--loop-forms-property-matching .consent-section {
    font-size: 14px;
}

.loop-form--loop-forms-property-matching .consent-title {
    font-size: 15px;
    font-weight: bold;
    margin: 0 0 20px 0;
}

/* Section title spacing */
.loop-form--loop-forms-property-matching h4 {
    margin-bottom: 24px;
}

/* Lighter text for consent section */
.loop-form--loop-forms-property-matching .consent-section .checkbox-text,
.loop-form--loop-forms-property-matching .consent-section .privacy-notice {
    opacity: 0.8;
}



