/* ═══════════════════════════════════════════════════
   Dealer Locator Map  ·  Frontend CSS  v2.1
   No color-mix(). Uses solid fallback palette.
   CSS vars: --dl-primary, --dl-accent (set inline by PHP)
═══════════════════════════════════════════════════ */
#dl-wrap {
    /* Fallback values — overridden inline by PHP */
    --dl-primary:     #1a73e8;
    --dl-accent:      #d32f2f;
    --dl-primary-bg:  #e8f0fe;   /* ~10% primary on white */
    --dl-primary-bdr: #b3c8f7;   /* ~30% primary border  */
    --dl-text:        #1a1a2e;
    --dl-muted:       #666;
    --dl-border:      #dde1e7;
    --dl-bg:          #f4f6fb;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    border: 1px solid var(--dl-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 32px rgba(0,0,0,.1);
    background: #fff;
    margin: 24px 0;
    line-height: 1.5;
}

/* ── Header / search area ── */
#dl-header {
    background: var(--dl-primary);   /* solid color, safe everywhere */
    padding: 22px 24px 14px;
}

#dl-title {
    margin: 0 0 3px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}
#dl-subtitle {
    margin: 0 0 14px;
    font-size: 13px;
    color: rgba(255,255,255,.8);
}

/* ── Search row ── */
#dl-search-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

#dl-search-field-wrap {
    flex: 1;
    min-width: 160px;
    position: relative;
}
#dl-search-field-wrap .dl-si {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    stroke: #999;
    pointer-events: none;
}
#dl-search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
    transition: box-shadow .2s;
}
#dl-search-input:focus { box-shadow: 0 0 0 3px rgba(255,255,255,.55); }

/* Radius select */
#dl-radius-select {
    padding: 10px 12px;
    border: 1.5px solid rgba(255,255,255,.45);
    border-radius: 8px;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: background .15s;
    white-space: nowrap;
}
#dl-radius-select:hover  { background: rgba(255,255,255,.24); }
#dl-radius-select option { color: #333; background: #fff; }

/* Search button */
#dl-search-btn {
    padding: 10px 20px;
    background: #fff;
    color: var(--dl-primary);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
    transition: opacity .15s, transform .1s;
}
#dl-search-btn:hover  { opacity: .88; }
#dl-search-btn:active { transform: scale(.97); }

/* My Location button */
#dl-location-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(255,255,255,.14);
    border: 1.5px solid rgba(255,255,255,.5);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
#dl-location-btn svg { width:16px; height:16px; flex-shrink:0; }
#dl-location-btn:hover    { background: rgba(255,255,255,.28); }
#dl-location-btn:disabled { opacity: .6; cursor: not-allowed; }
#dl-location-btn.dl-loading { pointer-events: none; }
#dl-location-btn.dl-loading::before {
    content: '';
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dl-spin .65s linear infinite;
}
@keyframes dl-spin { to { transform: rotate(360deg); } }

/* Clear button */
#dl-clear-btn {
    padding: 9px 14px;
    background: rgba(255,255,255,.14);
    border: 1.5px solid rgba(255,255,255,.35);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s;
    line-height: 1;
}
#dl-clear-btn:hover { background: rgba(255,255,255,.3); }
#dl-clear-btn.dl-hidden { display: none; }

/* Status bar */
#dl-status-bar {
    margin-top: 10px;
    min-height: 20px;
    font-size: 12.5px;
    color: rgba(255,255,255,.85);
}
#dl-status-bar.dl-status-loading { font-style: italic; }
#dl-status-bar.dl-status-error   { color: #ffcdd2; font-weight: 600; }
#dl-status-bar.dl-status-nearby {
    display: inline-block;
    background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

/* ── Body: sidebar + map ── */
#dl-body {
    display: flex;
    min-height: 400px;
}

/* ── Sidebar ── */
#dl-sidebar {
    width: 320px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    background: var(--dl-bg);
    border-right: 1px solid var(--dl-border);
    overflow: hidden;
}
#dl-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#dl-list-inner {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

/* ── Dealer card ── */
.dl-card {
    padding: 12px 16px;
    border-bottom: 1px solid #e8ecf2;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background .12s, border-color .12s;
    background: #fff;
}
.dl-card:last-child { border-bottom: none; }
.dl-card:hover  { background: #edf3fd; border-left-color: var(--dl-primary); }
.dl-card.active { background: #dce8fc; border-left-color: var(--dl-primary); }

.dl-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 4px;
}
.dl-card-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--dl-text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dl-dist {
    font-size: 11px;
    font-weight: 700;
    color: var(--dl-primary);
    background: var(--dl-primary-bg);
    border: 1px solid var(--dl-primary-bdr);
    border-radius: 12px;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
.dl-card-addr {
    font-size: 12px;
    color: var(--dl-muted);
    margin-bottom: 3px;
    line-height: 1.5;
}
.dl-meta {
    font-size: 12px;
    color: #555;
    margin-bottom: 2px;
}
.dl-hours { color: #6a5700; }
.dl-no-pin {
    display: inline-block;
    font-size: 10px;
    background: #fff3cd;
    color: #7a5c00;
    border-radius: 4px;
    padding: 1px 6px;
    margin-top: 3px;
}

/* Card buttons */
.dl-card-actions {
    display: flex;
    gap: 7px;
    margin-top: 9px;
}

/* Directions button */
.dl-btn-dir {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    background: var(--dl-primary);
    color: #fff;
    transition: opacity .15s, transform .1s;
    white-space: nowrap;
    text-decoration: none;
}
.dl-btn-dir:hover  { opacity: .88; }
.dl-btn-dir:active { transform: scale(.97); }

/* Website button */
.dl-btn-web {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 1.5px solid var(--dl-primary-bdr);
    background: var(--dl-primary-bg);
    color: var(--dl-primary);
    transition: opacity .15s;
    white-space: nowrap;
    text-decoration: none;
}
.dl-btn-web:hover { opacity: .8; }

/* Empty state */
.dl-empty {
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
}
.dl-empty svg { display: block; margin: 0 auto 12px; opacity: .3; }
.dl-empty p { margin: 0; font-size: 14px; color: #888; line-height: 1.6; }
.dl-msg { text-align: center; color: #bbb; padding: 40px 16px; font-size: 14px; }

/* ── Pagination ── */
#dl-pagination {
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid var(--dl-border);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
}
.dl-pg {
    min-width: 34px;
    height: 32px;
    padding: 0 9px;
    border: 1px solid var(--dl-border);
    border-radius: 6px;
    background: #fff;
    color: #444;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    line-height: 1;
}
.dl-pg:hover  { background: var(--dl-primary-bg); border-color: var(--dl-primary); color: var(--dl-primary); }
.dl-pg.active { background: var(--dl-primary); border-color: var(--dl-primary); color: #fff; font-weight: 700; }
.dl-ell       { line-height: 32px; color: #aaa; font-size: 13px; }

/* ── Map ── */
#dl-map {
    flex: 1;
    z-index: 0;
    /* Minimum height so map is visible even on small screens */
    min-height: 300px;
}

/* ── Leaflet popup overrides ── */
.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,.14) !important;
    padding: 0 !important;
    overflow: hidden;
}
.leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
}
.leaflet-popup-tip-container { margin-top: -1px; }

.dl-popup {
    min-width: 220px;
    max-width: 290px;
    padding: 14px 16px 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}
.dl-popup h4 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: #111;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
    line-height: 1.4;
}
.dl-popup p {
    margin: 0 0 4px;
    font-size: 12.5px;
    color: #555;
    line-height: 1.5;
}
/* inline links inside popup text (phone, email) */
.dl-popup p a {
    color: var(--dl-primary, #1a73e8);
    text-decoration: none;
}
.dl-popup p a:hover { text-decoration: underline; }
.dl-pop-addr { color: #444 !important; }
.dl-pop-dist { font-weight: 700; color: var(--dl-primary, #1a73e8) !important; }
.dl-pop-desc { color: #777; font-style: italic; border-top: 1px solid #eee; margin-top: 5px !important; padding-top: 5px; }

/* ── Action button row ── */
.dl-pop-actions {
    display: flex;
    flex-direction: row;
    gap: 7px;
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px solid #eef0f3;
    flex-wrap: nowrap;
}
/* Base button — fully isolated from theme link styles */
.dl-pop-btn,
.dl-pop-btn:link,
.dl-pop-btn:visited {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding: 7px 13px !important;
    border-radius: 7px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    border: none !important;
    box-sizing: border-box !important;
    transition: filter .15s, transform .1s !important;
    flex: 1 !important;
    text-align: center !important;
}
.dl-pop-btn:hover,
.dl-pop-btn:focus {
    text-decoration: none !important;
    outline: none !important;
    transform: translateY(-1px) !important;
}
/* Directions — primary colour fill */
.dl-pop-dir,
.dl-pop-dir:link,
.dl-pop-dir:visited {
    background: var(--dl-primary, #1a73e8) !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(26,115,232,.35) !important;
}
.dl-pop-dir:hover { filter: brightness(1.12) !important; color: #fff !important; }
/* Website — ghost / outline style */
.dl-pop-web,
.dl-pop-web:link,
.dl-pop-web:visited {
    background: #fff !important;
    color: var(--dl-primary, #1a73e8) !important;
    border: 1.5px solid var(--dl-primary, #1a73e8) !important;
    box-shadow: none !important;
}
.dl-pop-web:hover { background: #f0f6ff !important; color: var(--dl-primary, #1a73e8) !important; }

/* ── Responsive ── */
@media (max-width: 680px) {
    #dl-body { flex-direction: column; height: auto !important; }
    #dl-sidebar { width: 100%; min-width: 0; max-height: 280px; border-right: none; border-bottom: 1px solid var(--dl-border); }
    #dl-map { height: 320px !important; min-height: 280px; }
    #dl-location-btn .dl-loc-text { display: none; }
}

/* ═══════════════════════════════════════════════
   CATEGORY BADGES — frontend cards & popups
═══════════════════════════════════════════════ */

/* Shortcode active-category label strip */
#dl-sc-filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    font-size: 12px;
    color: rgba(255,255,255,.8);
}
#dl-sc-filter-label::before { content: 'Showing: '; font-weight: 600; }

.dl-sc-cat-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    border: 1.5px solid;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255,255,255,.15);
    color: #fff;
}

/* Category filter dropdown in header */
#dl-cat-filter {
    padding: 10px 12px;
    border: 1.5px solid rgba(255,255,255,.45);
    border-radius: 8px;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: background .15s;
    white-space: nowrap;
}
#dl-cat-filter:hover { background: rgba(255,255,255,.24); }
#dl-cat-filter option { color: #333; background: #fff; }

/* Badges on dealer cards */
.dl-cat-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 5px 0 2px;
}

.dl-cat-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1.5px solid;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}

/* Badges in map popups */
.dl-pop-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 6px 0 4px;
    padding-top: 6px;
    border-top: 1px solid #eef0f3;
}

/* ═══════════════════════════════════════════════
   MARKER CLUSTERS
═══════════════════════════════════════════════ */

/* Override default Leaflet cluster styles with brand colours */
.dl-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.85);
    box-shadow: 0 2px 10px rgba(0,0,0,.28);
    color: #fff;
    font-weight: 800;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}
.dl-cluster:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.dl-cluster-sm { width: 36px; height: 36px; font-size: 13px; }
.dl-cluster-md { width: 44px; height: 44px; font-size: 15px; }
.dl-cluster-lg { width: 52px; height: 52px; font-size: 17px; }

/* Cluster count label */
.dl-cluster span {
    line-height: 1;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

/* Sidebar: remove old pagination wrapper, make list fully scrollable */
#dl-pagination { display: none; }

#dl-list-container {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#dl-list-inner {
    flex: 1;
    overflow-y: visible;
}

/* Result count shows total without page reference */
.dl-status-info,
.dl-status-nearby {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
