/* region.css — "Change region" pill + country panel (2026-11-16).
   Markup: includes/region-switcher.php ; behaviour: assets/js/region.js */
.rgn { position: relative; flex-shrink: 0; display: flex; align-items: center; }
/* Country header: search box (or EN/AR toggle) + pill kept side by side */
.rgn-group { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; min-width: 0; }
.rgn-group > .header-search-wrap { width: 300px; } /* keep the search box at its usual width */
.rgn-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; line-height: 1.2; color: #fff; white-space: nowrap;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28);
  text-decoration: none; transition: background .2s, border-color .2s;
}
.rgn-btn:hover, .rgn.is-open .rgn-btn { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.45); color: #fff; }
.rgn-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.rgn-flag { width: 22px; height: 16px; object-fit: cover; border-radius: 3px; display: block; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
.rgn-caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: .7; transition: transform .2s; }
.rgn.is-open .rgn-caret { transform: rotate(180deg); }

.rgn-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 1000;
  width: 320px; max-height: min(70vh, 560px); overflow: hidden;
  display: flex; flex-direction: column;
  background: #fff; color: #1a1a2e; border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.22), 0 0 0 1px rgba(0,0,0,.05);
  text-align: start;
}
.rgn-panel[hidden] { display: none; }
.rgn-panel--many { width: 520px; }
[dir="rtl"] .header-inner .rgn-panel { right: auto; left: 0; }
.rgn-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 8px; }
.rgn-title { font-size: .95rem; font-weight: 700; }
.rgn-close { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; border: 0; background: #f1f3f7; color: #1a1a2e; font-size: .85rem; line-height: 1; cursor: pointer; }
.rgn-close:hover { background: #e2e6ee; }
.rgn-search {
  margin: 4px 16px 10px; padding: 9px 14px; border-radius: 999px;
  border: 1px solid #e2e8f0; background: #f4f6f9; color: #1a1a2e;
  font: inherit; font-size: .9rem; outline: none; min-width: 0;
}
.rgn-search:focus { border-color: #9aa5b8; background: #fff; }
.rgn-list { position: relative; list-style: none; margin: 0; padding: 4px 8px 12px; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: 1fr; gap: 2px; }
.rgn-panel--many .rgn-list { grid-template-columns: 1fr 1fr; }
.rgn-list li[hidden] { display: none; }
.rgn-list a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  color: #1a1a2e; text-decoration: none; min-width: 0;
}
.rgn-list a:hover, .rgn-list a:focus-visible { background: #f1f3f7; outline: none; }
.rgn-list a.is-current { background: #fff3f2; box-shadow: inset 0 0 0 1px var(--accent, #e52d27); }
.rgn-list img { width: 24px; height: 17px; object-fit: cover; border-radius: 3px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.rgn-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.rgn-n { font-size: .88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rgn-en { font-size: .74rem; color: #6c7a89; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rgn-check { margin-inline-start: auto; color: var(--accent, #e52d27); font-weight: 800; }
.rgn-empty { display: none; }

/* Static flyer pages (own header: logo + breadcrumb [+ EN/AR toggle]) — pill pushed
   to the far end, the language toggle stays right after it. Physical margins on
   purpose: the Arabic flyer pages lay the header out with row-reverse. */
.hdr-inner > .rgn { margin-left: auto; margin-right: 0; }
.hdr-inner > .rgn + .lang-toggle { margin-left: 8px !important; margin-right: 0 !important; }

/* Mid widths: label off before the header crowds */
@media (max-width: 1100px) {
  .header-inner .rgn-label { display: none; }
  .header-inner .rgn-btn { padding: 5px 9px 5px 6px; }
}

/* Mobile: flag-only pill, panel = full-width sheet */
@media (max-width: 768px) {
  .header-inner > .rgn-group { margin-inline-start: auto; flex-shrink: 0; }
  .header-inner > .header-search-wrap { flex: 0 1 0; min-width: 0; } /* search box is hidden on mobile */
  .rgn-group { gap: 8px; }
  .rgn-group > .header-search-wrap { flex: 0 1 0; width: auto; min-width: 0; } /* search box is hidden on mobile */
  .rgn-label { display: none; }
  .rgn-btn { padding: 5px 8px 5px 6px; gap: 6px; }
  .rgn.is-open::before {
    content: ""; position: fixed; inset: 0; z-index: 999; background: rgba(10,12,24,.5);
  }
  .rgn-panel, .rgn-panel--many, [dir="rtl"] .header-inner .rgn-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 1000;
    width: 100%; max-width: 100%; max-height: 82vh; max-height: 82dvh;
    border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  }
  .rgn-panel--many .rgn-list { grid-template-columns: 1fr; }
  .rgn-list { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .rgn-list a { padding: 11px 10px; }
  .rgn-search { font-size: 1rem; } /* no iOS zoom */
}
html.rgn-lock, html.rgn-lock body { overflow: hidden; }
