/* ============================================================================
   RP2 REPORT — LEFT SIDEBAR  (CaMell v6.8 structure × v6.3 Liquid Glass skin)
   ----------------------------------------------------------------------------
   Load AFTER liquidglass.css (uses its :root tokens, with fallbacks).
   Structure (leader.html):  .shell > .sidebar + .sidebar-mask + .main
   v6.8 semantics kept EXACT:
     • collapsible 224px (w-56) ↔ 56px (w-14), transition 300ms
     • logo head h-14 · section headers 10px bold uppercase tracking-wider
     • .sidebar-item = icon-tile + label + metric · hover slide · active glow
     • footer collapse toggle (← / →)
   Mobile <900px: off-canvas drawer (hamburger #btn-burger + .sidebar-mask).
   ============================================================================ */

/* ============================ 1. SHELL LAYOUT ============================ */
.shell {
  display: flex;
  align-items: stretch;
  min-height: 100dvh;
}
.shell > .main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ============================ 2. SIDEBAR FRAME =========================== */
.sidebar {
  --side-w: 224px;      /* v6.8 w-56 */
  --side-w-min: 56px;   /* v6.8 w-14 */
  width: var(--side-w);
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* frosted translucent glass — bg image peeks through */
  background: var(--glass-bg, rgba(16, 24, 38, .48));
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border-right: 1px solid var(--lg-border-subtle, rgba(255, 255, 255, .19));
  box-shadow: var(--shadow-deep, 0 8px 24px rgba(0, 0, 0, .42));
  transition: width 300ms var(--ease, cubic-bezier(.22, .61, .36, 1));
}
.sidebar.is-collapsed { width: var(--side-w-min); }

/* ---- logo head (v6.8 h-14 + border-b white/5) ---- */
.sidebar__head {
  height: 56px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar__logo {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--r-md, 10px);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(160deg, var(--accent, #60AFFF), var(--lg-cyan, #00E8FF));
  box-shadow: 0 4px 14px rgba(96, 175, 255, .35);
}
.sidebar__title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text, #FAFAFF);
}
.sidebar__title span {
  background: linear-gradient(90deg, var(--accent, #60AFFF), var(--lg-cyan, #00E8FF));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent, #60AFFF);
}

/* ---- nav column ---- */
.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* section headers — v6.8: 10px bold uppercase tracking-wider */
.sidebar-section {
  padding: 12px 8px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--lg-cyan, #00E8FF);
  opacity: .8;
  white-space: nowrap;
}

/* ============================ 3. SIDEBAR ITEM ============================ */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--r-md, 10px);
  background: transparent;
  color: var(--text-3, #CCD0E8);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 250ms var(--ease, ease),
    color 250ms var(--ease, ease),
    border-color 250ms var(--ease, ease),
    box-shadow 250ms var(--ease, ease),
    transform 250ms var(--lg-spring, cubic-bezier(.34, 1.56, .64, 1));
}

/* icon tile per item (v6.8 icon slot → glass tile) */
.sidebar-item .icon-tile {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1;
  background: rgba(255, 255, 255, .09);
  border: 1px solid var(--lg-border-subtle, rgba(255, 255, 255, .19));
  transition:
    background 250ms var(--ease, ease),
    border-color 250ms var(--ease, ease),
    box-shadow 250ms var(--ease, ease);
}
.sidebar-item__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-item__metric {
  font-size: 10px;
  color: var(--text-3, #CCD0E8);
  opacity: .85;
}

/* hover — white-alpha fill + slide right */
.sidebar-item:hover {
  background: rgba(255, 255, 255, .09);
  color: var(--text, #FAFAFF);
  transform: translateX(3px);
}
.sidebar-item:hover .icon-tile { border-color: var(--glass-hi, rgba(255, 255, 255, .33)); }
.sidebar-item:active { transform: translateX(3px) scale(.97); }

/* active — neon glow (v6.8 gradient → v6.3 translucent accent gradient) */
.sidebar-item-active,
.sidebar-item-active:hover {
  background: linear-gradient(90deg, rgba(96, 175, 255, .22), rgba(0, 232, 255, .10));
  border-color: rgba(255, 255, 255, .33);
  color: var(--text, #FAFAFF);
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(96, 175, 255, .3), 0 0 3px rgba(0, 232, 255, .25);
  transform: none;
}
.sidebar-item-active .icon-tile {
  background: linear-gradient(160deg, var(--accent, #60AFFF), var(--lg-cyan, #00E8FF));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 232, 255, .35);
}
.sidebar-item-active .sidebar-item__metric { color: var(--accent-2, #7DB5FF); opacity: 1; }

/* ---- footer collapse toggle ---- */
.sidebar__foot {
  flex: 0 0 auto;
  padding: 8px 6px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

/* ============================ 4. COLLAPSED (w-14) ======================== */
.sidebar.is-collapsed .sidebar__title,
.sidebar.is-collapsed .sidebar-section,
.sidebar.is-collapsed .sidebar-item__label,
.sidebar.is-collapsed .sidebar-item__metric { display: none; }
.sidebar.is-collapsed .sidebar__head { justify-content: center; padding: 0; }
.sidebar.is-collapsed .sidebar-item { justify-content: center; padding: 6px 0; }
.sidebar.is-collapsed .sidebar-item:hover,
.sidebar.is-collapsed .sidebar-item:active { transform: none; }

/* hover auto-bung khi đang thu gọn (v6.3) — chỉ desktop có chuột, KHÔNG đụng touch */
@media (hover: hover) and (min-width: 900px) {
  .sidebar.is-collapsed:hover { width: var(--side-w); }
  .sidebar.is-collapsed:hover .sidebar__title { display: inline; }
  .sidebar.is-collapsed:hover .sidebar-section { display: block; }
  .sidebar.is-collapsed:hover .sidebar-item__label,
  .sidebar.is-collapsed:hover .sidebar-item__metric { display: inline-block; }
  .sidebar.is-collapsed:hover .sidebar__head { justify-content: flex-start; padding: 0 12px; }
  .sidebar.is-collapsed:hover .sidebar-item { justify-content: flex-start; padding: 6px 8px; }
}

/* v6.8 AUTO đóng/mở (desktop): thu gọn = rail cố định 56px, hover BUNG ĐÈ lên nội dung (overlay, KHÔNG đẩy layout). Mobile <900px dùng drawer riêng bên dưới. */
@media (min-width: 900px) {
  .sidebar.is-collapsed { position: fixed; left: 0; top: 0; height: 100dvh; z-index: 60; }
  .shell:has(> .sidebar.is-collapsed) > .main { margin-left: 56px; }
  .sidebar.is-collapsed:hover { box-shadow: 8px 0 44px rgba(0, 0, 0, .5); }
}
.cover-more { cursor: pointer; font: inherit; -webkit-appearance: none; appearance: none; }
.cover-missnames { display: contents; }
.cover-missnames.hidden { display: none; }

/* ============================ 5. MOBILE DRAWER <900px ==================== */
.sidebar-mask { display: none; }
#btn-burger { display: none; }

@media (max-width: 899.98px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100dvh;
    width: var(--side-w) !important;         /* drawer ignores collapse */
    z-index: 80;
    transform: translateX(-105%);
    transition: transform 300ms var(--ease-out, cubic-bezier(.16, 1, .3, 1));
    box-shadow: var(--shadow-lift, 0 12px 36px rgba(0, 0, 0, .5));
  }
  .shell.side-open .sidebar { transform: none; }

  .sidebar-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(6, 9, 18, .55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms var(--ease, ease);
  }
  .shell.side-open .sidebar-mask { opacity: 1; pointer-events: auto; }

  #btn-burger { display: inline-flex; }

  /* drawer always shows full labels even if collapse state was saved */
  .sidebar.is-collapsed .sidebar__title { display: inline; }
  .sidebar.is-collapsed .sidebar-section { display: block; }
  .sidebar.is-collapsed .sidebar-item__label,
  .sidebar.is-collapsed .sidebar-item__metric { display: inline-block; }
  .sidebar.is-collapsed .sidebar__head { justify-content: flex-start; padding: 0 12px; }
  .sidebar.is-collapsed .sidebar-item { justify-content: flex-start; padding: 6px 8px; }
}

/* ============================ 6. REDUCED MOTION ========================== */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-item, .sidebar-item .icon-tile, .sidebar-mask { transition: none; }
  .sidebar-item:hover, .sidebar-item:active { transform: none; }
}
