/* Bloom Desktop Store Locator Styles */

/* Neutralise WordPress block layout constraints (is-layout-constrained) that
   would cap the width and force margin: auto on block/shortcode content. */
.is-layout-constrained > .bloom-desktop-store-locator,
.is-layout-flow > .bloom-desktop-store-locator {
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Container */
.bloom-desktop-store-locator {
    width: 100%;
    margin: 0 auto;
}

.bloom-desktop-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.bloom-desktop-container-wide {
    max-width: 75vw;
    margin: 0 auto;
    padding: 0 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.bloom-desktop-container-full {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    border-bottom: 1px solid #e5e7eb;
}

@media (max-width: 767px) {
    .bloom-desktop-container-wide,
    .bloom-desktop-container-full {
        max-width: 100%;
        padding: 0 1rem;
    }
}

.bloom-desktop-content {
    padding: 2rem 0;
}

/* Header (title + description) */
.bloom-desktop-header {
    margin-bottom: 2.5rem;
}

.bloom-desktop-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.875rem 0;
    color: #111827;
}

.bloom-desktop-title--left        { text-align: left; }
.bloom-desktop-title--center      { text-align: center; }
.bloom-desktop-title--right       { text-align: right; }

.bloom-desktop-description {
    font-size: 0.9375rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.6;
}

.bloom-desktop-description--left   { text-align: left; }
.bloom-desktop-description--center { text-align: center; }
.bloom-desktop-description--right  { text-align: right; }

/* Grid Layout */
.bloom-desktop-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: stretch;
}

@media (min-width: 768px) {
    .bloom-desktop-grid {
        grid-template-columns: 1fr 1fr;
        height: 650px;
    }

    /* Map on left: swap column order */
    .bloom-desktop-map-left .bloom-desktop-map-column {
        order: -1;
    }
}

/* Filters Column */
.bloom-desktop-filters-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    height: 100%;
}

/* Form Elements */
.bloom-desktop-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    padding-bottom: 0.5rem;
}

.bloom-desktop-select,
.bloom-desktop-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #1f2937;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.bloom-desktop-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.5rem;
    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='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.bloom-desktop-select:focus,
.bloom-desktop-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Search Bar */
.bloom-desktop-search-wrap {
    position: relative;
}

.bloom-desktop-search-input {
    padding-left: 2.25rem;
    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='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.625rem center;
    background-size: 1rem 1rem;
}

/* Results Container — fills column height to match map, scroll for overflow */
.bloom-desktop-results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background-color: #fff;
}

.bloom-desktop-results::-webkit-scrollbar {
    width: 8px;
}

.bloom-desktop-results::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.bloom-desktop-results::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.bloom-desktop-results::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* No results / loading messages */
.bloom-desktop-no-results,
.bloom-desktop-loading {
    padding: 1.5rem 1rem;
    color: #6b7280;
    font-size: 0.875rem;
    text-align: center;
}

/* Result Item */
.bloom-desktop-result-item {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.bloom-desktop-result-item:last-child {
    border-bottom: none;
}

.bloom-desktop-result-item:hover {
    background-color: #eff6ff;
}

.bloom-desktop-result-item.bloom-desktop-selected {
    background-color: #dbeafe;
    border-left: 3px solid #3b82f6;
    padding-left: calc(1rem - 3px);
}

.bloom-desktop-result-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.bloom-desktop-icon {
    flex-shrink: 0;
    margin-top: 0.125rem;
    color: #374151;
}

.bloom-desktop-result-text {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.bloom-desktop-store-title {
    display: block;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: #111827;
}

.bloom-desktop-store-address {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.bloom-desktop-store-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
}

.bloom-desktop-store-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Map Column */
.bloom-desktop-map-column {
    display: flex;
    flex-direction: column;
}

/* Map */
.bloom-desktop-map {
    width: 100%;
    height: 300px;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    z-index: 0;
}

@media (min-width: 768px) {
    .bloom-desktop-map {
        height: 650px;
    }
}

.bloom-desktop-map.bloom-desktop-hidden {
    display: none;
}

/* Map Footer Text — spans full component width, outside the grid */
.bloom-desktop-map-text {
    font-size: 0.875rem;
    color: #6b7280;
    padding: 1.25rem 0 0;
    margin-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
    width: 100%;
}

.bloom-desktop-map-text p {
    margin: 0;
}

.bloom-desktop-map-text--left   { text-align: left; }
.bloom-desktop-map-text--center { text-align: center; }
.bloom-desktop-map-text--right  { text-align: right; }

/* No Results */
.bloom-desktop-no-results {
    padding: 2rem;
    text-align: center;
}

.bloom-desktop-no-results p {
    margin: 0 0 1rem 0;
    color: #374151;
}

.bloom-desktop-no-results ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    text-align: left;
    display: inline-block;
}

.bloom-desktop-no-results li {
    margin-bottom: 0.5rem;
    color: #6b7280;
}

.bloom-desktop-reset-search {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.bloom-desktop-reset-search:hover {
    background-color: #2563eb;
}

/* Leaflet Popup Customization */
.leaflet-popup-content {
    margin: 0.75rem 1rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.leaflet-popup-content strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
}

.bloom-desktop-popup-address {
    font-size: 0.8125rem;
    color: #4b5563;
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

.bloom-desktop-popup-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bloom-desktop-popup-actions a,
.leaflet-popup-content .bloom-desktop-popup-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: start;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    color: #6b7280;
    background: transparent;
    text-decoration: none !important;
    font-weight: normal;
    transition: background 0.15s, color 0.15s;
    outline: none;
}

.bloom-desktop-popup-actions a:hover,
.leaflet-popup-content .bloom-desktop-popup-actions a:hover {
    color: #3b82f6;
    text-decoration: none !important;
}

/* Website link — wider to accommodate text */
.bloom-desktop-popup-actions .bloom-desktop-popup-website,
.leaflet-popup-content .bloom-desktop-popup-actions .bloom-desktop-popup-website {
    width: auto;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #3b82f6;
    background: transparent;
}

.bloom-desktop-popup-actions .bloom-desktop-popup-website:hover,
.leaflet-popup-content .bloom-desktop-popup-actions .bloom-desktop-popup-website:hover {
    color: #2563eb;
}

.leaflet-popup-content a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.leaflet-popup-content a:hover {
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .bloom-desktop-content {
        padding: 1rem 0;
    }

    .bloom-desktop-grid {
        gap: 1.5rem;
    }

    .bloom-desktop-results {
        flex: none;
        max-height: 400px;
    }
}

/* "Use my location" button */
.bloom-desktop-near-me {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: #fff;
    color: #1f2937;
    font-size: 0.9375rem;
    line-height: 1.5;
    cursor: pointer;
    transition: border-color 0.15s ease-in-out, background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.bloom-desktop-near-me:hover {
    border-color: #3b82f6;
    color: #2563eb;
}

.bloom-desktop-near-me:focus-visible {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.bloom-desktop-near-me:disabled {
    cursor: progress;
    opacity: 0.7;
}

.bloom-desktop-near-me.bloom-desktop-near-me--active {
    border-color: #3b82f6;
    background-color: #eff6ff;
    color: #1d4ed8;
}

.bloom-desktop-near-me-status {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    color: #b91c1c;
}

/* Store row: heading with distance, contact details, actions */
.bloom-desktop-store-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.bloom-desktop-store-heading .bloom-desktop-store-title {
    margin-bottom: 0;
    min-width: 0;
}

.bloom-desktop-store-distance {
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
}

.bloom-desktop-store-phone,
.bloom-desktop-store-hours {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.bloom-desktop-store-phone a {
    color: inherit;
    text-decoration: none;
}

.bloom-desktop-store-phone a:hover {
    text-decoration: underline;
}

.bloom-desktop-store-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

/* Popup: contact details and directions link */
.bloom-desktop-popup-phone,
.bloom-desktop-popup-hours {
    font-size: 0.8125rem;
    color: #4b5563;
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

.leaflet-popup-content .bloom-desktop-popup-phone a {
    color: inherit;
    font-weight: normal;
}

.bloom-desktop-popup-actions {
    gap: 0.75rem;
}

.bloom-desktop-popup-actions .bloom-desktop-popup-directions,
.leaflet-popup-content .bloom-desktop-popup-actions .bloom-desktop-popup-directions {
    width: auto;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #3b82f6;
    white-space: nowrap;
}

.bloom-desktop-popup-actions .bloom-desktop-popup-website,
.leaflet-popup-content .bloom-desktop-popup-actions .bloom-desktop-popup-website {
    white-space: nowrap;
}

.bloom-desktop-popup-actions .bloom-desktop-popup-directions:hover,
.leaflet-popup-content .bloom-desktop-popup-actions .bloom-desktop-popup-directions:hover {
    color: #2563eb;
}

.bloom-desktop-popup-actions .bloom-desktop-popup-zoom {
    margin-left: auto;
}

/* Result counter above the list */
.bloom-desktop-results-count {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6b7280;
}

.bloom-desktop-results-count:empty {
    display: none;
}

/* Counter row with the "View map" shortcut */
.bloom-desktop-results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 1.25rem;
}

.bloom-desktop-view-map {
    display: none;
    flex-shrink: 0;
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    color: #3b82f6;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
}

.bloom-desktop-view-map:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Small screens: map is below the list */
@media (max-width: 767px) {
    .bloom-desktop-view-map {
        display: inline-block;
    }
}
