/* ============================================================
   valo-maps-ar.css  →  /om/css/valo-maps-ar.css
   خريطة شركاء فالو — نفس خط الموقع (ThamanyahSans)
   ============================================================ */

@font-face {
    font-family: 'ThamanyahSans';
    src: url('ThamanyahSans-Medium.woff2') format('woff2'),
         url('ThamanyahSans-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

html, body, * {
    font-family: 'ThamanyahSans', 'Cairo', sans-serif !important;
}

/* English pages: Latin-first font stack */
html[dir="ltr"] body,
html[dir="ltr"] body * {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif !important;
}

html[dir="ltr"] { font-size: 15px; }
html[dir="ltr"] body { font-size-adjust: 0.47; }
html[dir="ltr"] input,
html[dir="ltr"] textarea,
html[dir="ltr"] select,
html[dir="ltr"] button { font-size-adjust: 0.47; }

:root {
    --vm-red: #AD1F24;
    --vm-ink: #1A1A1A;
    --vm-ink-2: #5C5C5C;
    --vm-surface: #FFFFFF;
    --vm-line: rgba(20, 20, 20, .09);
    --vm-shadow: 0 18px 46px -22px rgba(16, 16, 16, .38);
    --vm-glass: rgba(255, 255, 255, .82);
    --vm-panel-w: 306px;
}

html.dark {
    --vm-ink: #F4F2EF;
    --vm-ink-2: #A8A49E;
    --vm-surface: #14171C;
    --vm-line: rgba(255, 255, 255, .10);
    --vm-shadow: 0 20px 50px -24px rgba(0, 0, 0, .9);
    --vm-glass: rgba(18, 21, 26, .78);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--vm-surface);
    color: var(--vm-ink);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

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

html.dark #vm-map { background: #0C0F14; }

/* subtle vignette so the panel never floats over a busy edge */
#vm-map::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .10), transparent 26%);
    opacity: .5;
}

/* ============================================================
   PANEL
   ============================================================ */
.vm-panel {
    position: fixed;
    z-index: 20;
    top: max(16px, env(safe-area-inset-top));
    inset-inline-start: max(16px, env(safe-area-inset-left));
    width: var(--vm-panel-w);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: 22px;
    background: var(--vm-glass);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    backdrop-filter: blur(18px) saturate(1.3);
    border: 1px solid var(--vm-line);
    box-shadow: var(--vm-shadow);
    animation: vm-panel-in .5s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes vm-panel-in {
    from { opacity: 0; transform: translateY(-10px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

/* ---------- header row ---------- */
.vm-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vm-back {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--vm-ink);
    background: var(--vm-surface);
    border: 1px solid var(--vm-line);
    text-decoration: none;
    transition: transform .18s ease, background .18s ease;
}

.vm-back:hover { transform: translateX(2px); background: var(--vm-red); color: #fff; border-color: transparent; }
html.dark .vm-back { background: rgba(255, 255, 255, .06); }
html.dark .vm-back:hover { background: var(--vm-red); }
html[dir="ltr"] .vm-back:hover { transform: translateX(-2px); }

.vm-title { flex: 1 1 auto; min-width: 0; }

.vm-title h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.2px;
    line-height: 1.25;
    color: var(--vm-ink);
}

.vm-title p {
    margin: 1px 0 0;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--vm-ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vm-cta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, #C2262C, var(--vm-red));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 10px 20px -12px var(--vm-red);
    transition: transform .18s ease, box-shadow .18s ease;
}

.vm-cta:hover { transform: translateY(-1px); box-shadow: 0 14px 24px -12px var(--vm-red); }
.vm-cta:active { transform: translateY(0) scale(.98); }

/* Theme toggle (light/dark map style) */
.vm-theme {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    color: var(--vm-ink);
    background: var(--vm-surface);
    border: 1px solid var(--vm-line);
    cursor: pointer;
    transition: transform .18s ease, background .18s ease;
}
.vm-theme:hover { transform: translateY(-1px); background: var(--vm-red); color: #fff; border-color: transparent; }
.vm-theme:active { transform: scale(.97); }
.vm-theme:focus-visible { outline: 2px solid var(--vm-red); outline-offset: 2px; }
html.dark .vm-theme { background: rgba(255, 255, 255, .06); }
html.dark .vm-theme:hover { background: var(--vm-red); }
.vm-theme span { display: inline-flex; }
.vm-theme svg { width: 17px; height: 17px; }

/* ---------- country tabs ---------- */
.vm-countries {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.vm-country {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 14px;
    background: var(--vm-surface);
    border: 1.5px solid var(--vm-line);
    color: var(--vm-ink);
    font: 800 12px/1.2 inherit;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.vm-country:hover { transform: translateY(-1px); border-color: rgba(173, 31, 36, .35); }

.vm-country[aria-selected="true"] {
    border-color: var(--vm-red);
    background: linear-gradient(135deg, rgba(173, 31, 36, .10), rgba(173, 31, 36, .02));
    box-shadow: 0 10px 20px -16px var(--vm-red);
}

html.dark .vm-country { background: rgba(255, 255, 255, .045); }
html.dark .vm-country[aria-selected="true"] { background: rgba(173, 31, 36, .16); }

.vm-flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .10);
    flex: 0 0 auto;
}

.vm-country-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11.5px;
    line-height: 1.25;
    text-align: start;
    color: var(--vm-ink);
    /* اسم الدولة يظهر كاملًا — بدون قص أو نقاط */
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
}

.vm-country-count {
    flex: 0 0 auto;
    min-width: 24px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(20, 20, 20, .07);
    color: var(--vm-ink-2);
    font-size: 10.5px;
    font-weight: 800;
    text-align: center;
    transition: background .2s ease, color .2s ease;
}

html.dark .vm-country-count { background: rgba(255, 255, 255, .09); }

.vm-country[aria-selected="true"] .vm-country-count {
    background: var(--vm-red);
    color: #fff;
}

/* ---------- legend ---------- */
.vm-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    padding-top: 10px;
    border-top: 1px solid var(--vm-line);
}

.vm-lg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--vm-ink-2);
}

.vm-lg i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent);
    flex: 0 0 auto;
}

.vm-lg b {
    font-size: 11px;
    font-weight: 800;
    color: var(--vm-ink);
    background: rgba(20, 20, 20, .06);
    border-radius: 999px;
    padding: 1px 6px;
    min-width: 20px;
    text-align: center;
}

html.dark .vm-lg b { background: rgba(255, 255, 255, .08); }

/* ============================================================
   MARKERS — inn/bay يفتح التفاصيل، pass يعرض «قريباً»
   ============================================================ */
.vm-pin {
    position: absolute;
    top: 0;
    left: 0;
    width: 28px;
    height: 28px;
    pointer-events: auto;
    cursor: pointer;
    outline: none;
}

.vm-pin:focus-visible .vm-dot {
    box-shadow: 0 0 0 4px rgba(173, 31, 36, .32);
}

.vm-pin.is-active { z-index: 6; }

.vm-dot {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: var(--c);
    border: 2.5px solid #fff;
    box-shadow: 0 3px 10px -2px rgba(0, 0, 0, .45), 0 0 0 0 color-mix(in srgb, var(--c) 45%, transparent);
    transition: inset .18s ease, box-shadow .18s ease;
    /* التوقيع الحركي الوحيد: هبوط متتابع عند التحميل */
    animation: vm-drop .45s cubic-bezier(.2, .9, .25, 1.2) both;
    animation-delay: var(--d, 0s);
}

.vm-pin.is-active .vm-dot {
    inset: 2px;
    box-shadow: 0 6px 16px -4px rgba(0, 0, 0, .5), 0 0 0 5px color-mix(in srgb, var(--c) 26%, transparent);
}

.vm-pin:hover .vm-dot {
    box-shadow: 0 5px 14px -3px rgba(0, 0, 0, .48), 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent);
}

html.dark .vm-dot { border-color: #10131A; }

@keyframes vm-drop {
    from { opacity: 0; transform: translateY(-14px) scale(.4); }
    70%  { opacity: 1; }
    to   { opacity: 1; transform: none; }
}

/* نبضة واحدة عند تغيير الدولة */
.vm-pin.vm-ping .vm-dot::after {
    content: '';
    position: absolute;
    inset: -2.5px;
    border-radius: 50%;
    border: 2px solid var(--c);
    animation: vm-ping .8s ease-out forwards;
}

@keyframes vm-ping {
    from { opacity: .85; transform: scale(1); }
    to   { opacity: 0; transform: scale(3.4); }
}

/* ============================================================
   LOADING
   ============================================================ */
.vm-loading {
    position: fixed;
    z-index: 30;
    inset-inline-end: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--vm-glass);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid var(--vm-line);
    box-shadow: var(--vm-shadow);
    font-size: 12px;
    font-weight: 700;
    color: var(--vm-ink-2);
    transition: opacity .28s ease, transform .28s ease;
}

.vm-loading[hidden] { display: none; }
.vm-loading.vm-out { opacity: 0; transform: translateY(8px); pointer-events: none; }

.vm-loading.vm-error { color: #B3231F; border-color: rgba(179, 35, 31, .25); }

.vm-spinner {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid rgba(128, 128, 128, .28);
    border-top-color: var(--vm-red);
    animation: vm-spin .7s linear infinite;
    flex: 0 0 auto;
}

.vm-loading.vm-error .vm-spinner { animation: none; border-color: currentColor; border-top-color: transparent; }

@keyframes vm-spin { to { transform: rotate(360deg); } }

/* ============================================================
   MAP CONTROLS
   ============================================================ */
.maplibregl-ctrl-group {
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: var(--vm-shadow) !important;
    border: 1px solid var(--vm-line);
}

html.dark .maplibregl-ctrl-group { background: #14171C; }
html.dark .maplibregl-ctrl-group button + button { border-color: rgba(255, 255, 255, .08); }
html.dark .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg); }

.maplibregl-ctrl-attrib {
    font-family: inherit;
    font-size: 10px;
    border-radius: 8px;
}

/* ============================================================
   RESPONSIVE — موبايل: اللوحة تصير شريط سفلي
   ============================================================ */
@media (max-width: 640px) {
    :root { --vm-panel-w: auto; }

    .vm-panel {
        inset-inline: 12px;
        top: auto;
        bottom: max(12px, env(safe-area-inset-bottom));
        width: auto;
        padding: 12px;
        gap: 10px;
        border-radius: 20px;
    }

    .vm-title p { font-size: 11px; }
    .vm-title h1 { font-size: 15px; }

    .vm-cta { height: 34px; padding: 0 12px; font-size: 11.5px; }
    .vm-cta svg { width: 14px; height: 14px; }

    .vm-back { width: 34px; height: 34px; }
    .vm-theme { width: 34px; height: 34px; }
    .vm-theme svg { width: 16px; height: 16px; }

    .vm-country { padding: 7px 9px; font-size: 11.5px; }
    .vm-flag { width: 19px; height: 14px; }

    .vm-legend { padding-top: 8px; gap: 4px 10px; }
    .vm-lg { font-size: 11px; }

    .vm-loading {
        inset-inline: auto;
        inset-inline-end: auto;
        left: 50%;
        transform: translateX(-50%);
        bottom: auto;
        top: max(12px, env(safe-area-inset-top));
        padding: 9px 15px;
        font-size: 11.5px;
    }

    .vm-loading.vm-out { transform: translate(-50%, -8px); }

    .maplibregl-ctrl-top-right,
    .maplibregl-ctrl-top-left { top: 84px; }
}

@media (max-width: 380px) {
    .vm-country-name { font-size: 11px; }
    .vm-lg b { display: none; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .vm-panel,
    .vm-dot,
    .vm-spinner { animation: none !important; }
    .vm-dot { opacity: 1 !important; transform: none !important; }
    .vm-pin.vm-ping .vm-dot::after { animation: none; content: none; }
    * { transition-duration: .01ms !important; }
}

/* ============================================================
   «قريباً» — نافذة نوع pass
   ============================================================ */
.vm-pop .maplibregl-popup-content {
    padding: 14px 16px 15px;
    border-radius: 16px;
    background: var(--vm-surface);
    color: var(--vm-ink);
    border: 1px solid var(--vm-line);
    box-shadow: var(--vm-shadow);
    font-family: inherit;
}

.vm-pop .maplibregl-popup-tip { display: none; }

.vm-pop .maplibregl-popup-close-button {
    width: 26px;
    height: 26px;
    top: 4px;
    inset-inline-end: 4px;
    font-size: 18px;
    line-height: 24px;
    border-radius: 50%;
    color: var(--vm-ink-2);
}

.vm-pop .maplibregl-popup-close-button:hover { background: rgba(128, 128, 128, .12); color: var(--vm-ink); }

.vm-soon { padding-inline-end: 16px; }

.vm-soon-badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    margin-bottom: 6px;
    border-radius: 999px;
    background: rgba(93, 76, 154, .14);
    color: #5d4c9a;
    font-size: 10.5px;
    font-weight: 800;
}

html.dark .vm-soon-badge { background: rgba(93, 76, 154, .30); color: #BCAFEA; }

.vm-soon strong {
    display: block;
    font-size: 14px;
    font-weight: 800;
    color: var(--vm-ink);
}

.vm-soon p {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--vm-ink-2);
}
