/* ============================================================
   MariSMM App Shell — Liquid Glass Header + Sidebar + Bottom Bar
   Matches mariasmm.cyber-ninjas.top reference layout
   ============================================================ */

:root {
  --shell-sb-w: 256px;
  --shell-hd-h: 64px;
  --shell-bb-h: 66px;
}


/* ── Glass tokens (shell) — follow the page theme ───────── */
:root,
:root[data-theme="light"] {
  --sh-blur: 24px;
  --sh-glass: rgba(255, 255, 255, 0.58);
  --sh-glass-strong: rgba(255, 255, 255, 0.86);
  --sh-border: rgba(17, 17, 17, 0.10);
  --sh-border-strong: rgba(17, 17, 17, 0.22);
  --sh-hi: rgba(255, 255, 255, 0.85);
  --sh-hi-soft: rgba(255, 255, 255, 0.45);
  --sh-shadow: rgba(20, 30, 50, 0.10);
  --sh-shadow-strong: rgba(20, 30, 50, 0.28);
  --sh-text: #111111;
  --sh-text-2: #3f3f46;
  --sh-sub: #52525B;
  --sh-chip: rgba(17, 17, 17, 0.06);
  --sh-chip-hover: rgba(17, 17, 17, 0.11);
  --sh-active: rgba(17, 17, 17, 0.08);
  --sh-btn-bg: #111111;
  --sh-btn-fg: #FFFFFF;
}
:root[data-theme="dark"] {
  --sh-glass: rgba(20, 20, 24, 0.50);
  --sh-glass-strong: rgba(16, 16, 20, 0.88);
  --sh-border: rgba(255, 255, 255, 0.12);
  --sh-border-strong: rgba(255, 255, 255, 0.26);
  --sh-hi: rgba(255, 255, 255, 0.16);
  --sh-hi-soft: rgba(255, 255, 255, 0.07);
  --sh-shadow: rgba(0, 0, 0, 0.40);
  --sh-shadow-strong: rgba(0, 0, 0, 0.70);
  --sh-text: #FAFAFA;
  --sh-text-2: #D4D4D8;
  --sh-sub: #A1A1AA;
  --sh-chip: rgba(255, 255, 255, 0.07);
  --sh-chip-hover: rgba(255, 255, 255, 0.13);
  --sh-active: rgba(255, 255, 255, 0.10);
  --sh-btn-bg: #FAFAFA;
  --sh-btn-fg: #0A0A0A;
}

/* Neutralise legacy per-page chrome */
body.has-app-shell > .topbar,
body.has-app-shell > nav.topbar,
body.has-app-shell > header.topbar,
body.has-app-shell > .drawer,
body.has-app-shell > .drawer-overlay,
body.has-app-shell > .bottom-bar:not(#appBottomBar) {
  display: none !important;
}

body.has-app-shell {
  padding-top: var(--shell-hd-h) !important;
  padding-left: var(--shell-sb-w) !important;
  padding-bottom: 28px !important;
  min-height: 100vh;
  background: var(--main-bg, #F6F6F7);
  color: var(--tc, #0F172A);
}

@media (max-width: 991.98px) {
  body.has-app-shell {
    padding-left: 0 !important;
    padding-bottom: calc(var(--shell-bb-h) + 18px) !important;
  }
}

/* ── SIDEBAR RAIL (Desktop + Mobile Drawer) — glass ──────── */
#appSidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--shell-sb-w);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  background: var(--sh-glass);
  -webkit-backdrop-filter: blur(var(--sh-blur)) saturate(180%);
  backdrop-filter: blur(var(--sh-blur)) saturate(180%);
  border-right: 1px solid var(--sh-border);
  box-shadow: inset -1px 0 0 var(--sh-hi-soft);
  transition: transform .26s cubic-bezier(.4,0,.2,1), box-shadow .26s ease;
  overflow: hidden;
  color: var(--sh-text);
}

@media (max-width: 991.98px) {
  #appSidebar {
    transform: translateX(-104%);
    width: min(290px, 84vw);
    background: var(--sh-glass-strong);
  }
  body.shell-sb-open #appSidebar {
    transform: translateX(0);
    box-shadow: 20px 0 60px var(--sh-shadow-strong);
  }
}

.as-brand {
  height: var(--shell-hd-h);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--sh-border);
  flex-shrink: 0;
}
.as-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}
.as-sb-close {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--sh-border);
  background: var(--sh-chip);
  color: var(--sh-text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.as-sb-close:hover {
  border-color: var(--sh-border-strong);
}
@media (max-width: 991.98px) {
  .as-sb-close { display: inline-flex; }
}

/* Sidebar user card */
.as-user {
  margin: 14px 14px 8px;
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--sh-chip);
  border: 1px solid var(--sh-border);
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.as-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--sh-btn-bg);
  color: var(--sh-btn-fg);
  font-weight: 800;
  font-size: .95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px var(--sh-shadow);
  overflow: hidden;
}
.as-avatar img { width: 100%; height: 100%; object-fit: cover; }
.as-user-meta { min-width: 0; flex: 1; }
.as-user-name {
  font-size: .86rem;
  font-weight: 700;
  color: var(--sh-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.as-user-bal {
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem;
  font-weight: 700;
  color: var(--sh-sub);
}
.as-user-add {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--sh-btn-bg);
  color: var(--sh-btn-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: .75rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--sh-shadow);
  transition: transform .15s ease;
}
.as-user-add:hover { transform: translateY(-1px); }

/* Sidebar nav */
.as-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 14px;
  scrollbar-width: thin;
}
.as-nav::-webkit-scrollbar { width: 4px; }
.as-nav::-webkit-scrollbar-thumb { background: var(--sh-border-strong); border-radius: 4px; }

.as-sec-lbl {
  font-size: .62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--sh-sub);
  padding: 12px 12px 5px;
}

.as-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 12px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--sh-text-2);
  text-decoration: none;
  border: 1px solid transparent;
  position: relative;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.as-item .as-ic {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--sh-chip);
  border: 1px solid var(--sh-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  color: var(--sh-sub);
  flex-shrink: 0;
  transition: all .16s ease;
}
.as-item:hover {
  color: var(--sh-text);
  background: var(--sh-chip);
}
.as-item:hover .as-ic {
  color: var(--sh-text);
  border-color: var(--sh-border-strong);
}
.as-item.active {
  color: var(--sh-text);
  font-weight: 700;
  background: var(--sh-active);
  border-color: var(--sh-border-strong);
  box-shadow: inset 0 1px 0 var(--sh-hi);
}
.as-item.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sh-text);
}
.as-item.active .as-ic {
  background: var(--sh-btn-bg);
  border-color: transparent;
  color: var(--sh-btn-fg);
  box-shadow: 0 4px 12px var(--sh-shadow);
}
.as-item.as-admin {
  color: #b45309;
}
.as-item.as-admin .as-ic {
  color: #b45309;
  background: rgba(251,191,36,.14);
  border-color: rgba(251,191,36,.34);
}
:root[data-theme="dark"] .as-item.as-admin,
:root[data-theme="dark"] .as-item.as-admin .as-ic { color: #fbbf24; }

/* Sidebar footer */
.as-foot {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--sh-border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.as-logout {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: .8rem;
  font-weight: 700;
  color: #dc2626;
  background: rgba(239,68,68,.10);
  border: 1px solid rgba(239,68,68,.26);
  text-decoration: none;
  transition: background .16s ease;
}
:root[data-theme="dark"] .as-logout { color: #f87171; }
.as-logout:hover { background: rgba(239,68,68,.2); }

/* Mobile backdrop */
#appSbBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 10, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1035;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
body.shell-sb-open #appSbBackdrop {
  opacity: 1;
  pointer-events: auto;
}

/* ── TOP HEADER — liquid glass (no more blue bar) ── */
#appHeader {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--shell-sb-w);
  height: var(--shell-hd-h);
  z-index: 1030;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--sh-glass);
  -webkit-backdrop-filter: blur(var(--sh-blur)) saturate(180%);
  backdrop-filter: blur(var(--sh-blur)) saturate(180%);
  border-bottom: 1px solid var(--sh-border);
  box-shadow: 0 6px 24px var(--sh-shadow), inset 0 1px 0 var(--sh-hi);
}
#appHeader::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, var(--sh-hi-soft) 0%, transparent 60%);
}

@media (max-width: 991.98px) {
  #appHeader {
    left: 0;
    padding: 0 16px;
  }
}

.as-hd-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.as-mobile-logo {
  display: none;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

@media (max-width: 991.98px) {
  .as-mobile-logo { display: inline-flex; }
  .as-page-title { display: none; }
}

.as-page-title {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -.3px;
  color: var(--sh-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.as-hd-right {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.as-bal-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--sh-chip);
  border: 1px solid var(--sh-border);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: .8rem;
  font-weight: 700;
  color: var(--sh-text);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.as-bal-chip i { color: var(--sh-sub); font-size: .76rem; }
.as-bal-chip:hover {
  transform: translateY(-1px);
  background: var(--sh-chip-hover);
  box-shadow: 0 6px 18px var(--sh-shadow);
}

.as-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  background: var(--sh-btn-bg);
  color: var(--sh-btn-fg);
  font-size: .78rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 14px var(--sh-shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.as-add-btn i { color: inherit; }
.as-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px var(--sh-shadow);
}
@media (max-width: 640px) {
  .as-add-btn { display: none; }
}

.as-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--sh-chip);
  border: 1px solid var(--sh-border);
  color: var(--sh-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .85rem;
  text-decoration: none;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.as-icon-btn:hover {
  border-color: var(--sh-border-strong);
  background: var(--sh-chip-hover);
}
/* hamburger bars follow the theme colour */
.as-burger svg { stroke: currentColor; fill: none; }

.as-burger {
  display: none !important;
}
@media (max-width: 991.98px) {
  .as-burger { display: inline-flex !important; }
}

/* ── FIXED BOTTOM NAVIGATION BAR — glass ── */
#appBottomBar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--shell-bb-h);
  z-index: 1032;
  background: var(--sh-glass);
  -webkit-backdrop-filter: blur(var(--sh-blur)) saturate(180%);
  backdrop-filter: blur(var(--sh-blur)) saturate(180%);
  border-top: 1px solid var(--sh-border);
  box-shadow: 0 -6px 26px var(--sh-shadow), inset 0 1px 0 var(--sh-hi);
  padding: 0 6px env(safe-area-inset-bottom, 0px);
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
}

@media (max-width: 991.98px) {
  #appBottomBar {
    display: grid;
  }
}

.as-bb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  text-decoration: none;
  color: var(--sh-sub);
  font-size: 0.72rem;
  font-weight: 600;
  position: relative;
  transition: color 0.18s ease, transform 0.15s ease;
}
.as-bb-item i {
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 0.18s ease, color 0.18s ease;
}
.as-bb-item span {
  line-height: 1;
  letter-spacing: -0.1px;
}
.as-bb-item:hover {
  color: var(--sh-text);
}
.as-bb-item.active {
  color: var(--sh-text);
  font-weight: 800;
}
.as-bb-item.active i {
  color: var(--sh-text);
}
.as-bb-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 32px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--sh-text);
}

/* ── PAGE CONTENT CONTAINER ───────────────────────────────── */
body.has-app-shell .page-wrap,
body.has-app-shell .main-wrap,
body.has-app-shell main.container {
  max-width: 1280px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-top: 22px !important;
  padding-left: 24px !important;
  padding-right: 24px !important;
}

@media (max-width: 640px) {
  body.has-app-shell .page-wrap,
  body.has-app-shell .main-wrap,
  body.has-app-shell main.container {
    padding-top: 16px !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
}

/* Brand logo image */
.as-logo-img { height: 28px; width: auto; max-width: 170px; object-fit: contain; display: block; }
.as-mobile-logo .as-logo-img { height: 26px; max-width: 150px; }
