/**
 * BPA Maps - Core CSS
 * 
 * Default styles for map containers, markers, and InfoWindows.
 */

/* Map Container */
.bpa-map-container {
    display: flex;
    width: 100%;
    height: 800px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bpa-map-canvas {
    flex: 1;
    height: 100%;
    min-height: 400px;
}

/* Sidebar */
.bpa-map-sidebar {
    width: 480px;
    background: #f8f9fa;
    padding: 20px;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bpa-locations-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-top: 20px;
}

.bpa-locations-list h3 {
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--bpa-accent-color, #D0232A);
}

.bpa-locations-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    padding-right: 5px;
}

/* Custom scrollbar styling */
.bpa-locations-container::-webkit-scrollbar {
    width: 6px;
}

.bpa-locations-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.bpa-locations-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.bpa-locations-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Location Cards - Minimal default styling */
.bpa-location-card {
    background: white;
    margin: 10px 0;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bpa-location-card:hover {
    transform: translateY(-2px);
    border-color: var(--bpa-accent-color, #D0232A);
}

.bpa-location-card.border-primary {
    border-color: var(--bpa-accent-color, #D0232A);
}

.location-name {
    font-size: 18px;
    font-weight: bold;
    color: var(--bpa-accent-color, #D0232A);
    margin-bottom: 5px;
    line-height: 1.2;
}

.location-address {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.location-operator {
    color: #333;
    font-size: 14px;
    margin-bottom: 10px;
}

.location-phone {
    display: block;
    color: var(--bpa-accent-color, #D0232A);
    font-weight: bold;
    font-size: 16px;
    text-decoration: none;
    margin-bottom: 10px;
    transition: color 0.2s ease;
}

.location-phone:hover {
    color: var(--bpa-accent-color-dark, #991a20);
}

.location-website {
    display: inline-block;
    background: var(--bpa-accent-color, #D0232A);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.location-website:hover {
    background: var(--bpa-accent-color-dark, #991a20);
    color: white;
    text-decoration: none;
}

/* Search Form */
.bpa-search-header {
    flex-shrink: 0;
}

.bpa-map-sidebar>form,
.bpa-map-sidebar>#location-search-form {
    flex-shrink: 0;
    margin-bottom: 0;
}

.bpa-map-sidebar .space-y-3 {
    margin-bottom: 0;
}

.bpa-map-sidebar .relative {
    position: relative;
}

.bpa-map-sidebar .absolute {
    position: absolute;
}

.bpa-map-sidebar .left-3 {
    left: 12px;
}

.bpa-map-sidebar .top-1\/2 {
    top: 50%;
}

.bpa-map-sidebar .-translate-y-1\/2 {
    transform: translateY(-50%);
}

.bpa-map-sidebar .pointer-events-none {
    pointer-events: none;
}

.bpa-map-sidebar .h-5 {
    height: 20px;
}

.bpa-map-sidebar .w-5 {
    width: 20px;
}

.bpa-map-sidebar .text-gray-400 {
    color: #9ca3af;
}

.bpa-map-sidebar input[type="text"] {
    display: block;
    width: 100%;
    padding: 12px 12px 12px 40px;
    font-size: 16px;
    color: #111827;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.bpa-map-sidebar input[type="text"]:focus {
    outline: none;
    border-color: var(--bpa-accent-color, #D0232A);
}

.bpa-map-sidebar input[type="text"]::placeholder {
    color: #6b7280;
}

/* Row layout for search form */
#location-search-form>div {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

#location-search-form .bpa-auto-location-link {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Focus states for inline styles */
#location-search-form input[type="text"]:focus {
    outline: none !important;
    border-color: var(--bpa-accent-color, #D0232A) !important;
    box-shadow: 0 0 0 2px rgba(208, 35, 42, 0.2) !important;
}

/* InfoWindow Styles */
.gm-style .gm-style-iw-d {
    font-size: 16px !important;
    text-align: center !important;
    padding: 15px 20px 20px 20px !important;
    min-width: 250px !important;
    max-width: 320px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.gm-style .gm-style-iw-c {
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    padding: 0 !important;
    margin: 0 !important;
}

.gm-style .gm-style-iw {
    padding: 0 !important;
    margin: 0 !important;
}

.gm-style .gm-style-iw-t::after {
    display: none !important;
}

.gm-style .gm-style-iw-d>div {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.infowindow-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
}

.gm-style .gm-style-iw {
    width: auto !important;
}

.gm-style .gm-style-iw-tc {
    right: 0 !important;
}

.gm-style-iw-d {
    overflow: visible !important;
}

.gm-style-iw .location {
    font-size: 26px;
    font-weight: 600;
    color: var(--bpa-accent-color, #D0232A);
    margin-bottom: 10px;
    line-height: 1.2;
}

.gm-style-iw .operated-by {
    font-size: 18px;
    font-weight: 400;
    color: #000;
    margin-bottom: 10px;
}

.gm-style-iw .contact-address {
    font-size: 20px;
    font-weight: 600;
    color: #000;
    margin-bottom: 24px;
}

.gm-style-iw .visit-website-btn {
    background: var(--bpa-accent-color, #D0232A);
    color: #fff;
    padding: 12px 20px;
    cursor: pointer;
    display: inline-block;
    font-size: 16px;
    width: auto;
    margin: 0;
    margin-bottom: 8px;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.gm-style-iw .visit-website-btn:hover {
    background-color: var(--bpa-accent-color-dark, #991a20);
    color: #fff;
    text-decoration: none;
}

/* Close Button */
.gm-style .gm-ui-hover-effect {
    width: 20px !important;
    height: 20px !important;
    right: 0px !important;
    top: 8px !important;
    background: none !important;
    border: none !important;
}

.gm-style button[title="Close"] {
    width: 20px !important;
    height: 20px !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: opacity 0.2s ease !important;
    font-size: 20px !important;
    color: #A7A9AC !important;
    font-weight: normal !important;
    padding: 0 !important;
    margin: 0 !important;
}

.gm-style button[title="Close"]:hover {
    background: none !important;
    opacity: 0.7 !important;
}

.gm-style button[title="Close"] img {
    display: none !important;
}

.gm-style button[title="Close"]::before {
    content: "×" !important;
    font-size: 20px !important;
    color: #A7A9AC !important;
    font-weight: normal !important;
    line-height: 1 !important;
}

/* Cluster Styles */
.clustericon {
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: bold;
    background: transparent;
    border-radius: 50%;
    border: 0px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    position: relative;
}

.clustericon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: transparent;
    opacity: 0.2;
    border-radius: 50%;
    z-index: -1;
}

.clustericon>div {
    margin: 0;
    position: relative;
    z-index: 1;
}

/* Mobile Responsive */
@media (max-width: 800px) {
    .bpa-map-container {
        flex-direction: column;
        height: auto;
        min-height: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .bpa-map-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px !important;
        box-sizing: border-box !important;
        max-height: none !important;
        min-height: auto;
        order: 2;
        overflow: visible;
        border-right: none;
        display: flex;
        flex-direction: column;
    }

    .bpa-locations-list {
        margin-top: 15px;
        overflow: visible;
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .bpa-locations-list h3 {
        width: 100%;
        box-sizing: border-box;
        flex-shrink: 0;
    }

    .bpa-locations-container {
        overflow-y: auto !important;
        max-height: calc(100vh - 400px) !important;
        min-height: 200px;
        flex: 1 1 auto;
        -webkit-overflow-scrolling: touch;
    }

    .bpa-location-card {
        min-height: auto;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        margin: 12px 0;
        padding: 15px !important;
    }

    .bpa-location-card .location-name,
    .bpa-location-card .location-address,
    .bpa-location-card .location-operator,
    .bpa-location-card .location-phone {
        width: 100%;
        display: block;
    }

    .bpa-map-canvas {
        order: 1;
        height: 30vh;
        min-height: 220px;
        max-height: 320px;
        width: 100%;
    }

    .clustericon {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .clustericon::before {
        display: block !important;
        visibility: visible !important;
    }

    #location-search-form>div {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
    }

    #location-search-form>div>div:last-child {
        width: 100% !important;
        justify-content: flex-start !important;
    }

    #location-search-form .bpa-auto-location-link {
        font-size: 15px !important;
        gap: 6px !important;
    }

    #location-search-form .bpa-auto-location-link svg {
        width: 18px !important;
        height: 18px !important;
    }

    .bpa-search-header {
        margin-bottom: 16px;
        width: 100%;
        box-sizing: border-box;
    }

    .bpa-search-header h1,
    .bpa-search-header h2,
    .bpa-search-header h3 {
        font-size: 1.6rem !important;
        line-height: 1.2 !important;
        margin-bottom: 10px;
        width: 100%;
    }

    .bpa-search-header p {
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
        margin-bottom: 12px;
        width: 100%;
    }

    #location-search-form {
        width: 100% !important;
        box-sizing: border-box;
    }

    #location-search-form>div {
        width: 100% !important;
        box-sizing: border-box;
    }

    #location-search-form input[type="text"] {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Mobile InfoWindow */
    .gm-style .gm-style-iw-c {
        max-width: 240px !important;
        width: 240px !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    }

    .gm-style .gm-style-iw-d {
        max-width: 240px !important;
        width: 240px !important;
        padding: 0 !important;
    }

    .infowindow-content {
        padding: 16px !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
        text-align: center !important;
    }

    .infowindow-content .location {
        font-size: 14.4px !important;
        font-weight: 600 !important;
        color: var(--bpa-accent-color, #D0232A) !important;
        margin-bottom: 8px !important;
        line-height: 1.2 !important;
        text-align: center !important;
    }

    .infowindow-content .operated-by {
        font-size: 11.2px !important;
        font-weight: 400 !important;
        color: #333 !important;
        margin-bottom: 8px !important;
        text-align: center !important;
    }

    .infowindow-content .contact-address {
        font-size: 11.2px !important;
        font-weight: 600 !important;
        color: #333 !important;
        margin-bottom: 12px !important;
        text-align: center !important;
    }

    .infowindow-content .btn {
        font-size: 11.2px !important;
        padding: 10px 16px !important;
        width: 100% !important;
        text-align: center !important;
        margin: 0 !important;
        border-radius: 4px !important;
        background: var(--bpa-accent-color, #D0232A) !important;
        color: white !important;
        text-decoration: none !important;
        display: block !important;
    }

    .infowindow-content .btn:hover {
        background: var(--bpa-accent-color-dark, #991a20) !important;
        color: white !important;
    }

    .gm-style .gm-style-iw-tc {
        display: block !important;
    }
}

/* Error States */
.bpa-map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: #f8f9fa;
    color: #666;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Loading States */
.bpa-map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: #f8f9fa;
    color: #666;
    font-size: 16px;
    border-radius: 8px;
}

.bpa-map-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--bpa-accent-color, #D0232A);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}