/* =========================
   Branches Section (Maps + Text Side-by-Side)
   - Two-column layout: MAP | TEXT (LTR) — auto flips in RTL
   - Decorative background
   - Responsive + accessible
   ========================= */


/* ---- Theme tokens ---- */

:root {
    --navy: #060606;
    --ink: #020202;
    --muted: #060606;
    --accent: #ffb367;
    --paper: #ffffff;
    --card: #554646;
    --line: #000000;
}


/* ---- Section wrapper ---- */

.branches-section {
    position: relative;
    isolation: isolate;
    background: #ffffff;
    padding: clamp(56px, 7vw, 92px) 0;
    color: var(--ink);
    overflow: hidden;
}

.br-bg-decor {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(1200px 600px at 10% -10%, rgba(10, 10, 10, 0.22), transparent 60%), radial-gradient(900px 500px at 90% 110%, rgba(5, 16, 58, .08), transparent 60%), linear-gradient(180deg, #fafcff, #f7f8fb);
}

.br-bg-decor::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .35;
    background-image: linear-gradient(to right, rgba(13, 27, 42, .06) 1px, transparent 1px), linear-gradient(to bottom, rgba(13, 27, 42, .06) 1px, transparent 1px);
    background-size: 22px 22px;
}


/* ---- Container & Title ---- */

.br-container {
    width: min(1200px, 92%);
    margin-inline: auto;
}

.br-title {
    text-align: center;
    color: var(--navy);
    font-weight: 900;
    font-size: clamp(24px, 3.2vw, 40px);
    margin: 0 0 clamp(20px, 3vw, 32px);
}


/* ---- Grid of cards ---- */

.br-grid {
    display: grid;
    gap: clamp(16px, 2.4vw, 28px);
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 980px) {
    .br-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================
   Card as GRID:
   "head head"
   "map  text"
   (Buttons float over the map area)
   ========================= */

.br-card {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    grid-template-areas: "head head" "map  text";
    gap: 14px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .06);
    padding: 12px;
    min-height: 360px;
}

[dir="rtl"] .br-card {
    grid-template-columns: .85fr 1.15fr;
    grid-template-areas: "head head" "text map";
}


/* Header */

.br-head {
    grid-area: head;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 2px 6px;
    color: var(--ink);
}

.br-pin {
    color: var(--accent);
    display: inline-flex;
}

.br-name {
    margin: 0;
    font-size: clamp(16px, 2vw, 20px);
    font-weight: 900;
}


/* Text (address + contacts) */

.br-body {
    grid-area: text;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .04);
}

.br-address {
    margin: 4px 0 12px;
    line-height: 1.75;
    color: #243447;
    font-size: clamp(13px, 1.6vw, 15px);
}

.br-contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    margin-top: auto;
}

.br-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #554646;
    border: 1px solid var(--line);
    transition: background .2s, transform .2s, border-color .2s;
}

.br-link:hover {
    background: #554646;
    border-color: var(--accent);
    transform: translateY(-1px);
}


/* ---- Map panel occupies the map cell ---- */

.br-foot {
    display: contents;
}


/* يسمح لأطفالها بأن يصبحوا عناصر Grid مباشرة */

.br-map-panel {
    grid-area: map;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .06) inset, 0 12px 24px rgba(0, 0, 0, .08);
    background: #fff;
    min-height: 320px;
}

.br-map-panel[hidden] {
    display: none !important;
}


/* يظل مطويًا إن وُجدت السمة */


/* Map iframe styling */

.br-map-panel iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 320px;
    border: 0;
    background: #fff;
    aspect-ratio: 16 / 9;
    /* يحافظ على نسبة العرض */
}


/* ---- Map actions overlay (Toggle + Open in Tab) ---- */

.br-map-actions {
    grid-area: map;
    /* نفس خلية الخريطة */
    align-self: start;
    justify-self: end;
    z-index: 2;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px;
}

.br-map-btn,
.br-map-toggle {
    appearance: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
    transition: transform .2s, background .2s, border-color .2s, box-shadow .2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .14);
}

.br-map-toggle {
    background: #ffffff;
    color: var(--navy);
    border: 2px solid var(--line);
}

.br-map-toggle:hover {
    border-color: var(--accent);
    background: #fbf5ee;
    transform: translateY(-1px);
}

.br-map-btn {
    background: var(--accent);
    color: var(--navy);
    border: 2px solid var(--accent);
}

.br-map-btn:hover {
    background: #ffa94d;
    transform: translateY(-1px);
}


/* ---- Empty state ---- */

.br-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #040404;
    background: #f9fafc;
    border: 1px dashed #d6dbe3;
    border-radius: 12px;
    padding: 18px;
}


/* ---- Reveal animation for cards ---- */

.reveal-up {
    opacity: 0;
    transform: translateY(18px);
}

.reveal-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .6s ease, transform .6s ease;
}


/* ---- Responsive tweaks ---- */

@media (max-width: 980px) {
    .br-card {
        grid-template-columns: 1fr;
        grid-template-areas: "head" "map" "text";
    }
    [dir="rtl"] .br-card {
        grid-template-columns: 1fr;
        grid-template-areas: "head" "map" "text";
    }
    .br-map-actions {
        justify-self: end;
    }
}


/* ---- Small polish ---- */

[dir="rtl"] .br-contacts {
    justify-content: flex-start;
}

[dir="rtl"] .br-body {
    text-align: right;
}


/* إخفاء أي بقايا للأسلوب القديم الخاص بالأزرار إن وُجد */

.br-map-actions {
    display: none !important;
}


/* تأكيد أن البطاقة تبقى بنمط عمودين: خريطة | نص (وتنعكس تلقائياً في RTL) */

.br-card {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    grid-template-areas: "head head" "map  text";
    gap: 14px 16px;
}

[dir="rtl"] .br-card {
    grid-template-columns: .85fr 1.15fr;
    grid-template-areas: "head head" "text map";
}


/* يسمح لأبناء الفوتر أن يكونوا عناصر Grid مباشرة */

.br-foot {
    display: contents;
}


/* لوحة الخريطة */

.br-map-panel {
    grid-area: map;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .06) inset, 0 12px 24px rgba(0, 0, 0, .08);
    background: #fff;
    min-height: 320px;
}


/* إطار الخريطة يملأ المساحة */

.br-map-panel iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 320px;
    border: 0;
    background: #fff;
    aspect-ratio: 16 / 9;
}


/* على الشاشات الصغيرة: خريطة ثم نص تحتها */

@media (max-width: 980px) {
    .br-card {
        grid-template-columns: 1fr;
        grid-template-areas: "head" "map" "text";
    }
}