/**
 * Address Autocomplete - Public Styles
 * Frontend styles for WooCommerce checkout address autocomplete
 */

/* ==========================================================================
   Google Places Autocomplete Styling
   ========================================================================== */

/* Style the Google Places autocomplete dropdown */
.pac-container {
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    background-color: #fff;
    border: 1px solid #ccc;
    font-family: inherit;
    z-index: 9999; /* Ensure it appears above other elements */
}

.pac-item {
    border-bottom: 1px solid #e6e6e6;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
}

.pac-item:last-child {
    border-bottom: none;
}

.pac-item:hover,
.pac-item-selected {
    background-color: #f5f5f5;
}

.pac-item-query {
    color: #333;
    font-weight: 500;
}

.pac-matched {
    font-weight: bold;
    color: #0073aa;
}

/* ==========================================================================
   WooCommerce Checkout Integration
   ========================================================================== */

/* Style autocomplete-enabled fields */
.woocommerce-checkout .wt-adau-field {
    position: relative;
}

/* Loading indicator for address fields */
.wt-adau-field.loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: wt-adau-spin 1s linear infinite;
}

@keyframes wt-adau-spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .pac-container {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .pac-item {
        padding: 12px 15px;
    }
}

/* ==========================================================================
   Theme Compatibility
   ========================================================================== */

/* Ensure compatibility with popular WooCommerce themes */
.woocommerce form .form-row .wt-adau-field input[type="text"] {
    width: 100%;
}

/* Storefront theme compatibility */
.woocommerce.storefront form .form-row .wt-adau-field {
    margin-bottom: 1em;
}