/* ═══════════════════════════════════════════════════════════════════════
   SIDEBAR DRAWER — FAB + slide-in drawer + backdrop
   Complements assets/sidebar.css (which styles the internals).
   ═══════════════════════════════════════════════════════════════════════ */

/* ── FAB — floating menu button (bottom-left) ────────────────────────── */
.sb-fab {
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff2d95, #a855f7);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  box-shadow:
    0 1px 0 rgba(255,255,255,.28) inset,
    0 12px 28px -10px rgba(255,45,149,.85),
    0 0 30px -8px rgba(0,229,255,.5);
  z-index: 1001;
  transition:
    transform .25s cubic-bezier(.2,.8,.2,1),
    filter .2s,
    box-shadow .25s,
    background .25s;
  -webkit-tap-highlight-color: transparent;
}
.sb-fab:hover {
  transform: translateY(-3px) scale(1.05);
  filter: brightness(1.08);
  box-shadow:
    0 1px 0 rgba(255,255,255,.35) inset,
    0 16px 34px -10px rgba(255,45,149,1),
    0 0 40px -6px rgba(0,229,255,.65);
}
.sb-fab:active { transform: translateY(-1px) scale(.96); }
.sb-fab:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(0,229,255,.45),
    0 1px 0 rgba(255,255,255,.3) inset,
    0 12px 28px -10px rgba(255,45,149,.9);
}

.sb-fab-icon {
  display: block;
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.sb-fab[aria-expanded="true"] .sb-fab-icon { transform: rotate(90deg); }
.sb-fab[aria-expanded="true"] {
  background: linear-gradient(135deg, #a855f7, #ff2d95);
}

/* Tooltip on hover */
.sb-fab-tip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: #0f0f1c;
  color: #fff;
  padding: .35rem .7rem;
  border-radius: 8px;
  font-size: .76rem;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 8px 20px rgba(0,0,0,.6);
  transition: opacity .18s, transform .18s;
}
.sb-fab:hover .sb-fab-tip,
.sb-fab:focus-visible .sb-fab-tip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ── Drawer wrapper ──────────────────────────────────────────────────── */
.sidebar.sb-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  max-width: 86vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1000;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(-100%);
  transition: transform .38s cubic-bezier(.2,.8,.2,1);
  /* Internal look (background, padding, borders) comes from sidebar.css.
     We only override position + motion + shadow. */
  box-shadow: none;
}
.sidebar.sb-drawer.open {
  transform: translateX(0);
  box-shadow:
    20px 0 60px -20px rgba(0,0,0,.75),
    0 0 60px -20px rgba(255,45,149,.4);
}

/* Ensure the drawer scrolls nicely on short screens */
.sidebar.sb-drawer::-webkit-scrollbar { width: 6px; }
.sidebar.sb-drawer::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255,45,149,.5), rgba(168,85,247,.5));
  border-radius: 999px;
}

/* ── Close button inside drawer ──────────────────────────────────────── */
.sb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: #eaeaf5;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  z-index: 2;
  transition: border-color .2s, color .2s, box-shadow .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.sb-close:hover {
  border-color: #00e5ff;
  color: #fff;
  box-shadow: 0 0 18px -5px rgba(0,229,255,.7);
}
.sb-close:active { transform: scale(.94); }
.sb-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,229,255,.4);
}

/* ── Backdrop ────────────────────────────────────────────────────────── */
.sb-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.sb-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* ── Body lock when drawer is open ───────────────────────────────────── */
body.sb-drawer-open {
  overflow: hidden;
}

/* ── Kill the old persistent-sidebar layout ──────────────────────────── */
/* If any leftover CSS adds a margin to .app-main, neutralize it now that
   the drawer is an overlay, not a permanent column. */
body:not(.sb-pinned) .app-main {
  margin-left: 0 !important;
}

/* ── Optional: pinned mode on very wide screens ──────────────────────── */
/* Turn this on by adding `sb-pinned` to <body>, e.g. via a user preference.
   When pinned, the drawer is always visible and the FAB is hidden. */
@media (min-width: 1200px) {
  body.sb-pinned .sidebar.sb-drawer {
    transform: none;
    box-shadow: none;
    border-right: 1px solid rgba(255,255,255,.06);
  }
  body.sb-pinned .sb-fab { display: none; }
  body.sb-pinned .sb-close { display: none; }
  body.sb-pinned .sb-backdrop { display: none; }
  body.sb-pinned .app-main {
    margin-left: 300px !important;
    transition: margin-left .3s ease;
  }
}

/* ── Mobile tweaks ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .sb-fab {
    left: 12px;
    bottom: 12px;
    width: 46px;
    height: 46px;
    font-size: 18px;
  }
  .sb-fab-tip { display: none; } /* no hover on touch */
  .sidebar.sb-drawer { width: 290px; }
}

/* Don't collide with the existing New Post FAB — it's on the right, this
   one is on the left, so they're fine. But if you ever move both to the
   same corner, stack them: */
.fab + .sb-fab { /* placeholder */ }

/* ── Reduced motion ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .sidebar.sb-drawer,
  .sb-backdrop,
  .sb-fab,
  .sb-fab-icon,
  .sb-close {
    transition: none !important;
  }
}