/* LUXIOUS QR STUDIO - application shell (sidebar, top bar, bottom navigation, pages). */
.app { min-height: 100dvh; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; flex: none; border-radius: 9px; background: var(--ink); position: relative; box-shadow: var(--shadow-1); }
.brand-mark::before { content: ""; position: absolute; inset: 7px; border: 2.5px solid var(--gold); border-radius: 4px; }
.brand-mark::after { content: ""; position: absolute; width: 6px; height: 6px; left: 13px; top: 13px; background: var(--gold); border-radius: 1.5px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-name { font-weight: 650; letter-spacing: 0.14em; font-size: 13px; }
.brand-sub { font-size: 11.5px; color: var(--text-3); letter-spacing: 0.02em; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); z-index: var(--z-nav);
  display: flex; flex-direction: column; gap: 8px; padding: 18px 14px 14px;
  background: var(--bg); border-inline-end: 1px solid var(--line);
}
.sidebar .brand { padding: 2px 6px 14px; }
.side-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
.side-nav::-webkit-scrollbar { display: none; }
.side-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); padding: 14px 10px 6px; }
:lang(ar) .side-label { text-transform: none; letter-spacing: 0; font-size: 12px; }
.side-link {
  position: relative; display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 520; font-size: var(--fs-base); white-space: nowrap;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.side-link svg.icon { width: 19px; height: 19px; color: var(--text-3); transition: color var(--dur-fast) ease; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link[aria-current="page"] { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); font-weight: 600; }
.side-link[aria-current="page"] svg.icon { color: var(--gold-text); }
.side-link[aria-current="page"]::before { content: ""; position: absolute; inset-inline-start: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
[dir="rtl"] .side-link[aria-current="page"]::before { border-radius: 3px 0 0 3px; }
.side-link .count { margin-inline-start: auto; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.side-cta { margin: 4px 0 6px; }
.side-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-md); min-width: 0; }
.side-user:hover { background: var(--surface-2); }
.side-user .who { min-width: 0; line-height: 1.25; }
.side-user .who strong { display: block; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who span { display: block; font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-pill { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-xs); color: var(--text-2); }
.mode-pill svg.icon { width: 16px; height: 16px; color: var(--gold-text); }

/* Compact rail (editor pages on desktop) */
@media (min-width: 1024px) {
  .is-studio .sidebar { width: 76px; padding-inline: 12px; }
  .is-studio .sidebar .brand-text, .is-studio .side-label, .is-studio .side-link > span:not(.ic), .is-studio .side-link .count,
  .is-studio .side-user .who, .is-studio .mode-pill > span:not(.ic), .is-studio .side-cta .btn > span:not(.ic), .is-studio .side-foot .foot-credit { display: none; }
  .is-studio .side-label + .side-link { margin-top: 10px; }
  .is-studio .side-link { justify-content: center; padding: 0; }
  .is-studio .sidebar .brand { justify-content: center; padding-inline: 0; }
  .is-studio .side-cta .btn { width: 44px; padding: 0; }
  .is-studio .side-user, .is-studio .mode-pill { justify-content: center; }
  .is-studio .side-link[aria-current="page"]::before { inset-inline-start: -12px; }
  .is-studio .app-body { margin-inline-start: 76px; }
}

/* ---------- Main column ---------- */
.app-body { margin-inline-start: var(--sidebar-w); min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky); height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(150%) blur(12px); -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: none; }
.topbar-title { font-weight: 600; font-size: var(--fs-md); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }
.lang-select { height: 34px; min-height: 34px; padding: 4px 30px 4px 10px; font-size: var(--fs-sm); width: auto; border-radius: var(--r-pill); background-color: var(--bg-elev); }

.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 32px 56px; flex: 1; }
.page-wide { max-width: 1560px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .titles { flex: 1 1 320px; min-width: 0; }
.page-head h1 { font-size: var(--fs-2xl); }
.page-head p { margin: 6px 0 0; color: var(--text-2); max-width: 64ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: var(--fs-md); font-weight: 600; margin: 0 0 12px; }

/* ---------- Bottom navigation ---------- */
.bottomnav { display: none; }

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); width: min(300px, 86vw); box-shadow: var(--shadow-pop); transition: transform 320ms var(--ease-drawer); background: var(--bg-elev); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: calc(var(--z-nav) - 1); background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity var(--dur) ease; }
  .sidebar-scrim.is-open { opacity: 1; pointer-events: auto; }
  .app-body, .is-studio .app-body { margin-inline-start: 0; }
  .topbar { padding: 0 12px 0 8px; }
  .topbar .brand { display: flex; }
  .topbar .brand-sub { display: none; }
  .topbar-title { display: none; }
  .page { padding: 20px 16px 40px; }
  .page-head h1 { font-size: var(--fs-xl); }
}
@media (min-width: 1024px) { .menu-toggle { display: none; } .sidebar-scrim { display: none; } }

@media (max-width: 767px) {
  .has-bottomnav .page { padding-bottom: calc(var(--bottomnav-h) + 32px + env(safe-area-inset-bottom)); }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: var(--z-nav);
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg-elev) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .bottomnav a, .bottomnav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 550; color: var(--text-3);
    -webkit-tap-highlight-color: transparent; transition: color var(--dur-fast) ease; min-width: 0;
  }
  .bottomnav svg.icon { width: 22px; height: 22px; }
  .bottomnav span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .bottomnav [aria-current="page"] { color: var(--text); }
  .bottomnav [aria-current="page"] svg.icon { color: var(--gold-text); }
}

/* ---------- Common page blocks ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.search-input { position: relative; flex: 1 1 260px; min-width: 0; max-width: 420px; }
.search-input svg.icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 17px; height: 17px; pointer-events: none; }
.search-input .input { padding-inline-start: 38px; border-radius: var(--r-pill); }
.link { color: var(--gold-text); font-weight: 550; text-decoration: underline; text-decoration-color: var(--gold-line); text-underline-offset: 3px; }
.link:hover { text-decoration-color: currentColor; }
.foot-credit { text-align: center; font-size: var(--fs-xs); color: var(--text-3); padding: 18px 16px 28px; }
.foot-credit a { color: var(--text-2); }
.foot-credit a:hover { color: var(--text); }
