/**
 * Banfi Store Locator Styles
 */

#banfi-store-locator,
.banfi-product-store-locator {
    display: flex;
    height: 700px;
    min-height: 600px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

/* Sidebar Styles */
.banfi-sidebar {
    width: 300px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* Search Form Styles */
.banfi-search-form,
.banfi-product-search-form {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
    transition: padding 0.3s ease;
}

/* Collapsed search form when results are shown */
.banfi-sidebar.has-results .banfi-search-form,
.banfi-sidebar.has-results .banfi-product-search-form {
    padding: 15px 20px;
}

/* Hide form groups when collapsed except location input */
.banfi-sidebar.has-results .banfi-form-group:not(.banfi-location-group) {
    display: none;
}

/* Keep location input visible but make it more compact */
.banfi-sidebar.has-results .banfi-location-group {
    margin-bottom: 0;
}

.banfi-sidebar.has-results .banfi-location-group label {
    display: none;
}

.banfi-sidebar.has-results .banfi-input-group input {
    padding: 8px 10px;
    font-size: 13px;
}

.banfi-sidebar.has-results .banfi-input-container {
    max-width: 290px; /* 244px input group + 46px button + 8px gap */
}

.banfi-sidebar.has-results .banfi-location-btn {
    width: 36px;
    height: 36px;
    padding: 8px;
}

.banfi-sidebar.has-results .banfi-expand-btn {
    width: 46px;
    height: 46px;
    padding: 8px;
}

.banfi-sidebar.has-results .banfi-target-icon {
    width: 12px;
    height: 15px;
}

.banfi-sidebar.has-results .banfi-target-icon::before {
    width: 12px;
    height: 12px;
}

.banfi-sidebar.has-results .banfi-target-icon::after {
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 5px solid #333;
}

.banfi-sidebar.has-results .banfi-expand-icon {
    width: 14px;
    height: 14px;
}

.banfi-sidebar.has-results .banfi-expand-icon::before {
    width: 8px;
    height: 8px;
    border-right: 2px solid #333;
    border-bottom: 2px solid #333;
    top: 3px;
    left: 3px;
}

/* Hide search button when collapsed */
.banfi-sidebar.has-results #banfi-search-btn,
.banfi-sidebar.has-results .banfi-product-search-btn {
    display: none;
}

/* Expand button styling - square icon button */
.banfi-expand-btn {
    background: transparent;
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    margin: 0;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
    padding: 12px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.banfi-expand-btn:hover {
    background: #f8f9fa;
    border-color: #c29a5c;
}

.banfi-expand-btn:active {
    background: #e2e2e2;
    border-color: #751e22;
}

.banfi-expand-btn:focus {
    outline: none;
    box-shadow: none;
}

/* Show expand button only when collapsed */
.banfi-sidebar.has-results .banfi-expand-btn {
    display: inline-flex !important;
}

/* Expand Icon Styles - chevron down */
.banfi-expand-icon {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
}

.banfi-expand-icon::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-right: 2.5px solid #333;
    border-bottom: 2.5px solid #333;
    transform: rotate(45deg);
    top: 3px;
    left: 3px;
}

.banfi-search-form h3,
.banfi-product-search-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.4em;
}

.banfi-product-name {
    margin-bottom: 20px;
    padding: 10px;
    background: #e3f2fd;
    border-left: 4px solid #007cba;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}

.banfi-form-group {
    margin-bottom: 15px;
}

.banfi-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.banfi-form-group input,
.banfi-form-group select {
    width: 100%;
    max-width: 300px;
    padding: 10px;
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.banfi-form-group input:focus,
.banfi-form-group select:focus {
    outline: none;
    border-color: #c29a5c;
    box-shadow: 0 0 0 2px rgba(194, 154, 92, 0.1);
}

/* Input Container - holds input group and expand button */
.banfi-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

/* Input Group Styles */
.banfi-input-group {
    display: flex;
    flex: 1;
    position: relative;
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.banfi-input-group:focus-within {
    border-color: #c29a5c;
    box-shadow: 0 0 0 2px rgba(194, 154, 92, 0.1);
}

.banfi-input-group input {
    flex: 1;
    border: none;
    border-radius: 0;
    max-width: none;
    padding: 10px 12px;
    background: white;
}

.banfi-input-group input:focus {
    outline: none;
    box-shadow: none;
    border-color: transparent;
}

#banfi-search-btn,
#banfi-use-location-btn,
.banfi-product-search-btn,
.banfi-product-use-location-btn {
    background: #751e22;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-right: 10px;
    margin-top: 10px;
    transition: background-color 0.3s ease;
}

#banfi-search-btn:hover,
.banfi-product-search-btn:hover {
    background: #5a1a1d;
}

#banfi-use-location-btn:hover,
.banfi-product-use-location-btn:hover {
    background: transparent;
    opacity: 0.7;
}

#banfi-use-location-btn,
.banfi-product-use-location-btn {
    background: transparent;
    padding: 12px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    margin-right: 0;
}

#banfi-use-location-btn:hover,
.banfi-product-use-location-btn:hover {
    background: transparent;
    opacity: 0.7;
}

/* Location Button in Input Group */
.banfi-location-btn {
    border: none;
    border-left: 1px solid #e2e2e2;
    border-radius: 0;
    margin: 0;
    flex-shrink: 0;
    background: transparent;
    transition: opacity 0.3s ease;
    position: relative;
    padding: 12px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}



.banfi-location-btn:hover {
    background: transparent;
    opacity: 0.7;
}

.banfi-location-btn:active {
    background: transparent;
    opacity: 0.5;
}

.banfi-location-btn:focus {
    outline: none;
    box-shadow: none;
}

/* Location Pin Icon Styles */
.banfi-target-icon {
    position: relative;
    width: 14px;
    height: 18px;
    display: inline-block;
}

.banfi-target-icon::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: radial-gradient(circle at center, white 3px, #333 3px, #333 100%);
    border-radius: 50%;
    top: 0;
    left: 0;
}

.banfi-target-icon::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid #333;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Loading Styles */
#banfi-loading,
.banfi-product-loading {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

#banfi-loading p,
.banfi-product-loading p {
    margin: 0;
    font-size: 16px;
    color: #666;
}

/* Error Styles */
.banfi-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

/* Results Container */
#banfi-results,
.banfi-product-results {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    max-height: calc(100vh - 200px);
}

.banfi-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e2e2;
    background: white;
    flex-shrink: 0;
}

.banfi-results-header h4 {
    margin: 0;
    color: #751e22;
    font-size: 1.3em;
}

#banfi-results-count {
    color: #666;
    font-size: 14px;
}

.banfi-results-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Store List Styles */
.banfi-store-list {
    flex: 1;
    overflow-y: auto;
    background: white;
    min-height: 0;
    max-height: calc(100vh - 300px);
    padding-right: 5px;
    padding-bottom: 80px;
    box-sizing: border-box;
}

.banfi-store-item {
    padding: 20px;
    border-bottom: 1px solid #e2e2e2;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

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

.banfi-store-item:hover {
    background: #f8f9fa;
}

.banfi-store-item.highlighted {
    background: #faf7f0;
    border-left: 4px solid #c29a5c;
}

.banfi-online-vendor {
    background: #f0f8f4;
    border-left: 4px solid #28a745;
}

.banfi-online-vendor:hover {
    background: #e8f5e8;
}

.banfi-store-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.banfi-store-name {
    margin: 0;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
    flex: 1;
}

.banfi-store-distance {
    background: #751e22;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 10px;
}

.banfi-store-type {
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 10px;
}

.banfi-store-details {
    margin-bottom: 15px;
}

.banfi-store-details p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.banfi-store-address {
    font-weight: 500;
    color: #333 !important;
}

.banfi-store-phone {
    color: #007cba !important;
}

.banfi-store-last-sold {
    font-size: 13px !important;
    color: #888 !important;
}

.banfi-store-actions {
    display: flex;
    gap: 10px;
}

.banfi-directions-btn,
.banfi-visit-btn {
    background: #751e22;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.banfi-directions-btn:hover,
.banfi-visit-btn:hover {
    background: #5a1a1d;
}

.banfi-visit-btn {
    background: #28a745;
}

.banfi-visit-btn:hover {
    background: #1e7e34;
}

/* Map Container Styles */
.banfi-map-container {
    flex: 1;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Map Styles */
.banfi-map {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
    min-height: 400px;
}

/* Info Window Styles */
/* Google Maps InfoWindow Container Styling */
.gm-style .gm-style-iw-c {
    border: 2px solid #c29a5c !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    padding: 0;
}

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

/* Style the default close button */
.gm-style .gm-style-iw-chr {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: 24px !important;
    height: 24px !important;
    background: white !important;
    border-radius: 50% !important;
    z-index: 1000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.gm-style .gm-style-iw-chr > div {
    background: transparent !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    opacity: 1 !important;
}

.gm-style .gm-style-iw-chr > div > div {
    background: #666 !important;
    width: 12px !important;
    height: 2px !important;
    transform: rotate(45deg) !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    margin: -1px 0 0 -6px !important;
}

.gm-style .gm-style-iw-chr > div > div + div {
    transform: rotate(-45deg) !important;
}

.banfi-info-window {
    max-width: 320px;
    padding: 0;
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
}

.banfi-info-window h4 {
    margin: 0;
    padding: 16px 20px 12px;
    color: #751e22;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, #751e22 0%, #8b2428 100%);
    background: -webkit-linear-gradient(135deg, #751e22 0%, #8b2428 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border-bottom: 1px solid rgba(194, 154, 92, 0.2);
}

.banfi-info-window p {
    margin: 0;
    padding: 8px 20px;
    color: #444;
    font-size: 14px;
    line-height: 1.5;
}

.banfi-info-window p:first-of-type {
    padding-top: 4px;
    font-weight: 500;
    color: #333;
}

.banfi-info-window p strong {
    color: #751e22;
    font-weight: 600;
}

.banfi-info-actions {
    margin: 0;
    padding: 16px 20px 20px;
    border-top: 1px solid rgba(194, 154, 92, 0.2);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.banfi-directions-link,
.banfi-call-link {
    background: linear-gradient(135deg, #751e22 0%, #8b2428 100%);
    color: white !important;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(117, 30, 34, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.banfi-directions-link:active,
.banfi-call-link:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(117, 30, 34, 0.2);
}

.banfi-call-link {
    background: linear-gradient(135deg, #c29a5c 0%, #d4a968 100%);
    color: #751e22 !important;
}

.banfi-call-link:hover {
    background: linear-gradient(135deg, #b8935a 0%, #c29a5c 100%);
    color: #5a1a1d !important;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    #banfi-store-locator {
        flex-direction: column;
        height: auto;
    }

    .banfi-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }

    .banfi-map-container {
        height: 400px;
    }

    .banfi-store-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .banfi-store-distance,
    .banfi-store-type {
        margin-left: 0;
        margin-top: 5px;
    }

    .banfi-form-group input,
    .banfi-form-group select {
        max-width: 100%;
    }

    .banfi-input-group {
        max-width: 100%;
    }

    #banfi-search-btn {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .banfi-location-btn {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .banfi-store-actions {
        flex-direction: column;
    }

    .banfi-directions-btn,
    .banfi-visit-btn {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .banfi-search-form {
        padding: 15px;
    }

    .banfi-store-item {
        padding: 15px;
    }

    .banfi-map-container {
        height: 300px !important;
    }
}

/* Custom Scrollbar for Store List */
.banfi-store-list::-webkit-scrollbar {
    width: 8px;
}

.banfi-store-list::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}

.banfi-store-list::-webkit-scrollbar-thumb {
    background: #e2e2e2;
    border-radius: 4px;
}

.banfi-store-list::-webkit-scrollbar-thumb:hover {
    background: #c29a5c;
}

/* Animation for store items */
.banfi-store-item {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
