/* UI v2 - left sidebar layout. Active when ui_theme.cfm resolves a theme with layout "sidebar"
   (html[data-layout="sidebar"], set before first paint by v2/head_v2.cfm). Reuses the header/nav markup of
   v2/login_menu_v2.cfm and admin_menu_v2.cfm: the nav.v2-nav that sits inside header.v2-top is taken out
   of the flow and fixed to the left edge; sections open as accordions (dist/js/v2/theme.js switches to that
   behaviour when the layout is sidebar). Below 992px the existing drawer rules of theme.css apply unchanged.
   Loaded by v2/head_v2.cfm after theme.css and the section files. */

html[data-layout="sidebar"]{--v2-sb-w:264px;--v2-sb-w-collapsed:76px}
html[data-layout="sidebar"].v2-sb-collapsed{--v2-sb-w:var(--v2-sb-w-collapsed)}

@media (min-width:992px){
  /* page shifts right by the sidebar width; header stays sticky inside the shifted page */
  /* only pages that render the main navigation get the sidebar gutter (the login and other pre-login pages have none) */
  html[data-layout="sidebar"] body:has(.v2-nav),html[data-layout="sidebar"].v2-has-nav body{padding-left:var(--v2-sb-w);transition:padding-left .28s var(--v2-ease)}   /* .v2-has-nav: theme.js fallback where :has() is unsupported */
  html[data-layout="sidebar"] .v2-top:not(.v2-pub-top){backdrop-filter:none;-webkit-backdrop-filter:none;background:var(--v2-surface)}   /* .v2-pub-top = pre-login header (menu.cfm), untouched */
  html[data-layout="sidebar"] .v2-top:not(.v2-pub-top) .v2-top-inner{max-width:none;padding:0 22px}
  html[data-layout="sidebar"] .v2-top:not(.v2-pub-top) .v2-brand{display:none}          /* brand lives at the top of the sidebar */
  html[data-layout="sidebar"] .v2-top:not(.v2-pub-top) .v2-society{align-items:flex-start;text-align:left}
  html[data-layout="sidebar"] .v2-top:not(.v2-pub-top) .v2-society-meta{justify-content:flex-start}
  html[data-layout="sidebar"] .v2-burger{display:none}
  html[data-layout="sidebar"] .content-header,html[data-layout="sidebar"] .content{max-width:none}
  html[data-layout="sidebar"] .v2-footer-inner{max-width:none}

  /* the sidebar itself */
  html[data-layout="sidebar"] .v2-nav{position:fixed;top:0;bottom:0;left:0;width:var(--v2-sb-w);z-index:1035;border-top:0;border-right:1px solid var(--v2-border);background:var(--v2-sb-bg,var(--v2-surface));display:flex;flex-direction:column;transition:width .28s var(--v2-ease);overflow:hidden}
  html[data-layout="sidebar"] .v2-sb-head{display:flex;align-items:center;gap:10px;height:var(--v2-nav-h);padding:0 14px 0 16px;border-bottom:1px solid var(--v2-border);flex:none}
  html[data-layout="sidebar"] .v2-sb-head img{height:36px;width:36px;object-fit:cover;border-radius:9px;background:#fff;flex:none}
  html[data-layout="sidebar"] .v2-sb-title{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.15}
  html[data-layout="sidebar"] .v2-sb-title b{font-size:.84rem;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  html[data-layout="sidebar"] .v2-sb-title span{font-size:.62rem;text-transform:uppercase;letter-spacing:.12em;color:var(--v2-muted);font-weight:700}
  html[data-layout="sidebar"] .v2-sb-toggle{display:inline-flex}
  /* min-height:0 lets the list shrink and scroll: without it older Safari (iPad) keeps the full height and the last sections are cut off */
  html[data-layout="sidebar"] .v2-nav-scroll{flex:1 1 0%;min-height:0;-webkit-overflow-scrolling:touch;overflow-y:auto;overflow-x:hidden;padding:10px 0 16px;scrollbar-width:thin}
  html[data-layout="sidebar"] .v2-nav-scroll::-webkit-scrollbar{display:block;width:6px}
  html[data-layout="sidebar"] .v2-nav-scroll::-webkit-scrollbar-thumb{background:var(--v2-border-strong);border-radius:6px}
  html[data-layout="sidebar"] .v2-nav-list{flex-direction:column;height:auto;gap:2px;padding:0 10px;max-width:none}
  html[data-layout="sidebar"] .v2-item{flex:auto}
  html[data-layout="sidebar"] .v2-link{width:100%;justify-content:flex-start;height:44px;border-radius:10px;padding:0 12px;gap:11px}
  html[data-layout="sidebar"] .v2-link span{flex:1;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  html[data-layout="sidebar"] .v2-link::after{display:none}
  html[data-layout="sidebar"] .v2-link:hover{background:var(--v2-surface-2)}
  html[data-layout="sidebar"] .v2-item.is-open>.v2-link,html[data-layout="sidebar"] .v2-item.is-active>.v2-link{background:var(--v2-primary-soft);color:var(--v2-primary-600)}
  html[data-layout="sidebar"] .v2-sec-icon{display:inline-block;width:20px;text-align:center;font-size:.95rem;opacity:.9}
  html[data-layout="sidebar"] .v2-chev{margin-left:auto}
  /* sections expand in place (accordion) instead of the floating panel */
  html[data-layout="sidebar"] .v2-panel{position:static;opacity:1;visibility:visible;transform:none;box-shadow:none;border:0;display:none;padding:2px 0 8px 10px;max-width:none;min-width:0;background:transparent;max-height:none!important;top:auto!important;left:auto!important}
  html[data-layout="sidebar"] .v2-item.is-open>.v2-panel{display:block}
  html[data-layout="sidebar"] .v2-panel.is-wide .v2-panel-grid{grid-template-columns:1fr}
  html[data-layout="sidebar"] .v2-panel-head{display:none}
  html[data-layout="sidebar"] .v2-panel a{padding:7px 10px 7px 12px;font-size:.82rem;animation:none}
  html[data-layout="sidebar"] .v2-panel a::before{width:5px;height:5px}
  html[data-layout="sidebar"] .v2-nav-scroll.has-more{box-shadow:none}
  html[data-layout="sidebar"] .v2-backdrop{display:none}

  /* collapsed: icons only, the section name shows as a tooltip; a click expands the sidebar again */
  html[data-layout="sidebar"].v2-sb-collapsed .v2-sb-title,html[data-layout="sidebar"].v2-sb-collapsed .v2-link span,html[data-layout="sidebar"].v2-sb-collapsed .v2-chev,html[data-layout="sidebar"].v2-sb-collapsed .v2-panel{display:none}
  html[data-layout="sidebar"].v2-sb-collapsed .v2-sb-head{justify-content:center;padding:0;flex-direction:column;height:auto;padding:10px 0}
  html[data-layout="sidebar"].v2-sb-collapsed .v2-link{justify-content:center;padding:0}
  html[data-layout="sidebar"].v2-sb-collapsed .v2-sec-icon{width:auto;font-size:1.05rem}
  html[data-layout="sidebar"].v2-sb-collapsed .v2-sb-toggle i{transform:rotate(180deg)}

  /* footer and print */
  html[data-layout="sidebar"] .v2-footer{margin-left:0}
}
@media print{html[data-layout="sidebar"] body{padding-left:0}html[data-layout="sidebar"] .v2-nav{display:none}}

/* sidebar head is only meaningful in the sidebar layout; in the top-bar layout and in the mobile drawer it stays hidden */
.v2-sb-head{display:none}
.v2-sb-toggle{display:none}
@media (max-width:991px){
  html[data-layout="sidebar"] .v2-sb-head{display:flex;align-items:center;gap:10px;padding:14px 16px 10px;border-bottom:1px solid var(--v2-border)}
  html[data-layout="sidebar"] .v2-sb-head img{height:34px;width:34px;border-radius:8px;background:#fff}
  html[data-layout="sidebar"] .v2-sb-title{display:flex;flex-direction:column;line-height:1.15;min-width:0}
  html[data-layout="sidebar"] .v2-sb-title b{font-size:.84rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  html[data-layout="sidebar"] .v2-sb-title span{font-size:.62rem;text-transform:uppercase;letter-spacing:.12em;color:var(--v2-muted);font-weight:700}
}

/* ---------- user menu (Profile > Theme, log out) shared by both layouts ---------- */
.v2-user{position:relative;cursor:pointer}
.v2-user-menu{position:absolute;right:0;top:calc(100% + 8px);min-width:230px;background:var(--v2-surface);border:1px solid var(--v2-border);border-radius:var(--v2-radius-sm);box-shadow:var(--v2-shadow-lg);padding:6px;z-index:1060;display:none}
.v2-user.is-open .v2-user-menu{display:block;animation:v2-rise .22s var(--v2-ease) both}
.v2-user-menu a{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:8px;color:var(--v2-text);font-size:.84rem;font-weight:500;text-decoration:none}
.v2-user-menu a:hover{background:var(--v2-primary-soft);color:var(--v2-primary-600);text-decoration:none}
.v2-user-menu a i{width:16px;text-align:center;color:var(--v2-muted)}
.v2-user-menu a:hover i{color:inherit}
.v2-user-menu .v2-user-menu-head{padding:8px 10px 10px;border-bottom:1px solid var(--v2-border);margin-bottom:4px;font-size:.72rem;color:var(--v2-text-2);line-height:1.3;word-break:break-all}
.v2-user-menu .v2-user-menu-head b{display:block;font-size:.62rem;text-transform:uppercase;letter-spacing:.12em;color:var(--v2-muted)}
.v2-user-menu a.is-danger:hover{background:rgba(220,38,38,.08);color:var(--v2-danger)}
.v2-user-caret{font-size:.6rem;color:var(--v2-muted);margin-right:4px}
@media (max-width:991px){.v2-user-menu{position:fixed;right:10px;left:auto;top:62px}}
