/* ══════════════════════════════════════════════════════════════
   INTERACTIVE ALGERIA MAP
   Full-width SVG map; info panel overlays the bottom corner.
   On mobile the info panel drops to static flow below the SVG.
   ══════════════════════════════════════════════════════════════ */

.map-section-grid {
    position: relative;
}

/* ── SVG panel : full-width host ─────────────────────────────── */
.map-svg-panel {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--c-border-subtle);
    border-radius: 1.5rem;
    box-shadow: 0 1px 4px rgba(22,92,48,0.04), 0 4px 14px rgba(22,92,48,0.04);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 540px;
}

.map-svg-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(30,122,64,0.07) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: 0.5;
    pointer-events: none;
}

.map-svg-panel.is-grabbing .algeria-map-svg {
    cursor: grabbing;
}

/* ── Fullscreen state ────────────────────────────────────────── */
.map-svg-panel.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    border-radius: 0;
    min-height: 0;
    padding: 1rem;
    height: 100dvh;
}

.map-svg-panel.is-fullscreen .algeria-map-svg {
    max-height: calc(100dvh - 2rem);
}

body.map-is-fullscreen {
    overflow: hidden;
}

/* ── Overlay info panel (absolute inside SVG panel) ──────────── */
.map-info-panel {
    position: absolute;
    z-index: 10;
    inset-inline-start: 1.25rem;
    inset-block-end: 1.25rem;
    width: 18.5rem;
    max-height: calc(100% - 2.5rem);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
}

/* ── Mobile : stack below the SVG ───────────────────────────── */
@media (max-width: 767px) {
    .map-svg-panel {
        min-height: 0;
        padding: 0.75rem;
        padding-bottom: 0;
        border-radius: 1rem 1rem 0 0;
        overflow: visible;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }

    .algeria-map-svg {
        max-height: 320px !important;
    }

    .map-info-panel {
        position: static;
        width: 100%;
        max-height: none;
        inset: auto;
        padding: 0.75rem;
        padding-top: 0.5rem;
        background: #ffffff;
        border: 1px solid var(--c-border-subtle);
        border-top: none;
        border-radius: 0 0 1rem 1rem;
    }
}

/* ── Info card ───────────────────────────────────────────────── */
.map-info-card {
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--c-border-subtle);
    border-radius: 1.25rem;
    box-shadow: 0 4px 24px rgba(22,92,48,0.13);
    padding: 1.25rem;
    transition: box-shadow 0.3s ease, border-color 0.2s ease;
}

.map-info-card-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-green-light);
    color: var(--c-green-mid);
    flex-shrink: 0;
}

.map-info-card-title {
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--c-text-dark);
}

.map-info-card-subtitle {
    font-family: 'Tajawal', sans-serif;
    font-size: 0.8rem;
    color: var(--c-text-soft);
}

.map-info-card-body {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--c-border-subtle);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.875rem;
    color: var(--c-text-medium);
    line-height: 1.8;
}

.map-info-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
}
.map-info-row:last-child { margin-bottom: 0; }

.map-info-row svg {
    width: 1rem;
    height: 1rem;
    color: var(--c-green-soft);
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.map-info-row a {
    color: var(--c-green-mid);
    text-decoration: none;
    font-weight: 600;
}
.map-info-row a:hover { text-decoration: underline; }

.map-info-card-empty {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--c-text-soft);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.85rem;
}

/* ── Branch pill list ────────────────────────────────────────── */
.map-pill-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 13rem;
    overflow-y: auto;
    padding-inline-end: 0.35rem;
}

.map-pill-list::-webkit-scrollbar { width: 5px; }
.map-pill-list::-webkit-scrollbar-track { background: transparent; }
.map-pill-list::-webkit-scrollbar-thumb {
    background: var(--c-green-light);
    border-radius: 9999px;
}

.map-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    text-align: start;
    padding: 0.6rem 0.85rem;
    border-radius: 0.9rem;
    border: 1px solid var(--c-border-subtle);
    border-left-width: 3px;
    border-left-color: var(--pill-accent, var(--c-border-subtle));
    background: rgba(255,255,255,0.9);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Tajawal', sans-serif;
}

.map-pill:hover {
    border-color: var(--c-green-soft);
    background: var(--c-green-pale);
    transform: translateX(-2px);
}

.map-pill.is-active {
    border-color: var(--c-green-mid);
    background: var(--c-green-light);
    box-shadow: 0 4px 14px rgba(22,92,48,0.1);
}

.map-pill-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: var(--c-green-soft);
    flex-shrink: 0;
}

.map-pill.is-active .map-pill-dot {
    background: var(--c-gold);
    box-shadow: 0 0 0 4px rgba(176,125,28,0.15);
}

.map-pill-name {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--c-text-dark);
}

.map-pill-meta {
    font-size: 0.74rem;
    color: var(--c-text-soft);
}

.map-pill-star {
    margin-inline-start: auto;
    color: var(--c-gold);
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* ── SVG map ─────────────────────────────────────────────────── */
.algeria-map-svg {
    position: relative;
    width: 100%;
    height: auto;
    max-height: 620px;
    touch-action: none;
    cursor: grab;
}

/* ── Interaction hint ────────────────────────────────────────── */
.map-hint {
    position: absolute;
    z-index: 12;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 1.15rem;
    background: rgba(13, 56, 29, 0.87);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 9999px;
    color: #ffffff;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.83rem;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.5s ease, transform 0.5s ease;
    animation: hint-glow 3s ease-in-out 1.2s infinite;
}

.map-hint svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    animation: hint-tap 1.8s ease-in-out 0.5s infinite;
}

.map-hint.is-dismissed {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) scale(0.85);
}

@keyframes hint-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(13,56,29,0.45); }
    55%       { box-shadow: 0 0 0 9px rgba(13,56,29,0); }
}

@keyframes hint-tap {
    0%, 100% { transform: scale(1) rotate(0deg); }
    35%      { transform: scale(0.78) rotate(-8deg); }
    65%      { transform: scale(1.12) rotate(4deg); }
}

@media (prefers-reduced-motion: reduce) {
    .map-hint     { animation: none; }
    .map-hint svg { animation: none; }
}

/* ── Zoom / pan controls ─────────────────────────────────────── */
.map-zoom-controls {
    position: absolute;
    z-index: 15;
    inset-inline-start: 1.5rem;
    inset-block-start: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: rgba(255,255,255,0.92);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid var(--c-border-subtle);
    border-radius: 0.9rem;
    padding: 0.35rem;
    box-shadow: 0 6px 20px rgba(22,92,48,0.1);
    overflow: hidden;
}

.map-zoom-btn {
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--c-green-mid);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.map-zoom-btn svg {
    width: 1.1rem;
    height: 1.1rem;
}

.map-zoom-btn:hover {
    background: var(--c-green-light);
    border-color: var(--c-green-soft);
}

.map-zoom-btn:active {
    transform: scale(0.9);
}

.map-zoom-btn:focus-visible {
    outline: 2px solid var(--c-green-mid);
    outline-offset: 1px;
}

.map-zoom-controls > .map-zoom-btn:not(:last-child) {
    border-bottom: 1px dashed var(--c-border-subtle);
    border-radius: 0.5rem 0.5rem 0 0;
}
.map-zoom-controls > .map-zoom-btn:last-child {
    border-radius: 0 0 0.5rem 0.5rem;
}
.map-zoom-controls > .map-zoom-btn:not(:first-child):not(:last-child) {
    border-radius: 0;
}

/* ── Wilaya shapes ───────────────────────────────────────────── */
.algeria-map-svg {
    --map-shade-1: var(--c-green-mid);
    --map-shade-2: color-mix(in srgb, var(--c-green-mid) 68%, #ffffff 32%);
}

.wilaya {
    stroke: #ffffff;
    stroke-width: 1.6;
    cursor: pointer;
    transform-box: fill-box;
    transform-origin: center;
    transition: fill 220ms cubic-bezier(.22,1,.36,1), filter 220ms cubic-bezier(.22,1,.36,1),
                transform 220ms cubic-bezier(.22,1,.36,1), stroke 180ms ease;
    outline: none;
}

.wilaya--primary   { fill: var(--map-shade-1); }
.wilaya--secondary { fill: var(--map-shade-2); }

.wilaya:hover,
.wilaya:focus-visible {
    filter: brightness(1.1) drop-shadow(0 8px 16px rgba(22, 92, 48, 0.32));
    transform: scale(1.02);
}

.wilaya:focus-visible {
    stroke: var(--c-gold);
    stroke-width: 2.4;
}

.wilaya.is-selected {
    fill: var(--c-green-dark);
    filter: brightness(1.06) drop-shadow(0 0 0 2.5px rgba(255,255,255,0.55)) drop-shadow(0 10px 22px rgba(176, 125, 28, 0.38));
}

/* ── Commune mosaic ──────────────────────────────────────────── */
.communes-group .commune {
    --daira-tone: calc(28 + var(--daira-hue, 252) * 0.42);
    fill: hsl(var(--daira-tone) 48% 52% / 0.4);
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 0.9;
    cursor: pointer;
    transition: fill 200ms cubic-bezier(.22,1,.36,1), filter 200ms cubic-bezier(.22,1,.36,1),
                stroke 180ms ease, stroke-width 180ms ease;
    outline: none;
}

.communes-group .commune:hover,
.communes-group .commune:focus-visible {
    fill: hsl(var(--daira-tone) 56% 58% / 0.72);
    stroke: #ffffff;
    stroke-width: 1.6;
    filter: brightness(1.08) drop-shadow(0 4px 10px rgba(13, 56, 29, 0.3));
}

.communes-group .commune:focus-visible {
    stroke: var(--c-gold);
    stroke-width: 2;
}

.communes-group .commune.is-selected {
    fill: hsl(var(--daira-tone) 62% 54% / 0.88);
    stroke: var(--c-gold-light);
    stroke-width: 2;
}

.communes-group .commune--office {
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 1.3;
    stroke-dasharray: 3 2;
}

.communes-group .commune--office:hover,
.communes-group .commune--office:focus-visible,
.communes-group .commune--office.is-selected {
    stroke-dasharray: none;
}

/* ── Wilaya labels ───────────────────────────────────────────── */
.wilaya-label {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 27px;
    fill: #ffffff;
    text-anchor: middle;
    text-shadow: 0 2px 6px rgba(13, 56, 29, 0.55), 0 1px 1px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

.wilaya-sublabel {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 13px;
    fill: rgba(255,255,255,0.88);
    text-anchor: middle;
    text-shadow: 0 1px 4px rgba(13, 56, 29, 0.5);
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ── Branch markers ──────────────────────────────────────────── */
.branch-marker-anchor {
    cursor: pointer;
    outline: none;
}

.branch-marker {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 200ms cubic-bezier(.22,1,.36,1);
}

.branch-marker-anchor:hover .branch-marker,
.branch-marker-anchor:focus-visible .branch-marker,
.branch-marker-anchor.is-active .branch-marker {
    transform: scale(1.18);
}

.branch-marker-ping {
    fill: none;
    stroke: var(--c-green-mid);
    stroke-width: 2;
    opacity: 0.5;
    transform-box: fill-box;
    transform-origin: center;
    animation: branch-marker-pulse 2.4s ease-out infinite;
}

.branch-marker-pin {
    fill: var(--c-green-mid);
    stroke: #ffffff;
    stroke-width: 1.6;
    transition: fill 180ms ease;
}

.branch-marker-anchor.is-main .branch-marker-pin {
    fill: var(--c-red-accent);
    stroke: var(--c-gold-light);
}

.branch-marker-anchor.is-main .branch-marker-ping {
    stroke: var(--c-gold);
}

.branch-marker-dot {
    fill: #ffffff;
}

@keyframes branch-marker-pulse {
    0%   { transform: scale(0.5); opacity: 0.5; }
    70%  { transform: scale(2.6); opacity: 0; }
    100% { transform: scale(2.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .branch-marker-ping { animation: none; opacity: 0; }
}

/* ── Floating tooltip ────────────────────────────────────────── */
.map-marker-tooltip {
    position: absolute;
    z-index: 20;
    pointer-events: none;
    left: 0;
    top: 0;
    min-width: 9rem;
    text-align: center;
    background: #ffffff;
    border: 1px solid var(--c-border-subtle);
    border-radius: 0.75rem;
    box-shadow: 0 10px 28px rgba(22, 92, 48, 0.18);
    padding: 0.55rem 0.9rem;
    opacity: 0;
    transform: translate(-50%, calc(-100% - 16px)) scale(0.92);
    transition: opacity 180ms ease, transform 180ms ease;
}

.map-marker-tooltip.is-visible {
    opacity: 1;
    transform: translate(-50%, calc(-100% - 16px)) scale(1);
}

.map-marker-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #ffffff;
}

.map-marker-tooltip-name {
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--c-text-dark);
    white-space: nowrap;
}

.map-marker-tooltip-meta {
    font-family: 'Tajawal', sans-serif;
    font-size: 0.72rem;
    color: var(--c-text-soft);
    margin-top: 0.15rem;
    white-space: nowrap;
}
