/**
 * DL Checkout Address Autocomplete Styles
 *
 * Modal design matching the mini-cart pattern with responsive behavior
 */

/* ========================================
   Address Field Icon
   ======================================== */

.woocommerce-checkout .form-row {
    position: relative;
}
#billing_address_1_x_field.woocommerce-invalid{
    margin-bottom:40px !important;
}
#billing_address_1_x_description{
    position: absolute;
}
.dl-caa-icon {
    position: absolute;
    right: 15px;
    top: 45%;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 10;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    /* color: #8FA7C2; */
    margin-top: 13px;
}

.dl-caa-icon:hover {
    color: #CAAB7D;
    transform: translateY(-50%) scale(1.1);
}

.dl-caa-icon svg {
    width: 20px;
    height: 20px;
    pointer-events: none; /* Make SVG children not intercept clicks */
    transform: rotate(30deg);
}

.dl-caa-icon svg * {
    pointer-events: none; /* Make all SVG descendants not intercept clicks */
}

/* Adjust input padding to prevent text overlap with icon */
#shipping_address_1_x_field input,
#billing_address_1_x_field input {
    padding-right: 45px !important;
}


/* ========================================
   Modal Overlay
   ======================================== */

.dl-caa-overlay {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    height: calc(100% - 80px);
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.dl-caa-overlay.show {
    opacity: 1;
    visibility: visible;
}


/* ========================================
   Modal Container - Desktop
   ======================================== */

.dl-caa-modal {
    position: fixed;
    top: 80px;
    right: -100%;
    width: 45%;
    height: calc(100% - 80px);
    background: #F9FAFD;
    z-index: 99999;
    transition: right 0.7s ease-in-out;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.dl-caa-modal.show {
    right: 0;
}


/* ========================================
   Modal Content
   ======================================== */

.dl-caa-modal-wrapper {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dl-caa-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0px 24px;
    border-bottom: 1px solid #E6EAF0;
    background: #fff;
}

.dl-caa-modal-header h3 {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #131920;
    flex: 1;
}

.dl-caa-back {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #131920;
    transition: color 0.3s ease;
}

.dl-caa-back:hover {
    color: #CAAB7D;
}

.dl-caa-back svg {
    width: 24px;
    height: 24px;
}


/* ========================================
   Search Input Section
   ======================================== */

.dl-caa-modal-body {
    padding: 24px;
    flex: 1;
}

.dl-caa-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #F5F5F5;
    border: 1px solid #E6EAF0;
    border-radius: 8px;
    padding: 12px 16px;
    transition: border-color 0.3s ease;
}

.dl-caa-search-wrapper:focus-within {
    border-color: #CAAB7D;
    background: #fff;
}

.dl-caa-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #353A40;
    flex-shrink: 0;
}

.dl-caa-search-icon svg {
    width: 20px;
    height: 20px;
}

.dl-caa-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    color: #131920;
    outline: none;
    padding: 0;
}

.dl-caa-search-input::placeholder {
    color: #8FA7C2;
}


/* ========================================
   Google Places Autocomplete - New API
   ======================================== */

/* Style for new PlaceAutocompleteElement */
gmp-place-autocomplete {
    width: 100% !important;
    display: block;
}

gmp-place-autocomplete input {
    width: 100% !important;
    padding: 14px 18px !important;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 15px !important;
    color: #131920 !important;
    background: #fff !important;
    border: 1px solid #B1C5DA !important;
    border-radius: 6px !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
    outline: none !important;
}

gmp-place-autocomplete input:focus {
    border-color: #CAAB7D !important;
    box-shadow: 0 0 0 3px rgba(202, 171, 125, 0.1) !important;
}

/* Hide the default input when new API is active */
.dl-caa-search-input.hidden {
    display: none !important;
}


/* ========================================
   Google Places Autocomplete Dropdown - Legacy
   ======================================== */

.pac-container {
    font-family: 'Montserrat', sans-serif;
    border: 1px solid #B1C5DA;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
    z-index: 9999999 !important; /* Higher than modal z-index */
}

.pac-item {
    padding: 12px 16px;
    font-size: 14px;
    color: #131920;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease;
}

.pac-item:hover {
    background-color: #F9FAFD;
}

.pac-item-selected {
    background: linear-gradient(90deg, rgba(202, 171, 125, 0.1) 10%, rgba(231, 199, 151, 0.1) 90%);
}

.pac-item-query {
    font-weight: 600;
    color: #131920;
}

.pac-matched {
    font-weight: 700;
    color: #CAAB7D;
}

.pac-icon {
    margin-right: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238FA7C2' stroke-width='2'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'%3E%3C/path%3E%3Ccircle cx='12' cy='10' r='3'%3E%3C/circle%3E%3C/svg%3E");
    background-size: 16px 16px;
    background-position: center;
    background-repeat: no-repeat;
}


/* ========================================
   Powered by Google (hidden - not in design)
   ======================================== */

.dl-caa-powered-by {
    display: none;
}


/* ========================================
   Body Lock (Prevent Scrolling)
   ======================================== */

body.dl-caa-modal-open {
    overflow: hidden !important;
    /* Removed position: fixed to preserve sticky header functionality */
}


/* ========================================
   Mobile Responsive - Full Screen Modal
   ======================================== */

@media screen and (max-width: 768px) {
    .dl-caa-overlay {
        top: 0;
        height: 100%;
    }

    .dl-caa-modal {
        top: 0;
        right: -100vw;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .dl-caa-modal.show {
        right: 0;
    }

    .dl-caa-modal-header {
        padding: 20px 24px;
    }

    .dl-caa-modal-header h3 {
        font-size: 20px;
    }

    .dl-caa-modal-body {
        padding: 24px;
    }

    .dl-caa-icon {
        right: 12px;
        width: 20px;
        height: 20px;
    }

    .dl-caa-icon svg {
        width: 18px;
        height: 18px;
    }

    /* Ensure Google Places dropdown is visible on mobile */
    /* JavaScript will handle positioning dynamically */
    .pac-container {
        z-index: 9999999 !important;
        max-width: calc(100vw - 48px) !important;
    }
}


/* ========================================
   Tablet Breakpoint
   ======================================== */

@media screen and (min-width: 769px) and (max-width: 1024px) {
    .dl-caa-modal {
        width: 55%;
    }
}


/* ========================================
   Accessibility
   ======================================== */

.dl-caa-icon:focus,
.dl-caa-close:focus,
.dl-caa-search-input:focus {
    outline: 2px solid #CAAB7D;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
input#dl-caa-search-input{
    border:0;
    outline: 0;
}
input#dl-caa-search-input:focus{
    border:0;
    outline: 0;
}

button.dl-caa-back {
    border: 0;
    margin-top: 10px;
}
button.dl-caa-back:hover, button.dl-caa-back:focus{
    background: transparent;
}