/* Site-wide menu panel — the way back to your account from any page.

   Loaded after styles.css on every page, and it adds no colours, fonts or
   shadows of its own: everything below is the tokens already defined there.

   The panel slides in from the reading-start edge, which is the right in Arabic
   and the left in English. That is done with logical properties for placement
   and one direction-aware transform, because translateX is physical and does
   not flip on its own. */

/* --- the button ------------------------------------------------------------- */

/* The header grid is `auto 1fr auto` (brand | nav | CTA); the button is a fourth
   child, so the grid needs a fourth column. Source order decides this, which is
   why this file must be linked after styles.css. */
.header-inner { grid-template-columns: auto 1fr auto auto; }

.nv-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  appearance: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--navy);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

.nv-menu-button:hover { border-color: var(--line-strong); background: rgba(6, 36, 69, 0.04); }
.nv-menu-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.nv-menu-button svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* --- backdrop and panel ------------------------------------------------------ */

.nv-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 36, 69, 0.38);
  opacity: 0;
  transition: opacity var(--medium) var(--ease);
}

.nv-panel-backdrop.is-open { opacity: 1; }

.nv-panel {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;              /* the right edge in Arabic */
  z-index: 101;
  display: flex;
  flex-direction: column;
  width: min(21rem, 86vw);
  background: var(--bg-cream);
  border-inline-end: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Off-screen towards the reading-start edge: to the right in RTL */
  transform: translateX(100%);
  transition: transform var(--medium) var(--ease-out);
}

[dir="ltr"] .nv-panel { transform: translateX(-100%); }
.nv-panel.is-open { transform: translateX(0); }

/* --- panel head --------------------------------------------------------------- */

.nv-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem var(--gutter) 1rem;
  border-bottom: 1px solid var(--line);
}

.nv-panel-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--navy);
}

.nv-panel-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  appearance: none;
  background: none;
  border: 0;
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  line-height: 1;
  color: var(--text-soft);
  cursor: pointer;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

.nv-panel-close:hover { color: var(--navy); background: rgba(6, 36, 69, 0.06); }
.nv-panel-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* --- sections ------------------------------------------------------------------ */

.nv-panel-body { padding: 1.15rem var(--gutter) 1.6rem; }

.nv-panel-section + .nv-panel-section {
  margin-top: 1.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line-soft);
}

.nv-panel-label {
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* The address is Latin even on an Arabic page, and long ones must not widen
   the panel or spill out of it */
.nv-panel-email {
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
  color: var(--navy);
  overflow-wrap: anywhere;
}

.nv-panel-trial { font-size: 0.9rem; color: var(--text-soft); }
.nv-panel-trial.is-available { color: #2E6B6B; }

.nv-panel-note {
  margin-bottom: 0.9rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-soft);
}

/* The one thing this panel exists for: getting back to your orders */
.nv-panel-orders {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  margin-top: 0.95rem;
  padding: 0.8rem 1rem;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--on-navy);
  background: var(--navy);
  border-radius: var(--radius-md);
  transition: background-color var(--fast) var(--ease);
}

.nv-panel-orders:hover { background: #0a3260; }
.nv-panel-orders:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.nv-panel-orders .nv-count { font-weight: 500; color: var(--on-navy-soft); }

/* The owner's own link, below "طلباتي". Quieter than it on purpose: it is a
   working tool for one person, not the thing the panel is for. */
.nv-panel-orders.is-admin {
  margin-top: 0.5rem;
  color: var(--navy);
  background: transparent;
  border: 1px solid var(--line-strong, #D8D0C2);
}

.nv-panel-orders.is-admin:hover { background: rgba(6, 36, 69, 0.06); }

.nv-panel-links { display: flex; flex-direction: column; gap: 0.1rem; }

.nv-panel-links a {
  padding: 0.55rem 0;
  font-size: 0.98rem;
  color: var(--text-soft);
  text-decoration: none;
  transition: color var(--fast) var(--ease);
}

.nv-panel-links a:hover { color: var(--navy); }
.nv-panel-links a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* The page you are already on is shown, not offered */
.nv-panel-links a[aria-current="page"] { color: var(--navy); font-weight: 600; }

/* --- narrow screens ------------------------------------------------------------- */

@media (max-width: 900px) {
  /* styles.css collapses the header to `1fr auto` here and drops the nav to a
     second row; the button needs its own column alongside the CTA. */
  .header-inner { grid-template-columns: 1fr auto auto; }
  .nv-menu-button { width: 2.5rem; height: 2.5rem; }
}

@media (max-width: 400px) {
  /* At this width the brand, the CTA and the button are already tight, so the
     panel takes nearly the whole screen rather than squeezing its own text. */
  .nv-panel { width: min(20rem, 92vw); }
  .nv-menu-button { width: 2.35rem; height: 2.35rem; }
}

/* The page must not scroll behind an open panel, on iOS especially */
body.nv-panel-open { overflow: hidden; }
