/* ==========================================================================
   SPL Walaa — Layouts (console shell, member app shell, auth, landing)
   ========================================================================== */

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none !important; }
.brand-mark { width: 34px; height: 34px; flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -.01em; }
.brand-name em { font-style: normal; color: var(--gold-500); }
.brand-sub { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; font-weight: 500; margin-top: 2px; }
html[lang="ar"] .brand-sub { letter-spacing: 0; text-transform: none; font-size: 11px; }

/* ======================= Console shell (admin / staff) ======================= */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--navy-800); color: #DCCCE3;
  display: flex; flex-direction: column; z-index: 600;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar-head { padding: 18px 18px 14px; display: flex; align-items: center; justify-content: space-between; color: #fff; }
.sidebar-role { margin: 0 14px 10px; padding: 10px 12px; border-radius: var(--r); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; font-size: var(--fs-xs); }
.sidebar-role .avatar { width: 30px; height: 30px; font-size: 11px; background: var(--gold-500); color: var(--navy-900); }
.sidebar-role b { color: #fff; font-size: var(--fs-sm); display: block; font-weight: 600; }
.nav-group { padding: 6px 10px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #B394BE; font-weight: 700; padding: 12px 10px 6px; }
html[lang="ar"] .nav-label { letter-spacing: 0; font-size: 12px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0;
  border-radius: 8px; color: #DCCCE3; font-size: var(--fs-sm); font-weight: 500;
  text-decoration: none !important; position: relative; transition: background .12s, color .12s;
}
.nav-link .ico { width: 18px; height: 18px; opacity: .85; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link[aria-current="page"] { background: rgba(216,168,78,.14); color: #fff; }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-500); }
html[dir="rtl"] .nav-link[aria-current="page"]::before { border-radius: 3px 0 0 3px; }
.nav-link[aria-current="page"] .ico { color: var(--gold-500); opacity: 1; }
.nav-link .nav-badge { margin-inline-start: auto; background: var(--gold-500); color: var(--navy-900); font-size: 10.5px; font-weight: 700; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.nav-link .nav-tag { margin-inline-start: auto; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; color: var(--gold-500); border: 1px solid rgba(216,168,78,.4); border-radius: 4px; padding: 0 5px; text-transform: uppercase; }
.sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11.5px; color: #B394BE; }
.sidebar-foot .demo-flag { background: rgba(216,168,78,.12); color: var(--gold-500); border-color: rgba(216,168,78,.5); }

.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 500; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-toggle { display: none; }
.topbar-search { flex: 1 1 auto; max-width: 440px; }
.topbar-search .input { background: var(--surface-2); border-color: var(--border); min-height: 38px; }
.topbar-search .input:focus { background: var(--surface); }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; display: grid; place-items: center; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-3); color: var(--navy-800); }
.icon-btn .count-badge { position: absolute; top: 4px; inset-inline-end: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--error); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }

.role-switch {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 6px;
  border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); font-size: var(--fs-sm); font-weight: 600; color: var(--navy-800);
}
html[dir="rtl"] .role-switch { padding: 0 6px 0 10px; }
.role-switch:hover { border-color: var(--indigo-500); }
.role-switch .role-dot { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--navy-800); color: var(--gold-500); }
.role-switch .role-dot .ico { width: 15px; height: 15px; }
.role-switch .role-caption { font-size: 10px; color: var(--text-3); font-weight: 500; display: block; line-height: 1; text-transform: uppercase; letter-spacing: .06em; }
html[lang="ar"] .role-switch .role-caption { text-transform: none; letter-spacing: 0; }
.role-switch .role-name { display: block; line-height: 1.2; }

.lang-toggle { display: inline-flex; border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; height: 38px; background: var(--surface); }
.lang-toggle button { border: 0; background: none; padding: 0 11px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); }
.lang-toggle button[aria-pressed="true"] { background: var(--navy-800); color: #fff; }
.lang-toggle button:lang(ar) { font-family: var(--font-ar); }

.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .breadcrumbs { margin-bottom: 8px; }
.page-head h1 { font-size: 1.65rem; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .page-sub { color: var(--text-3); margin-top: 4px; font-size: var(--fs-sm); max-width: 760px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Staff variant: operational, larger targets */
.shell.is-staff .sidebar { background: #3E0C4D; }
.shell.is-staff .content { max-width: 1320px; }
.counter-strip { display: flex; gap: 10px; align-items: center; padding: 8px 24px; background: var(--navy-800); color: #DCCCE3; font-size: var(--fs-xs); }
.counter-strip b { color: #fff; }
.counter-strip .live { display: inline-flex; align-items: center; gap: 6px; color: #6FD3A5; font-weight: 600; }
.counter-strip .live .dot { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ======================= Member / guardian app shell ======================= */
body.app-member { background: var(--ivory); }
.mshell { min-height: 100vh; display: flex; flex-direction: column; }
.mbar {
  position: sticky; top: 0; z-index: 500;
  background: rgba(248,247,242,.9); backdrop-filter: blur(10px) saturate(1.3);
  border-bottom: 1px solid rgba(78,17,98,.08);
}
.mbar-inner { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 10px 20px; min-height: 64px; }
.mbar .brand { color: var(--navy-800); }
.mnav { display: flex; gap: 2px; margin-inline-start: 18px; }
.mnav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 99px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; text-decoration: none !important; }
.mnav a:hover { background: rgba(78,17,98,.06); color: var(--navy-800); }
.mnav a[aria-current="page"] { background: var(--navy-800); color: #fff; }
.mnav a .ico { width: 16px; height: 16px; }
.mbar-actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.mmain { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 22px 20px 110px; }
.mhead { margin-bottom: 18px; }
.mhead h1 { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; letter-spacing: -.02em; }
html[lang="ar"] .mhead h1 { font-family: var(--font-ar); font-weight: 700; }
.mhead p { color: var(--text-3); margin-top: 2px; }
.mback { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; margin-bottom: 12px; }
.app-member .card { border-color: rgba(78,17,98,.08); border-radius: 18px; box-shadow: 0 1px 2px rgba(78,17,98,.04), 0 6px 20px rgba(78,17,98,.05); }

/* Bottom tab bar (mobile) */
.tabbar { display: none; }
.persona { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid rgba(78,17,98,.12); background: #fff; font-size: var(--fs-sm); font-weight: 600; color: var(--navy-800); }
html[dir="rtl"] .persona { padding: 4px 4px 4px 10px; }
.persona .avatar { width: 30px; height: 30px; font-size: 11px; }

/* ======================= Auth / system pages ======================= */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  background: var(--ivory);
}
.auth-art { position: relative; overflow: hidden; background: var(--navy-800); color: #fff; padding: 44px 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art .brand { color: #fff; }
.auth-art h2 { color: #fff; font-family: var(--font-display); font-size: 2.4rem; font-weight: 500; line-height: 1.15; letter-spacing: -.02em; max-width: 520px; }
html[lang="ar"] .auth-art h2 { font-family: var(--font-ar); font-weight: 600; }
.auth-art p { color: #D7C4DD; max-width: 460px; margin-top: 14px; }
.auth-art .pattern { position: absolute; inset: 0; opacity: .5; pointer-events: none; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.7rem; font-family: var(--font-display); font-weight: 600; }
html[lang="ar"] .auth-card h1 { font-family: var(--font-ar); }
.auth-top { position: absolute; top: 18px; inset-inline-end: 22px; display: flex; gap: 8px; z-index: 5; }
.sys-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ivory); text-align: center; }
.sys-card { max-width: 520px; }
.sys-code { font-family: var(--font-display); font-size: 6rem; font-weight: 600; color: var(--navy-800); line-height: 1; letter-spacing: -.04em; }
.sys-code span { color: var(--gold-500); }

/* ======================= Landing ======================= */
.landing { min-height: 100vh; background: var(--ivory); }
.landing-hero { background: var(--navy-800); color: #fff; position: relative; overflow: hidden; }
.landing-hero-inner { max-width: 1200px; margin: 0 auto; padding: 22px 28px 112px; position: relative; z-index: 1; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 64px; flex-wrap: wrap; }
.landing-nav .brand { color: #fff; }
.landing h1 { color: #fff; font-family: var(--font-display); font-weight: 500; font-size: clamp(2.2rem, 4.4vw, 3.6rem); line-height: 1.06; letter-spacing: -.03em; max-width: 760px; }
html[lang="ar"] .landing h1 { font-family: var(--font-ar); font-weight: 600; letter-spacing: 0; line-height: 1.3; }
.landing h1 em { font-style: italic; color: var(--gold-500); font-weight: 400; }
html[lang="ar"] .landing h1 em { font-style: normal; }
.landing-lead { color: #D7C4DD; font-size: 1.05rem; max-width: 620px; margin-top: 18px; }
.landing-body { max-width: 1200px; margin: -92px auto 0; padding: 0 28px 60px; position: relative; z-index: 2; }
.role-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.role-card { background: #fff; border-radius: 18px; border: 1px solid var(--border); padding: 22px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); text-align: start; transition: transform .18s var(--ease), box-shadow .18s; color: inherit; }
.role-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.role-card .rc-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--indigo-50); color: var(--indigo-600); }
.role-card h3 { font-size: 1.15rem; }
.role-card p { color: var(--text-3); font-size: var(--fs-sm); flex: 1; }
.role-card .rc-go { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--fs-sm); color: var(--indigo-600); }

/* ======================= Demo panel ======================= */
.demo-fab { position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 800; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px 0 12px; border-radius: 99px; background: var(--navy-900); color: #fff; border: 1px solid rgba(216,168,78,.6); box-shadow: var(--shadow-lg); font-weight: 600; font-size: var(--fs-sm); }
html[dir="rtl"] .demo-fab { padding: 0 12px 0 16px; }
.demo-fab .ico { color: var(--gold-500); }
.demo-fab:hover { background: var(--navy-800); }
.demo-panel { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(400px, 100vw); background: var(--surface); z-index: 950; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein-rtl .25s var(--ease); }
html[dir="rtl"] .demo-panel { animation-name: slidein; }
.demo-panel-head { padding: 16px 18px; background: var(--navy-800); color: #fff; display: flex; align-items: center; gap: 10px; }
.demo-panel-head h2 { color: #fff; font-size: var(--fs-md); flex: 1; }
.demo-panel-head .icon-btn { color: #fff; }
.demo-panel-head .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.demo-panel-body { overflow-y: auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 18px; }
.demo-section h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 8px; }
html[lang="ar"] .demo-section h3 { letter-spacing: 0; font-size: 12px; }
.demo-roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.demo-roles button { border: 1px solid var(--border-2); background: var(--surface); border-radius: 10px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.demo-roles button[aria-pressed="true"] { border-color: var(--navy-800); background: var(--navy-800); color: #fff; }
.demo-roles button[aria-pressed="true"] .ico { color: var(--gold-500); }
.demo-links { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; }
.demo-links a { font-size: var(--fs-sm); color: var(--text); padding: 5px 6px; border-radius: 6px; display: flex; gap: 6px; align-items: center; }
.demo-links a:hover { background: var(--surface-2); text-decoration: none; }
.demo-links a .ico { width: 14px; height: 14px; color: var(--text-3); }
.demo-script { display: flex; flex-direction: column; gap: 4px; }
.demo-script a { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 8px; color: var(--text); font-size: var(--fs-sm); }
.demo-script a:hover { background: var(--surface-2); text-decoration: none; }
.demo-script .n { width: 22px; height: 22px; border-radius: 50%; background: var(--gold-100); color: var(--gold-700); font-weight: 700; font-size: 11px; display: grid; place-items: center; flex: 0 0 auto; }
.demo-script small { display: block; color: var(--text-3); font-size: var(--fs-xs); }
.demo-backdrop { position: fixed; inset: 0; background: rgba(53,9,63,.35); z-index: 940; }

/* Sync banner (cross-tab) */
.sync-note { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 820; background: var(--navy-900); color: #fff; padding: 8px 14px; border-radius: 99px; font-size: var(--fs-xs); font-weight: 600; display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow-lg); animation: pop .2s; }
.sync-note .ico { color: var(--gold-500); width: 15px; height: 15px; }

/* Shell fixes */
.nav-scrim { display: none; }
.menu-toggle-close { display: none !important; }
@media (max-width: 1024px) { .menu-toggle-close { display: grid !important; } }
@media (min-width: 1025px) { .app-console .demo-fab { inset-inline-start: calc(var(--sidebar-w) + 18px); } }
.sidebar .brand-sub { white-space: nowrap; font-size: 9.5px; }

.mnav a, .mnav button { white-space: nowrap; }
@media (max-width: 1180px) { .mnav a .ico { display: none; } .mnav a { padding: 8px 10px; } }
/* Compact demo button so it never hides page controls */
.demo-fab { width: 44px; height: 44px; padding: 0 !important; justify-content: center; bottom: 14px; }
.demo-fab span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
@media (min-width: 1025px) { .app-console .demo-fab { inset-inline-start: calc(var(--sidebar-w) - 58px); bottom: 14px; } }
.content, .mmain { padding-bottom: 96px; }

/* ---------- Brand lockup (Sharjah Libraries logo + Walaa) ---------- */
.brand { gap: 12px; flex: 0 0 auto; }
.brand-logo { display: inline-flex; align-items: center; flex: 0 0 auto; }
.brand-logo img, .brand-mark img { height: 100%; width: auto; display: none; }
.brand-logo img.brand-img-light, .brand-mark img.brand-img-light { display: block; }
.sidebar .brand-img-dark, .landing-hero .brand-img-dark, .auth-art .brand-img-dark, .on-dark .brand-img-dark, .mc-card .brand-img-dark { display: block !important; }
.sidebar .brand-img-light, .landing-hero .brand-img-light, .auth-art .brand-img-light, .on-dark .brand-img-light, .mc-card .brand-img-light { display: none !important; }
.brand-text { border-inline-start: 1px solid rgba(135,24,157,.25); padding-inline-start: 12px; white-space: nowrap; }
.sidebar .brand-text, .landing-hero .brand-text, .auth-art .brand-text, .mc-card .brand-text { border-color: rgba(255,255,255,.25); }
.brand-name { font-size: 20px; line-height: 1; }
.brand-name em { color: var(--gold-500); }
.brand-sub { font-size: 10px; letter-spacing: .06em; margin-top: 4px; }
.sidebar-head { padding: 18px 16px 14px; }
.sidebar-head .brand-logo { height: 46px !important; }
.mbar .brand-logo { height: 40px !important; }
.mbar-inner > a:first-child { flex: 0 0 auto; }
@media (max-width: 1280px) { .mbar .brand-text { display: none; } }
@media (max-width: 760px) { .brand-text { display: none; } .brand-logo { height: 30px !important; } }
