/* ============================================================
 * /css/fuel-map.css
 * Shared styles for the embeddable map widget (templates/fuel-map-section.php)
 * Also kept in sync with the inline <style> in /fuel-map.php for the
 * standalone page until that page is refactored to use this file.
 * ============================================================ */

/* ── Leaders ribbon (above map on /fuel-map, /currency-map, /mobile-map) ── */
.map-leaders {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    border-bottom: 1px solid #e5e7eb;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: thin;
}
.map-leaders::-webkit-scrollbar { height: 6px; }
.map-leaders::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.map-leader-card {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    min-width: 220px;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
    position: relative;
    text-decoration: none;
    color: inherit;
}
.map-leader-card:hover {
    transform: translateY(-2px);
    border-color: var(--leader-color, #0072bc);
    box-shadow: 0 6px 18px rgba(0,0,0,.06), 0 0 0 1px var(--leader-color, #0072bc) inset;
}
.map-leader-card .leader-logo,
.map-leader-card .leader-fallback {
    width: 40px; height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: #f9fafb;
    border: 1px solid #f1f5f9;
    overflow: hidden;
}
.map-leader-card .leader-logo img {
    width: 100%; height: 100%; object-fit: contain; padding: 4px;
}
.map-leader-card .leader-fallback {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    background: var(--leader-color, #6b7280);
}
.map-leader-card .leader-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 2px;
}
.map-leader-card .leader-cat {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-family: var(--font-nav, 'BPG No9', 'Noto Sans Georgian', sans-serif);
}
.map-leader-card .leader-cat i {
    color: var(--leader-color, #059669);
    margin-right: 4px;
    font-size: 10px;
}
.map-leader-card .leader-line {
    display: flex; align-items: baseline; gap: 8px;
    font-family: var(--font-nav, 'BPG No9', 'Noto Sans Georgian', sans-serif);
}
.map-leader-card .leader-price {
    font-weight: 700; color: #0f172a;
    font-size: 15px;
    font-family: 'Inter', system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
}
.map-leader-card .leader-price-unit {
    font-size: 11px; color: #6b7280;
    font-family: 'Inter', system-ui, sans-serif;
}
.map-leader-card .leader-brand {
    font-size: 12px; color: #475569;
    font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Pharmacy "top discount" leader cards — extras on top of base ribbon */
.map-leader-card--deal { padding-right: 36px; }
.map-leader-card--deal .leader-discount-badge {
    position: absolute;
    top: 8px; right: 8px;
    background: #ef4444;
    color: #fff;
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 700;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: -.2px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, .35);
}
.map-leader-card--deal .leader-old-price {
    font-family: 'Inter', system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
    color: #94a3b8;
    text-decoration: line-through;
    font-size: 12px;
    margin-right: 4px;
}
.map-leaders-empty {
    padding: 14px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
}
@media (max-width: 768px) {
    .map-leaders { padding: 10px 12px; gap: 8px; }
    .map-leader-card { min-width: 180px; padding: 8px 10px; }
    .map-leader-card .leader-logo,
    .map-leader-card .leader-fallback { width: 34px; height: 34px; }
    .map-leader-card .leader-price { font-size: 14px; }
}

/* ── Section wrapper ─────────────────────────────────────── */
.brand-map-section { margin: 32px 0; }
.brand-map-section .section-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.brand-map-section .section-header h2 {
    margin: 0; font-size: 22px; font-weight: 700; color: #111827;
    font-family: var(--font-heading, 'BPG Banner SuperSquare Caps', 'Noto Sans Georgian', sans-serif);
}
.brand-map-section .section-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--station-color, #0072bc); color: #fff; font-size: 16px;
}
.brand-map-section .map-stage {
    position: relative; border-radius: 14px; overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
    border: 1px solid #e5e7eb;
}
.brand-map-section .brand-map { width: 100%; }
.brand-map-section .map-attrib {
    position: absolute; bottom: 0; right: 0; z-index: 1;
    background: rgba(255,255,255,.92); font-size: 11px;
    padding: 3px 8px; border-radius: 6px 0 0 0; color: #6b7280;
    backdrop-filter: blur(4px);
}
.brand-map-section .map-attrib a { color: #059669; text-decoration: none; }
.brand-map-section .map-attrib a:hover { text-decoration: underline; }

/* ── Popup container ─────────────────────────────────────── */
.maplibregl-popup {
    z-index: 5;
}
.maplibregl-popup-content {
    font-family: 'BPG No9', 'BPG Glaho Bold', 'Noto Sans Georgian', sans-serif;
    padding: 22px 22px 18px;
    max-width: 340px;
    border-radius: 16px;
    box-shadow:
        0 20px 50px -10px rgba(0,0,0,.18),
        0 6px 16px rgba(0,0,0,.08),
        0 0 0 1px rgba(0,0,0,.04);
    border: 0;
    animation: popContentIn .18s cubic-bezier(.2,.9,.3,1.05);
}
@keyframes popContentIn {
    from { opacity: 0; transform: translateY(4px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.maplibregl-popup-tip {
    border-top-color: #ffffff !important;
    border-bottom-color: #ffffff !important;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.06));
}

/* ── CLOSE BUTTON — replace MapLibre's tiny default ─────── */
.maplibregl-popup-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f3f4f6;
    color: #4b5563;
    font-family: -apple-system, system-ui, 'Segoe UI', sans-serif;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.maplibregl-popup-close-button:hover {
    background: #ef4444;
    color: #fff;
    transform: scale(1.06);
    box-shadow: 0 2px 6px rgba(239,68,68,.35);
}
.maplibregl-popup-close-button:focus-visible {
    outline: 2px solid #0072bc;
    outline-offset: 2px;
}
.maplibregl-popup-close-button:active { transform: scale(.98); }

/* ── Popup header (logo + name + brand) ──────────────────── */
.pop-head {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px; padding-bottom: 14px;
    padding-right: 38px; /* room for close button */
    border-bottom: 1px solid #f1f5f9;
}
.pop-head .badge {
    width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.pop-logo {
    width: 44px; height: 44px; object-fit: contain;
    border-radius: 10px; background: #f9fafb; padding: 5px;
    border: 1px solid #f1f5f9; flex-shrink: 0;
}
.pop-head-text { flex: 1; min-width: 0; }
.pop-name {
    font-size: 16px; font-weight: 700; color: #0f172a;
    line-height: 1.3; word-break: break-word;
}
.pop-brand {
    font-size: 12px; color: #64748b; margin-top: 3px;
    font-weight: 500;
}

/* ── Detail rows ─────────────────────────────────────────── */
.pop-row {
    font-size: 13.5px; color: #475569;
    margin: 6px 0; line-height: 1.5;
    display: flex; align-items: flex-start;
}
.pop-row i {
    width: 18px; flex-shrink: 0;
    color: #94a3b8; margin-right: 8px; margin-top: 2px;
    font-size: 12px;
}
.pop-row a { color: #0072bc; text-decoration: none; }
.pop-row a:hover { text-decoration: underline; }

/* ── Prices block ────────────────────────────────────────── */
.pop-prices {
    margin-top: 14px;
    padding: 14px 14px 10px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.pop-prices-title {
    font-size: 11px; color: #64748b; font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase; letter-spacing: .8px;
}
.pop-prices-title i { color: #059669; margin-right: 6px; }
.pop-fuel-row {
    display: flex; align-items: baseline; gap: 8px;
    padding: 6px 0;
    border-bottom: 1px dashed #cbd5e1;
    font-size: 13.5px;
}
.pop-fuel-row:last-child { border-bottom: 0; }
.pop-fuel-name { flex: 1; color: #334155; }
.pop-fuel-price {
    font-weight: 700; color: #059669;
    font-size: 14.5px;
    font-family: 'Inter', system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
}
.pop-fuel-card {
    font-size: 11px; color: #64748b;
    font-family: 'Inter', system-ui, sans-serif;
}

/* ── Detail link ─────────────────────────────────────────── */
.pop-detail {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 12px; font-size: 12px; color: #059669;
    text-decoration: none; font-weight: 500;
}
.pop-detail:hover { text-decoration: underline; }

/* ── Route button ────────────────────────────────────────── */
.pop-route-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding: 11px 14px;
    background: linear-gradient(180deg, #0084dd 0%, #0072bc 100%);
    color: #fff;
    border: 0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
    box-shadow: 0 2px 8px rgba(0,114,188,.3), inset 0 1px 0 rgba(255,255,255,.15);
}
.pop-route-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 4px 14px rgba(0,114,188,.4), inset 0 1px 0 rgba(255,255,255,.15);
}
.pop-route-btn:active { transform: translateY(0); }
.pop-route-btn:disabled {
    background: #94a3b8;
    cursor: default;
    transform: none;
    box-shadow: none;
    filter: none;
}

/* ── Hint (when GPS not enabled) ─────────────────────────── */
.pop-hint {
    margin-top: 14px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-radius: 10px;
    font-size: 12px;
    color: #78350f;
    line-height: 1.5;
}
.pop-hint i { color: #b45309; margin-right: 6px; }

/* ── Clear-route control on map ──────────────────────────── */
.clear-route-btn {
    position: absolute; top: 12px; left: 12px; z-index: 2;
    display: none; align-items: center; gap: 8px;
    padding: 10px 16px;
    background: #ef4444; color: #fff;
    border: 0; border-radius: 10px;
    font-family: 'BPG No9', 'Noto Sans Georgian', sans-serif;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(239,68,68,.4), 0 1px 2px rgba(0,0,0,.05);
    transition: background .15s ease, transform .12s ease, box-shadow .12s ease;
}
.clear-route-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239,68,68,.5);
}
.clear-route-btn:active { transform: translateY(0); }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .brand-map-section .section-header h2 { font-size: 18px; }
    .brand-map-section .map-stage { border-radius: 10px; }
    .maplibregl-popup-content { padding: 18px 18px 14px; max-width: 300px; }
    .maplibregl-popup-close-button { top: 8px; right: 8px; }
}
