/* ============================================================
   EthioRoute — Map Container & Overlay Styles (map.css)
   Migrated to MapLibre GL JS
   ============================================================ */

#map {
    position: fixed;
    inset: 0;
    z-index: 0;
}

/* Push MapLibre controls below header */
.maplibregl-ctrl-top-right {
    top: 64px !important;
}

.maplibregl-ctrl-top-left {
    top: 64px !important;
}

/* ── MapLibre Popup Styles ────────────────────────────────── */
.maplibregl-popup {
    animation: popupEnter 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popupEnter {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.maplibregl-popup-content {
    background: var(--bg-1) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--bg-3) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12),
                0 2px 8px rgba(0, 0, 0, 0.06) !important;
    padding: 14px 16px 12px !important;
    font-family: 'Inter', 'Noto Sans Ethiopic', system-ui, sans-serif;
    font-size: 14px;
    min-width: 230px;
}

.maplibregl-popup-tip {
    border-top-color: var(--bg-1) !important;
}

.maplibregl-popup-close-button {
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    background: var(--bg-2) !important;
    color: var(--text-muted) !important;
    font-size: 13px !important;
    line-height: 24px !important;
    text-align: center !important;
    padding: 0 !important;
    top: 10px !important;
    right: 10px !important;
    transition: background 0.15s, color 0.15s;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.maplibregl-popup-close-button:hover {
    background: var(--bg-3) !important;
    color: var(--text-primary) !important;
}

/* ── MapLibre Zoom Controls ───────────────────────────────── */
.maplibregl-ctrl-group {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.maplibregl-ctrl-group button {
    background: #FFFFFF !important;
    color: var(--text-primary) !important;
    border: none !important;
    border-bottom: 1px solid #E9ECEF !important;
    width: 36px !important;
    height: 36px !important;
    transition: all 0.2s;
}

.maplibregl-ctrl-group button:last-child {
    border-bottom: none !important;
}

.maplibregl-ctrl-group button:hover {
    background: #F1F3F5 !important;
}

/* ── MapLibre Attribution ─────────────────────────────────── */
.maplibregl-ctrl-attrib {
    background: rgba(255, 255, 255, 0.85) !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
}

.maplibregl-ctrl-attrib a {
    color: var(--text-muted) !important;
}

/* ── MapLibre Marker Base ─────────────────────────────────── */
.maplibregl-marker {
    cursor: pointer;
}

/* --- Popup Content Styles --- */
.popup-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 4px;
}

.popup-cat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popup-cat-icon img {
    width: 17px;
    height: 17px;
}

.popup-header-text {
    flex: 1;
    min-width: 0;
}

.popup-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 1px;
}

.popup-name-am {
    font-size: 12px;
    color: var(--accent);
    font-family: 'Noto Sans Ethiopic', sans-serif;
    line-height: 1.3;
}

.popup-desc {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 6px;
}

.popup-divider {
    height: 1px;
    background: var(--bg-3);
    margin: 10px 0 8px;
}

.popup-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.popup-badge.lrt {
    background: rgba(30, 144, 255, 0.2);
    color: var(--lrt-blue);
}

.popup-badge.anbessa {
    background: rgba(255, 107, 53, 0.2);
    color: var(--anbessa);
}

.popup-badge.minibus {
    background: rgba(255, 204, 0, 0.2);
    color: var(--minibus);
}

.popup-badge.live {
    background: rgba(32, 185, 84, 0.2);
    color: var(--success);
}

.popup-actions {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.popup-btn {
    flex: 1;
    min-width: 0;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--bg-3);
    background: var(--bg-2);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-btn:hover {
    background: var(--bg-3);
}

.popup-btn:active {
    transform: scale(0.96);
}

.popup-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.popup-btn.primary:hover {
    background: var(--accent-dim);
    border-color: var(--accent-dim);
}

.popup-btn-save {
    flex: 0 0 32px !important;
    min-width: 32px !important;
    font-size: 14px;
    border-radius: 8px;
}

.popup-btn-save.saved {
    color: #E03131;
    border-color: rgba(224, 49, 49, 0.25);
    background: rgba(224, 49, 49, 0.08);
}

/* --- Live Vehicle Marker Pulse --- */
@keyframes vehicle-pulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.5);
        opacity: 0;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.vehicle-pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border-radius: 50%;
    border: 2px solid var(--success);
    animation: vehicle-pulse 1.4s ease-out infinite;
    pointer-events: none;
}

/* --- LRT Station Icon --- */
.lrt-station-marker {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--lrt-blue);
}

.lrt-station-marker.line2 {
    background: var(--lrt-green);
}

/* --- Locate Me Button --- */
#btn-locate {
    position: fixed;
    bottom: 160px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #FFFFFF !important;
    border: 1px solid #DEE2E6;
    color: #495057;
    cursor: pointer;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s var(--ease);
}

#btn-locate svg {
    width: 22px;
    height: 22px;
    display: block;
    stroke: #495057;
}

#btn-locate:hover {
    transform: scale(1.1);
    background: #F1F3F5 !important;
}

#btn-locate:hover svg {
    stroke: var(--accent) !important;
}

#btn-locate:hover svg circle {
    fill: var(--accent) !important;
}

/* ============================================================
   Drop Box Node Tooltips (Phase D)
   ============================================================ */

.dropbox-tooltip {
    background: #FFFFFF !important;
    color: #1A1A1A !important;
    border: 1px solid #DEE2E6 !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    font-family: 'Inter', system-ui, sans-serif !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    white-space: pre-line !important;
    line-height: 1.4 !important;
}

.dropbox-tooltip::before {
    border-top-color: #FFFFFF !important;
}

.board-tooltip {
    border-left: 2px solid #40C057 !important;
}

.alight-tooltip {
    border-left: 2px solid #F59F00 !important;
}