/* sidebar-rail.css – the minimized sidebar (‹ button) in the Resident Portal and the Admin Panel.
 * Desktop only (phones use the slide-in drawer from each portal's assets/css/mobile.css). Instead of an empty strip it becomes a
 * slim rail: The Hive logo, the expand button, every menu icon (with its count, name on hover) and your avatar.
 * Opening and closing slides smoothly; the words fade out / in. Off for people who turn motion off. */

@media (min-width: 901px) {
  :root { --sb-rail: 72px; --sb-ease: cubic-bezier(.2, .8, .2, 1); }

  /* ---- the slide (only once the page is up – html.sb-ready, set by sidebar-rail.js – so pages open
         already minimized instead of sliding shut every time) ---- */
  .sb { overflow-x: hidden !important; transition: none !important; }
  .main { transition: none !important; }
  html.sb-ready .sb { transition: width .28s var(--sb-ease) !important; }
  html.sb-ready .main { transition: margin-left .28s var(--sb-ease) !important; }
  html.sb-ready :is(.sb-logo-mark, .sb-item, .sb-section, .sb-user, .sb-user-row, .sb-logo) { transition: padding .28s var(--sb-ease), gap .28s var(--sb-ease), margin .28s var(--sb-ease), height .28s var(--sb-ease), background-color .15s ease; }
  html.sb-ready :is(.sb-brand, .sb-role, .sb-uname, .sb-utitle, .sb-condo, .sb-rental-t) { transition: opacity .18s ease; }
  html.sb-ready .sb-toggle .sb-tg-chev { transition: transform .28s var(--sb-ease); }

  .sb.collapsed { width: var(--sb-rail) !important; }
  .sb.collapsed + .main { margin-left: var(--sb-rail) !important; }

  /* ---- the open / minimize button: a small "side panel" icon whose arrow flips – same look as the menu's
         outlined buttons (quiet at rest, orange outline + tint on hover like the active menu item) ---- */
  .sb .sb-toggle { width: 32px; height: 32px; padding: 0; border-radius: 10px; color: #A9A196;
                   background: transparent; border: 1px solid rgba(255,255,255,.09);
                   transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
  .sb .sb-toggle svg { width: 18px; height: 18px; }
  .sb .sb-toggle:hover { color: var(--brand-light, #FFB25C); background: rgba(var(--brand-rgb, 255,138,0),.12); border-color: rgba(var(--brand-rgb, 255,138,0),.38); }
  .sb .sb-toggle:active { background: rgba(var(--brand-rgb, 255,138,0),.2); }
  .sb .sb-toggle:focus-visible { outline: none; border-color: var(--brand, #FF8A00); box-shadow: 0 0 0 3px rgba(var(--brand-rgb, 255,138,0),.25); }
  .sb .sb-toggle .sb-tg-chev { transform-box: fill-box; transform-origin: center; }
  .sb.collapsed .sb-toggle .sb-tg-chev { transform: rotate(180deg); }   /* ‹ becomes › */

  /* ---- logo: the mark on top, the expand button under it ---- */
  .sb.collapsed .sb-logo { padding: 18px 0 12px !important; display: flex; justify-content: center; }
  .sb.collapsed .sb-logo-mark { width: 100%; flex-direction: column-reverse; align-items: center; justify-content: center !important; gap: 18px !important; padding: 0 !important; margin: 0 !important; }
  .sb.collapsed .sb-logo-mark .sb-logo-icon { display: flex !important; width: 100%; margin: 0 !important; padding: 0 !important; justify-content: center; }
  /* the mark's artwork sits a hair left inside its box – nudge it so it lines up with the icons */
  .sb.collapsed .sb-logo-mark .sb-logo-icon .hive-mark { width: 30px; height: auto; transform: translateX(1px); }
  .sb.collapsed .sb-toggle { display: grid !important; place-items: center; margin: 0 !important; padding: 0 !important; width: 36px; height: 32px; }
  .sb.collapsed .sb-brand, .sb.collapsed .sb-role { opacity: 0; width: 0; height: 0; overflow: hidden; margin: 0 !important; padding: 0 !important; pointer-events: none; }

  /* ---- menu: icons only, centred; the words slide out of view ---- */
  /* compact enough that every icon fits on a laptop screen; a shorter fade if it still has to scroll */
  .sb.collapsed .sb-nav { display: block !important; padding: 6px 12px !important; overflow-x: hidden; scrollbar-width: none; }
  .sb.collapsed .sb-nav::-webkit-scrollbar { width: 0; }
  .sb.collapsed .sb-nav.can-up { --fade-top: 14px; }
  .sb.collapsed .sb-nav.can-down { --fade-bottom: 18px; }
  .sb.collapsed .sb-item { position: relative; height: 38px; min-height: 0 !important; padding: 0 14px !important; margin: 0 0 4px !important; gap: 48px !important; white-space: nowrap; overflow: hidden; justify-content: flex-start; align-items: center; }
  .sb.collapsed .sb-item .sb-icon { flex: none; }
  .sb.collapsed .sb-rental-t { opacity: 0; }
  /* section titles become thin dividers */
  .sb.collapsed .sb-section { font-size: 0 !important; line-height: 0; height: 1px; padding: 0 !important; margin: 6px 12px !important; background: rgba(255,255,255,.09); opacity: 1; overflow: hidden; }
  /* counts become a small badge on the icon */
  .sb.collapsed .sb-item .sb-count { position: absolute; top: 3px; left: 21px; min-width: 16px; height: 16px; padding: 0 4px; margin: 0;
                                     display: grid; place-items: center; font-size: .6rem; font-weight: 800; line-height: 1; border-radius: 999px;
                                     background: var(--brand, #FF8A00) !important; color: #1A0E05 !important; box-shadow: 0 0 0 2px #0E1014; }
  /* nothing to count → no badge in the rail (data-zero is set by sidebar-rail.js) */
  .sb.collapsed .sb-item .sb-count[hidden], .sb.collapsed .sb-item .sb-count:empty, .sb.collapsed .sb-item .sb-count[data-zero] { display: none !important; }
  /* the "more below" arrow and the condo block don't fit the rail */
  .sb.collapsed .sb-more { display: none !important; }
  .sb.collapsed .sb-condo { display: none !important; }

  /* ---- you: just the avatar ---- */
  .sb.collapsed .sb-user { display: block !important; padding: 12px 0 !important; margin: 0 !important; }
  .sb.collapsed .sb-user-row { display: flex; justify-content: center; gap: 0 !important; padding: 0 !important; margin: 0 !important; }
  .sb.collapsed .sb-user-row > :not(.sb-av) { display: none !important; }
  .sb.collapsed .sb-av { flex: none; width: 36px !important; height: 36px !important; margin: 0 !important; border-radius: 11px; font-size: .78rem; }

  /* a tooltip-like hint: the item's name shows on hover (title set by sidebar-rail.js) */
  .sb.collapsed .sb-item:hover, .sb.collapsed .sb-item:focus-visible { background: rgba(var(--brand-rgb, 255,138,0),.14); }
}

@media (min-width: 901px) and (prefers-reduced-motion: reduce) {
  .sb, .main, .sb *, .sb-toggle .sb-tg-chev { transition: none !important; }
}

/* ===== Collapsible sections (assets/js/sidebar-groups.js): each heading opens / closes the items under it ===== */
.sb .sb-sec-h { padding: 0 !important; }
.sb .sb-sec-btn { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 6px; padding: 14px 12px 6px; cursor: pointer;
  font: inherit; font-size: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; border-radius: 8px; }
.sb .sb-sec-btn:hover { color: var(--accent, #ff8a00); }
.sb .sb-sec-btn:focus-visible { outline: 2px solid var(--accent, #ff8a00); outline-offset: -2px; }
.sb .sb-sec-t { flex: 1; min-width: 0; text-align: left; }
.sb .sb-sec-chev { flex: none; opacity: .7; transition: transform .2s ease; }
.sb .sb-sec-h.closed .sb-sec-chev { transform: rotate(-90deg); }
.sb .sb-sec-n { flex: none; min-width: 18px; padding: 0 6px; border-radius: 999px; font-size: .62rem; line-height: 16px; text-align: center; letter-spacing: 0;
  background: rgba(255,255,255,.08); color: inherit; }
.sb .sb-sec-n.gold { background: var(--accent, #ff8a00); color: #1a0e05; }
.sb .sb-nav > .sb-grp-hid { display: none !important; }
@media (max-width: 900px) { .sb .sb-sec-btn { padding: 8px 12px 4px; } }
/* minimized sidebar (desktop rail): every icon shows; the heading is only a thin line, its button is out of the way */
@media (min-width: 901px) {
  .sb.collapsed .sb-nav > .sb-item.sb-grp-hid { display: flex !important; }
  .sb.collapsed .sb-sec-btn { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) { .sb .sb-sec-chev { transition: none; } }

/* The logo and name at the top of the sidebar go back to the home page (landing). */
a.sb-logo-icon, a.sb-brand { color: inherit; text-decoration: none; }
a.sb-brand { display: block; }
a.sb-logo-icon { border-radius: 10px; }
a.sb-logo-icon:focus-visible { outline: 2px solid var(--rust, #ff8a00); outline-offset: 3px; }
