/**
 * BN Address Autocomplete - Frontend Styles
 * Checkout autocomplete and map styling
 */

/* Autocomplete Input Enhancement */
.bnac-autocomplete-field input,
.bnac-autocomplete-field .input-text {
    padding-right: 40px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    transition: all 0.2s ease;
}

.bnac-autocomplete-field input:focus,
.bnac-autocomplete-field .input-text:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
}

/* Loading State */
.bnac-autocomplete-field.bnac-loading input,
.bnac-autocomplete-field.bnac-loading .input-text {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2'%3E%3Cpath d='M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4'/%3E%3C/svg%3E");
    animation: bnac-rotate 1s linear infinite;
}

@keyframes bnac-rotate {
    from { background-position: right 12px center; }
    to { background-position: right 12px center; }
}

/* Google Places Autocomplete Dropdown - CRITICAL VISIBILITY */
.pac-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    margin-top: 8px !important;
    padding: 8px 0 !important;
    background: #ffffff !important;
    z-index: 999999 !important;
    position: absolute !important;
    display: block !important;
    width: auto !important;
    min-width: 300px !important;
}

.pac-container:empty {
    display: none !important;
}

.pac-container::after {
    display: none !important;
}

.pac-item {
    padding: 12px 16px !important;
    border: none !important;
    border-top: none !important;
    cursor: pointer !important;
    transition: background-color 0.15s ease !important;
    line-height: 1.5 !important;
    display: flex !important;
    align-items: center !important;
    font-size: 14px !important;
}

.pac-item:first-child {
    border-top: none !important;
}

.pac-item:hover,
.pac-item.pac-item-selected {
    background-color: #f0f9ff !important;
}

.pac-icon {
    width: 20px !important;
    height: 20px !important;
    margin-right: 12px !important;
    background-size: contain !important;
}

.pac-icon-marker {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='%233b82f6' stroke='none'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E") !important;
}

.pac-item-query {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    padding-right: 4px !important;
}

.pac-matched {
    font-weight: 700 !important;
    color: #3b82f6 !important;
}

.pac-item span:not(.pac-item-query):not(.pac-matched) {
    font-size: 13px !important;
    color: #64748b !important;
}

.pac-logo::after,
.hdpi.pac-logo::after {
    display: none !important;
    background-image: none !important;
}

/* Map Wrapper */
.bnac-map-wrapper {
    margin: 20px 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    animation: bnac-slideDown 0.3s ease;
}

@keyframes bnac-slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Map Header */
.bnac-map-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.bnac-map-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 8px;
    color: #ffffff;
}

.bnac-map-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

/* Map Container */
.bnac-map {
    width: 100%;
    background: #f1f5f9;
}

/* Map Address Display */
.bnac-map-address {
    padding: 14px 18px;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
    display: none;
}

.bnac-map-address.show {
    display: block;
}

.bnac-map-address::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: middle;
    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='%2322c55e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* Hidden tracking input */
.bnac-tracking-field {
    display: none !important;
}

/* Success Animation */
.bnac-autocomplete-field.bnac-success input,
.bnac-autocomplete-field.bnac-success .input-text {
    border-color: #22c55e !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
}

/* RTL Support (Hebrew) */
[dir="rtl"] .bnac-autocomplete-field input,
[dir="rtl"] .bnac-autocomplete-field .input-text,
.rtl .bnac-autocomplete-field input,
.rtl .bnac-autocomplete-field .input-text {
    padding-right: 12px !important;
    padding-left: 40px !important;
    background-position: left 12px center;
}

[dir="rtl"] .pac-item::before,
.rtl .pac-item::before {
    margin-right: 0;
    margin-left: 12px;
}

[dir="rtl"] .bnac-map-address::before,
.rtl .bnac-map-address::before {
    margin-right: 0;
    margin-left: 8px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .pac-container {
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
    }

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

    .bnac-map-wrapper {
        margin: 15px 0;
        border-radius: 8px;
    }

    .bnac-map-header {
        padding: 12px 14px;
    }

    .bnac-map {
        min-height: 200px;
    }
}

/* Custom Map Styles Marker */
.bnac-marker {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Hide Powered by Google */
.pac-container .pac-logo::after,
.pac-container .hdpi::after {
    display: none !important;
}
