/*
 * Blank Page Locator – by Bluespider
 * Frontend Stylesheet v1.0.0
 *
 * Scoped to .bpl-locator. Does NOT reset or override theme global styles.
 * Colours are driven by CSS variables set inline per-instance from the
 * plugin's Style settings, so client sites can theme this without editing CSS.
 */

.bpl-locator {
    --bpl-primary:    #0d8dd4;
    --bpl-accent:     #0a6fa8;
    --bpl-marker:     #0d8dd4;
    --bpl-text:       #1a1a2e;
    --bpl-text-muted: #64748b;
    --bpl-border:     #e2e8f0;
    --bpl-bg:         #ffffff;
    --bpl-bg-alt:     #f8fafc;
    --bpl-success:    #16a34a;
    --bpl-error:      #dc2626;
    --bpl-radius:     8px;
    --bpl-btn-radius: 8px;
    --bpl-card-radius: 8px;
    --bpl-field-radius: 8px;
    --bpl-btn-color:  #0d8dd4;
    --bpl-font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --bpl-trans:      0.15s ease;

    font-family: var(--bpl-font);
    color: var(--bpl-text);
    width: 100%;
}

.bpl-locator * { box-sizing: border-box; }

/* ── Search bar ─────────────────────────────────────────────── */

.bpl-locator__search {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 20px;
}

/* Many themes apply `input, select, button { width: 100% }` as a global reset,
   which forces every field onto its own row inside a flex layout. Everything
   in the search bar gets an explicit width so it sizes to its flex rules
   instead of the theme's defaults. */
.bpl-locator__search input,
.bpl-locator__search select,
.bpl-locator__search button {
    width: auto;
    max-width: none;
}

.bpl-locator__input-wrap {
    flex: 1 1 240px;
    min-width: 0;
    position: relative;
}
.bpl-locator__input-wrap .bpl-locator__input {
    width: 100%; /* fill its own wrapper, not the whole search bar */
}

.bpl-locator__select,
.bpl-locator__geo-btn,
.bpl-locator__btn {
    flex: 0 0 auto;
}

.bpl-locator__input {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    font-size: 14.5px;
    font-family: var(--bpl-font);
    color: var(--bpl-text);
    background: var(--bpl-bg) !important;
    border: 1.5px solid var(--bpl-border) !important;
    border-radius: var(--bpl-field-radius) !important;
    transition: border-color var(--bpl-trans);
}
.bpl-locator__input:focus {
    outline: none;
    border-color: var(--bpl-primary) !important;
}

.bpl-locator__select {
    height: 44px;
    padding: 0 14px;
    font-size: 13.5px;
    font-family: var(--bpl-font);
    color: var(--bpl-text);
    background: var(--bpl-bg) !important;
    border: 1.5px solid var(--bpl-border) !important;
    border-radius: var(--bpl-field-radius) !important;
    cursor: pointer;
    min-width: 120px;
}
.bpl-locator__select:focus { outline: none; border-color: var(--bpl-primary) !important; }

.bpl-locator__btn {
    height: 44px;
    padding: 0 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--bpl-font);
    color: #fff !important;
    background: var(--bpl-btn-color) !important;
    border: none !important;
    border-radius: var(--bpl-btn-radius) !important;
    cursor: pointer;
    transition: filter var(--bpl-trans);
    white-space: nowrap;
}
.bpl-locator__btn:hover { filter: brightness(0.88); }
.bpl-locator__btn:disabled { opacity: 0.6; cursor: default; }

.bpl-locator__geo-btn {
    height: 44px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--bpl-font);
    color: var(--bpl-primary) !important;
    background: var(--bpl-bg) !important;
    border: 1.5px solid var(--bpl-primary) !important;
    border-radius: var(--bpl-btn-radius) !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background var(--bpl-trans);
}
.bpl-locator__geo-btn:hover { background: rgba(13,141,212,0.08); }
.bpl-locator__geo-btn:disabled { opacity: 0.6; cursor: default; }
.bpl-locator__geo-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.bpl-locator__error {
    font-size: 13px;
    color: var(--bpl-error);
    margin: -8px 0 14px;
}

/* ── Layout: split (list beside map) ───────────────────────── */

.bpl-locator__body {
    display: grid;
    gap: 20px;
}
.bpl-locator--split .bpl-locator__body {
    grid-template-columns: 380px 1fr;
    align-items: start;
}
.bpl-locator--map-top .bpl-locator__body {
    grid-template-columns: 1fr;
}
.bpl-locator--list-only .bpl-locator__body {
    grid-template-columns: 1fr;
}
@media (max-width: 780px) {
    .bpl-locator--split .bpl-locator__body { grid-template-columns: 1fr; }
    .bpl-locator--split .bpl-locator__map  { order: -1; }
}

.bpl-locator--map-top .bpl-locator__map { margin-bottom: 4px; }

/* ── Map ────────────────────────────────────────────────────── */

.bpl-locator__map {
    width: 100%;
    border-radius: var(--bpl-radius);
    overflow: hidden;
    border: 1px solid var(--bpl-border);
    background: var(--bpl-bg-alt);
}
.bpl-locator__map .leaflet-container { font-family: var(--bpl-font); }

.bpl-locator__marker-pin {
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0;
    background: var(--bpl-marker);
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.bpl-locator__marker-pin--origin {
    background: var(--bpl-text);
}

/* ── Results heading ────────────────────────────────────────── */

.bpl-locator__heading {
    font-size: 17px;
    font-weight: 700;
    color: var(--bpl-text);
    margin: 0 0 4px;
}
.bpl-locator__count {
    font-size: 12.5px;
    color: var(--bpl-text-muted);
    margin: 0 0 14px;
}

/* ── Results list ───────────────────────────────────────────── */

.bpl-locator__results {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 640px;
    overflow-y: auto;
    padding-right: 4px;
}

.bpl-locator__empty {
    font-size: 13.5px;
    color: var(--bpl-text-muted);
    padding: 24px 16px;
    text-align: center;
    background: var(--bpl-bg-alt);
    border: 1px dashed var(--bpl-border);
    border-radius: var(--bpl-card-radius) !important;
}

.bpl-card {
    border: 1.5px solid var(--bpl-border);
    border-radius: var(--bpl-card-radius) !important;
    padding: 16px;
    background: var(--bpl-bg);
    cursor: pointer;
    transition: border-color var(--bpl-trans), box-shadow var(--bpl-trans);
}
.bpl-card:hover,
.bpl-card--active {
    border-color: var(--bpl-primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.bpl-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 6px;
}

.bpl-card__media {
    display: flex;
    gap: 12px;
}
.bpl-card__thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--bpl-border);
}

.bpl-card__name {
    font-size: 15px;
    font-weight: 700;
    color: var(--bpl-text);
    margin: 0 0 2px;
}

.bpl-card__distance {
    font-size: 12px;
    font-weight: 700;
    color: var(--bpl-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.bpl-card__address {
    font-size: 13px;
    color: var(--bpl-text-muted);
    margin: 0 0 8px;
    line-height: 1.5;
}

.bpl-card__description {
    font-size: 13px;
    color: var(--bpl-text-muted);
    line-height: 1.5;
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bpl-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.bpl-card__badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(13,141,212,0.1);
    color: var(--bpl-primary);
}

.bpl-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-size: 12.5px;
    color: var(--bpl-text-muted);
    margin-bottom: 10px;
}
.bpl-card__meta a { color: var(--bpl-text-muted); text-decoration: none; }
.bpl-card__meta a:hover { color: var(--bpl-primary); }

.bpl-card__website-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.bpl-card__link-arrow {
    font-size: 12px;
    line-height: 1;
    transform: translateY(-1px);
}

/* ── Opening hours accordion ─────────────────────────────────── */

.bpl-card__hours-wrap {
    margin-bottom: 10px;
}

.bpl-card__hours-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    font-family: var(--bpl-font);
    font-size: 12.5px;
    color: var(--bpl-text-muted);
    cursor: pointer;
    text-align: left;
}
.bpl-card__hours-static {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--bpl-text-muted);
}
.bpl-card__hours-text { flex: 1 1 auto; }

.bpl-card__hours-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--bpl-success);
    flex-shrink: 0;
}
.bpl-card__hours-dot--closed { background: var(--bpl-error); }

.bpl-card__hours-chevron {
    display: inline-flex;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: var(--bpl-text-muted);
    transition: transform var(--bpl-trans);
}
.bpl-card__hours-chevron svg { width: 100%; height: 100%; }
.bpl-card__hours-toggle.is-expanded .bpl-card__hours-chevron { transform: rotate(180deg); }

.bpl-card__hours-panel {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--bpl-border);
    flex-direction: column;
    gap: 5px;
}
.bpl-card__hours-panel.is-open { display: flex; }
.bpl-card__hours-day-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--bpl-text-muted);
}
.bpl-card__hours-day-label { font-weight: 600; }

.bpl-card__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.bpl-card__action {
    font-size: 12px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: var(--bpl-btn-radius) !important;
    border: 1.5px solid var(--bpl-border);
    background: var(--bpl-bg);
    color: var(--bpl-text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: border-color var(--bpl-trans), color var(--bpl-trans);
}
.bpl-card__action:hover { border-color: var(--bpl-primary); color: var(--bpl-primary); }
.bpl-card__action--primary {
    background: var(--bpl-btn-color) !important;
    border-color: var(--bpl-btn-color) !important;
    color: #fff !important;
}
.bpl-card__action--primary:hover { filter: brightness(0.88); border-color: var(--bpl-btn-color) !important; color: #fff !important; }

/* ── Popup (map marker) ───────────────────────────────────────── */

.bpl-popup { font-family: var(--bpl-font); min-width: 180px; }
.bpl-popup__name { font-size: 13.5px; font-weight: 700; margin: 0 0 4px; color: var(--bpl-text); }
.bpl-popup__address { font-size: 12px; color: var(--bpl-text-muted); margin: 0 0 6px; line-height: 1.4; }
.bpl-popup__link { font-size: 12px; font-weight: 600; color: var(--bpl-accent) !important; text-decoration: none; }
.bpl-popup__link:hover { text-decoration: underline; }

/* ── Loading state ───────────────────────────────────────────── */

.bpl-locator__loading {
    font-size: 13px;
    color: var(--bpl-text-muted);
    padding: 20px;
    text-align: center;
}
