/* ==========================================================================
   Side menu drawer (footer_sidemenu.php, scripts/bc-sidemenu.js).
   Colours come only from the --bc-* tokens in modern.css, so a site-wide dark theme
   (when there is one) carries over without changes here.
   ========================================================================== */
.bc-sm { position: fixed; inset: 0; z-index: 100005; font-family: var(--bc-font); line-height: 1.35; }
.bc-sm[hidden] { display: none; }
.bc-sm *, .bc-sm *::before, .bc-sm *::after { box-sizing: border-box; }

.bc-sm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 16, 0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.28s var(--bc-ease);
}
.bc-sm.is-open .bc-sm-backdrop { opacity: 1; }

.bc-sm-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: min(320px, calc(100vw - 56px));
  padding-left: env(safe-area-inset-left);
  background: var(--bc-surface);
  color: var(--bc-ink-2);
  border-radius: 0 24px 24px 0;
  box-shadow: var(--bc-shadow-3), 0 0 0 1px var(--bc-line);
  transform: translateX(-104%);
  transition: transform 0.34s var(--bc-ease);
  outline: none;
  overflow: hidden;
}
.bc-sm.is-open .bc-sm-panel { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .bc-sm-backdrop, .bc-sm-panel { transition: none; }
}

/* Top: logo + close */
.bc-sm-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 14px 10px 20px;
}
.bc-sm-logo { flex: 1; min-width: 0; display: block; }
.bc-sm-logo img { display: block; width: 100%; max-width: 190px; height: auto; }
.bc-sm-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  font-size: 16px;
  color: var(--bc-muted);
  background: var(--bc-surface-2);
  cursor: pointer;
  transition: background 0.15s var(--bc-ease), color 0.15s var(--bc-ease);
}
.bc-sm-x:hover { background: var(--bc-surface-3); color: var(--bc-ink); }

.bc-sm-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 12px 16px;
  scrollbar-width: thin;
}

/* Member header */
.bc-sm-me {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--bc-r);
  background: var(--bc-surface-2);
  color: var(--bc-ink) !important;
  text-decoration: none !important;
  transition: background 0.15s var(--bc-ease);
}
.bc-sm-me:hover, .bc-sm-me.is-active { background: var(--bc-surface-3); }
.bc-sm-av { flex: none; display: inline-flex; }
.bc-sm-av img, .bc-sm-av .bc-av { margin: 0 !important; object-fit: cover; }
.bc-sm-meinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.bc-sm-name { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-sm-belt { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--bc-muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-sm-beltdraw { flex: none; display: inline-flex; width: 30px; overflow: hidden; }
.bc-sm-beltdraw > * { max-width: 100%; }
.bc-sm-mesub { font-size: 12.5px; font-weight: 600; color: var(--bc-accent); }
.bc-sm-mesub i { font-size: 10px; margin-left: 2px; transition: transform 0.18s var(--bc-ease); }
.bc-sm-me:hover .bc-sm-mesub i { transform: translateX(2px); }

/* Messages / notifications */
.bc-sm-quick { display: flex; gap: 8px; margin-top: 8px; }
.bc-sm-qbtn {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--bc-r-sm);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--bc-line-strong);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--bc-ink-2) !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.15s var(--bc-ease);
}
.bc-sm-qbtn > span:not(.bc-sm-qicon) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-sm-qbtn i { flex: none; font-size: 14px; color: var(--bc-muted); }
.bc-sm-qbtn:hover, .bc-sm-qbtn.is-active { background: var(--bc-surface-2); }

/* Waiting for your answer */
.bc-sm-pending {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 11px 12px;
  border-radius: var(--bc-r-sm);
  background: rgba(225, 29, 72, 0.07);
  box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.18);
  color: var(--bc-ink) !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
}
.bc-sm-pending i { flex: none; width: 18px; text-align: center; color: var(--bc-red); }
.bc-sm-pending:hover { background: rgba(225, 29, 72, 0.11); }

/* Guest */
.bc-sm-guest { padding: 16px; border-radius: var(--bc-r); background: var(--bc-surface-2); }
.bc-sm-guesttitle { margin: 0; font-size: 16px; font-weight: 700; color: var(--bc-ink); }
.bc-sm-guesttext { margin: 4px 0 12px; font-size: 13.5px; color: var(--bc-muted); line-height: 1.4; }
.bc-sm-guestbtns { display: flex; gap: 8px; }
.bc-sm-btn {
  flex: 1;
  display: grid;
  place-items: center;
  height: 40px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  color: var(--bc-ink) !important;
  background: var(--bc-surface);
  box-shadow: inset 0 0 0 1px var(--bc-line-strong);
}
.bc-sm-btn--primary { background: var(--bc-ink); color: var(--bc-on-ink) !important; box-shadow: none; }
.bc-sm-btn:hover { filter: brightness(0.96); }

/* Groups and rows */
.bc-sm-group { padding: 12px 0 2px; }
.bc-sm-group + .bc-sm-group { margin-top: 4px; border-top: 1px solid var(--bc-line); }
.bc-sm-grouplabel { margin: 0 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--bc-faint); line-height: 1.4; }
.bc-sm-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 9px 10px;
  border-radius: var(--bc-r-sm);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--bc-ink-2) !important;
  text-decoration: none !important;
  transition: background 0.15s var(--bc-ease), color 0.15s var(--bc-ease);
}
.bc-sm-link i { flex: 0 0 20px; width: 20px; text-align: center; font-size: 15px; color: var(--bc-faint); transition: color 0.15s var(--bc-ease); }
.bc-sm-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-sm-link:hover { background: var(--bc-surface-2); color: var(--bc-ink) !important; }
.bc-sm-link:hover i { color: var(--bc-muted); }
.bc-sm-link.is-active { background: var(--bc-ink); color: var(--bc-on-ink) !important; box-shadow: 0 8px 18px -12px rgba(11, 11, 16, 0.8); }
.bc-sm-link.is-active i { color: #fff; }

.bc-sm-count {
  flex: none;
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bc-red);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Footer: log out */
.bc-sm-foot { flex: none; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--bc-line); background: var(--bc-surface); }
.bc-sm-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 12px;
  border-radius: var(--bc-r-sm);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--bc-red) !important;
  text-decoration: none !important;
  transition: background 0.15s var(--bc-ease);
}
.bc-sm-logout i { width: 20px; text-align: center; }
.bc-sm-logout:hover { background: rgba(225, 29, 72, 0.08); }

.bc-sm a:focus-visible, .bc-sm button:focus-visible { outline: none; box-shadow: var(--bc-ring); }

/* Scroll lock while open (scripts/bc-sidemenu.js) */
html.bc-sm-locked, html.bc-sm-locked body { overflow: hidden !important; overscroll-behavior: none; }
html.bc-sm-locked body { padding-right: var(--bc-sm-gap, 0px); }

@media (min-width: 768px) {
  .bc-sm-panel { width: 340px; }
}

/* Quick buttons: the count sits on the icon so "Notifications" fits at 390px */
.bc-sm-qicon { position: relative; flex: none; display: inline-flex; margin-right: 6px; }
.bc-sm-qicon .bc-sm-count { position: absolute; top: -10px; left: 6px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 10.5px; line-height: 18px; box-shadow: 0 0 0 2px var(--bc-surface); }

/* Toasts wait while the menu is open */
.bc-sm-locked .bc-notes { visibility: hidden; }
/* Badges bcRefreshBadges may hide (count 0) or show again (scripts/bc-sidemenu.js) */
.bc-sm-count[hidden], .bc-sm-pending[hidden] { display: none !important; }
/* Appearance: light / dark / auto (footer_sidemenu.php, scripts/bc-sidemenu.js) */
.bc-sm-themeseg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 2px 4px 0; border-radius: 14px; background: var(--bc-surface-2); box-shadow: inset 0 0 0 1px var(--bc-line); }
.bc-sm-themeseg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--bc-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.bc-sm-themeseg button.is-on { background: var(--bc-surface); color: var(--bc-ink); box-shadow: var(--bc-shadow-1), 0 0 0 1px var(--bc-line); }
