/* ===================================================================
   FINAL, BULLETPROOF FIX FOR ELEMENTOR AND POP-UP VISIBILITY
   =================================================================== */

/*
 * This block targets all major Elementor layout containers and forces them
 * to allow content (like our calendar) to be visible outside their bounds.
 * This is the most reliable way to fix pop-ups "jailed" by Elementor's
 * responsive styles.
*/
.elementor-section,
.elementor-container,
.elementor-column,
.elementor-widget-wrap,
.elementor-widget-container {
    overflow: visible !important;
    transform: none !important;
    -webkit-transform: none !important;
}

/*
 * This ensures the calendar itself always renders on the absolute top
 * layer of the entire page.
*/
.flatpickr-calendar {
    z-index: 99999 !important;
}

/*
 * This ensures the clickable date button is never covered by its own label
 * on mobile devices.
*/
.btm-form-container .btm-date-range-toggle {
    position: relative;
    z-index: 2;
}

.btm-form-container .btm-form-group .btm-date-label {
    position: relative;
    z-index: 1;
}

/*
 * This visually hides the Flatpickr text input but keeps it functional
 * for the script.
*/
.btm-form-container .btm-date-range-hidden-input {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    left: -9999px !important;
    top: -9999px !important;
}



.elementor-widget-container {
    overflow: visible !important;
}

/* --- General Inputs & Selects --- */
.btm-form-container select,
.btm-form-container input[type="text"],
.btm-form-container input[type="number"] {
    width: 100%;
    padding: 0.8rem;
    font-size: 0.95rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    line-height: 1.5;
}

.btm-form-container select:focus,
.btm-form-container input[type="text"]:focus,
.btm-form-container input[type="number"]:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* --- Main Form Container --- */
.btm-form-container {
    max-width: 600px;
    margin: 2rem auto;
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    font-family: 'Roboto', sans-serif;
    color: #333;
    box-sizing: border-box;
}

.btm-form-container *,
.btm-form-container *::before,
.btm-form-container *::after {
    box-sizing: inherit;
}

.btm-form-container .btm-form-title {
    text-align: center;
    margin-bottom: 2rem;
    color: #007bff;
    font-size: 1.8rem;
    font-weight: 500;
}

.btm-form-container .btm-form-group {
    margin-bottom: 1.25rem;
}

.btm-form-container .btm-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

/* --- Trip Type Toggle Buttons --- */
.btm-form-container .btm-toggle-group {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.btm-form-container .btm-toggle-btn {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 20px;
    cursor: pointer;
    background-color: #f8f9fa;
    color: #495057;
    transition: all 0.2s ease-in-out;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: auto;
    line-height: 1.4;
    text-align: center;
}

.btm-form-container .btm-toggle-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    color: #0056b3;
}

.btm-form-container .btm-toggle-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.btm-form-container .btm-toggle-btn i {
    margin-left: 5px;
    font-size: 0.7em;
    display: none;
    line-height: 1;
}

.btm-form-container .btm-toggle-btn.active i {
    display: inline-block;
}

/* --- Date Picker Styling --- */
.btm-form-container .btm-form-group.btm-date-range-group {
    position: relative;
}

.btm-form-container .btm-date-range-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.8rem;
    font-size: 0.95rem;
    text-align: left;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    cursor: pointer;
    color: #495057;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    line-height: 1.5;
}

.btm-form-container .btm-date-range-toggle:hover {
     border-color: #80bdff;
}

.btm-form-container .btm-date-range-toggle .btm-date-range-text {
    flex-grow: 1;
}

.btm-form-container .btm-date-range-toggle .btm-date-range-text.placeholder {
    color: #6c757d;
}

.btm-form-container .btm-date-range-toggle i.far.fa-calendar-alt {
    margin-left: 0.75rem;
    color: #6c757d;
}

/* --- Passenger (Pax) Dropdown --- */
.btm-form-container .btm-form-group.btm-pax-group-wrapper {
    position: relative;
}

.btm-form-container .btm-btn-toggle-pax {
    background: #fff;
    color: #495057;
    border: 1px solid #ced4da;
    padding: 0.8rem;
    font-size: 0.95rem;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
}

.btm-form-container .btm-btn-toggle-pax:hover {
    border-color: #80bdff;
}

.btm-form-container .btm-btn-toggle-pax i.fas.fa-caret-down {
    margin-left: 0.5rem;
    font-size: 1rem;
    transition: transform 0.3s ease;
    color: #6c757d;
}

.btm-form-container .btm-pax-dropdown {
    display: none; /* Default hidden */
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    padding: 1.25rem 1.5rem;
    margin-top: 6px;
    box-sizing: border-box;
}

.btm-form-container .btm-pax-dropdown.active {
    display: flex; /* Show using flex */
}

.btm-form-container .btm-pax-dropdown ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.0rem 1rem;
    justify-items: center;
    width: 100%;
    order: 1;
}

.btm-form-container .btm-pax-dropdown li {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.btm-form-container .btm-pax-dropdown li label {
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: #495057;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.2;
}

.btm-form-container .btm-pax-dropdown .btm-counter-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    width: 100%;
}

.btm-form-container .btm-pax-dropdown input.btm-pax-input {
    width: 36px;
    height: 28px;
    padding: 0.1rem 0.2rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    background-color: #f8f9fa;
    color: #495057;
    line-height: 26px;
    -moz-appearance: textfield;
}

.btm-form-container .btm-pax-dropdown input.btm-pax-input::-webkit-outer-spin-button,
.btm-form-container .btm-pax-dropdown input.btm-pax-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.btm-form-container .btm-pax-dropdown .btm-counter-buttons button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    padding: 0;
}

.btm-form-container .btm-pax-dropdown .btm-counter-buttons button.btm-decrease-btn {
   padding-bottom: 1px;
}

.btm-form-container .btm-pax-dropdown .btm-counter-buttons button:hover {
    background-color: #0056b3;
}

.btm-form-container .btm-pax-dropdown .btm-counter-buttons button:disabled {
    background-color: #adb5bd;
    opacity: 0.8;
    cursor: not-allowed;
}

.btm-form-container .btm-pax-dropdown .btm-pax-bottom-btn {
    align-self: flex-end;
    margin-top: 1rem;
    order: 2;
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    background-color: #28a745;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    line-height: 1.5;
    width: auto;
}

.btm-form-container .btm-pax-dropdown .btm-pax-bottom-btn:hover {
    background-color: #218838;
}

/* --- Final Price & Submit Button --- */
.btm-form-container .btm-total-price-input {
    font-size: 1.1rem;
    font-weight: 600;
    color: #28a745;
    text-align: right;
    margin-top: 0.5rem;
    padding: 0.8rem;
    background-color: #e9ecef;
}

.btm-form-container .btm-btn-submit {
    width: 100%;
    padding: 0.9rem;
    font-size: 1rem;
    color: #fff;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 1.5rem;
    font-weight: 500;
}

.btm-form-container .btm-btn-submit:hover {
    background: linear-gradient(135deg, #0056b3, #007bff);
}

.btm-form-container .btm-btn-submit.btm-submit-disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background: #6c757d;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .btm-form-container {
        padding: 1.5rem;
        margin: 1.5rem auto;
    }
    .btm-form-container .btm-toggle-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.7rem;
    }
    .btm-form-container .btm-pax-dropdown ul {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .btm-form-container .btm-toggle-group {
        gap: 0.6rem;
    }
}

@media (max-width: 480px) {
    .btm-form-container .btm-form-title {
        font-size: 1.5rem;
    }
    .btm-form-container .btm-form-group label {
        font-size: 0.85rem;
    }
    .btm-form-container .btm-toggle-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
     .btm-form-container .btm-pax-dropdown input.btm-pax-input {
        width: 50px;
    }
    .btm-form-container .btm-btn-toggle-pax {
        padding: 0.7rem;
        font-size: 0.9rem;
    }
    .btm-form-container .btm-pax-bottom-btn {
        font-size: 0.85rem;
        padding: 0.4rem 1rem;
    }
     .btm-form-container .btm-toggle-group {
        gap: 0.5rem;
    }
    .btm-form-container .btm-pax-dropdown {
         padding: 1rem;
    }
}


/* ===================================================================
   FINAL DATE PICKER FIXES
   =================================================================== */

/* 1. Visually hide the Flatpickr text input but keep it functional for the script. */
.btm-form-container .btm-date-range-hidden-input {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    left: -9999px !important;
    top: -9999px !important;
}

/* 2. Ensure the clickable button is always on top of its label on mobile. */
.btm-form-container .btm-date-range-toggle {
    position: relative;
    z-index: 2;
}

.btm-form-container .btm-form-group .btm-date-label {
    position: relative;
    z-index: 1;
}

/* 3. Ensure the calendar pop-up always appears on the very top layer. */
.flatpickr-calendar {
    z-index: 99999 !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

/* Optional: Custom styling for a 'Done' button inside the calendar */
.flatpickr-calendar .btm-flatpickr-button-container {
    text-align: right;
    padding: 8px 12px 10px 12px;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
    margin-top: -1px;
}

.flatpickr-calendar .btm-flatpickr-done-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    background-color: #28a745;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    line-height: 1.4;
}

.flatpickr-calendar .btm-flatpickr-done-btn:hover {
    background-color: #218838;
}