/* ═══════════════════════════════════════════════════════════════
   MAP STYLES — Leaflet container, markers, clusters
   ═══════════════════════════════════════════════════════════════ */

/* Reittiviivat näkyviin markereiden päälle */
.leaflet-overlay-pane svg path[stroke="#4a9eff"],
.leaflet-overlay-pane svg path[stroke="#ff6b6b"] {
    z-index: 500 !important;
}

.map-container {
    flex: 1;
    position: relative;
    z-index: var(--z-map);
    background: var(--bg-primary);
}

/* ─── Leaflet overrides ─── */
.leaflet-container {
    background: var(--bg-primary) !important;
    font-family: var(--font-body) !important;
}

/* CSS filter removed from .leaflet-tile-pane — it created a new stacking
   context that broke Leaflet's coordinate calculations and caused markers
   to drift relative to tiles during zoom/pan. If darkening is needed,
   apply it to the tile layer's CSS filter via JS on individual tiles instead. */

/* ─── Custom Markers ─── */
/* IMPORTANT: .marker-container is the ROOT element that Leaflet positions
   via transform: translate3d(). We must NEVER apply transform, transition,
   or will-change to this element — doing so overwrites Leaflet's positioning
   and causes markers to drift. */
.marker-container {
    background: transparent !important;
    border: none !important;
}

/* All visual styles go on the inner wrapper */
.marker-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    cursor: pointer;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    font-size: 16px;
    position: relative;
}

.marker-inner:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.6), 0 0 12px rgba(201,162,39,0.3);
}

.marker-inner.active {
    box-shadow: 0 4px 20px rgba(0,0,0,0.7), 0 0 20px rgba(201,162,39,0.5);
    border-color: var(--color-gold-400);
}

/* Marker colors by category */
.marker-inner.marker-overnight {
    background: linear-gradient(135deg, var(--color-green-700), var(--color-green-900));
    border-color: var(--color-green-500);
}

.marker-inner.marker-attraction {
    background: linear-gradient(135deg, var(--color-gold-500), #8a6d1a);
    border-color: var(--color-gold-300);
}

.marker-inner.marker-fuel {
    background: linear-gradient(135deg, #c94f4f, #8a2f2f);
    border-color: #e07070;
}

/* ─── Price badge on marker ─── */
.marker-price {
    position: absolute;
    bottom: -8px;
    right: -8px;
    background: var(--color-gold-500);
    color: var(--color-brown-950);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 8px;
    border: 1px solid var(--color-brown-900);
    white-space: nowrap;
}

/* ─── Rating badge on marker ─── */
.marker-rating {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--color-green-600);
    color: white;
    font-size: 8px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
}

/* ─── Cluster ─── */
.marker-cluster {
    background: var(--color-brown-800);
    border: 2px solid var(--color-gold-500);
    border-radius: 50%;
    color: var(--color-gold-400);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.marker-cluster-small {
    width: 40px;
    height: 40px;
}

.marker-cluster-medium {
    width: 50px;
    height: 50px;
    font-size: 15px;
}

.marker-cluster-large {
    width: 60px;
    height: 60px;
    font-size: 17px;
}

/* ─── User location marker ─── */
.user-location-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a9eff;
    border: 3px solid white;
    box-shadow: 0 0 0 3px rgba(74,158,255,0.3), 0 2px 8px rgba(0,0,0,0.4);
    animation: pulse-location 2s ease-in-out infinite;
}

@keyframes pulse-location {
    0%, 100% { box-shadow: 0 0 0 3px rgba(74,158,255,0.3), 0 2px 8px rgba(0,0,0,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(74,158,255,0.1), 0 2px 8px rgba(0,0,0,0.4); }
}

/* ─── Route line ─── */
.route-polyline {
    stroke: var(--color-gold-500);
    stroke-width: 3;
    stroke-dasharray: 8, 6;
    opacity: 0.6;
}

/* ─── Map controls ─── */
.leaflet-control-zoom {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
    background: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    transition: all var(--transition-fast) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--color-brown-600) !important;
    color: var(--color-gold-400) !important;
}

.leaflet-control-attribution {
    background: rgba(13,9,6,0.8) !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
    padding: 2px 8px !important;
}

.leaflet-control-attribution a {
    color: var(--color-gold-500) !important;
}
