/* ── Expandable Sidebar & Topbar ─────────────────────────────────────────── */

/* ── Sidebar shell ────────────────────────────────────────────────────────── */
.dash-sidebar {
  width: 68px;
  background: rgba(var(--rgb-med-dark), 0.75);
  backdrop-filter: var(--blur-xl);
  -webkit-backdrop-filter: var(--blur-xl);
  border-right: 1px solid rgba(var(--rgb-light), 0.1);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 1.25rem 0 1rem;
  position: relative;
  z-index: var(--z-fixed-nav);
  overflow: hidden;
  flex-shrink: 0;
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.dash-sidebar:hover { width: 220px; }

/* ── User identity card (top of sidebar) ─────────────────────────────────── */
/* Reuses exp-tab base — gets hover animation for free, zero extra CSS needed */
.user-card {
  margin: 0 8px 1rem !important;
  border: 1px solid rgba(78, 204, 163, 0.22);
  background: rgba(78, 204, 163, 0.08) !important;
  color: rgba(var(--rgb-light), 0.85) !important;
  height: 44px !important;
}
.user-card:hover {
  background: rgba(78, 204, 163, 0.15) !important;
  color: #4ecca3 !important;
}

/* Circular avatar: shows photo via background-image, or initial letter */
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  font-family: var(--font-heading);
  background-color: rgba(78, 204, 163, 0.2);
  background-size: cover;
  background-position: center;
  color: #4ecca3;
  overflow: hidden;
}

/* ── Nav wrapper ──────────────────────────────────────────────────────────── */
.exp-tabs-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  padding: 0 8px;
  overflow: hidden;
}
.exp-tabs-foot { flex: 0; padding-bottom: 4px; }
.exp-separator {
  height: 1px;
  margin: 6px 12px;
  background: rgba(var(--rgb-light), 0.1);
  flex-shrink: 0;
}

/* ── Individual tab ───────────────────────────────────────────────────────── */
.exp-tab {
  display: flex;
  align-items: center;
  height: 42px;
  border-radius: 11px;
  padding: 0 11px;
  color: rgba(var(--rgb-light), 0.5);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease;
}
.exp-tab:hover {
  background: rgba(var(--rgb-light), 0.07);
  color: rgba(var(--rgb-light), 0.9);
}
.exp-tab.active {
  background: rgba(78, 204, 163, 0.13);
  color: #4ecca3;
}

/* ── Icon ─────────────────────────────────────────────────────────────────── */
.exp-icon { flex-shrink: 0; width: 20px; height: 20px; }

/* ── Label — hidden by default, slides in when sidebar expands ────────────── */
.exp-label {
  font-size: 0.84rem;
  font-weight: 500;
  font-family: var(--font-ui);
  letter-spacing: 0.01em;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  margin-left: 0;
  transition:
    max-width   0.45s cubic-bezier(0.4, 0, 0.2, 1),
    opacity     0.3s  ease 0.08s,
    margin-left 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.dash-sidebar:hover .exp-label {
  max-width: 160px;
  opacity: 1;
  margin-left: 10px;
}

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.dash-header {
  height: auto;
  min-height: 56px;
  margin: 10px 10px 0;
  padding: 0 1.25rem;
  border-radius: 14px;
  background: rgba(var(--rgb-med-dark), 0.55);
  border: 1px solid rgba(var(--rgb-light), 0.1);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 1rem;
}
.dash-header .header-left,
.dash-header .header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: rgba(var(--rgb-light), 0.65);
}

/* ── Mobile: sticky bottom bar ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .dash-body {
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .dash-sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow: visible;
    padding: 6px 10px;
    border-right: none;
    border-top: 1px solid rgba(var(--rgb-light), 0.1);
    position: sticky;
    bottom: 0;
    order: 99;
    gap: 4px;
    transition: none;
  }
  .dash-sidebar:hover { width: 100%; }

  /* Hide user card on mobile — perfil accessible via footer nav tab */
  .user-card { display: none !important; }

  .exp-tabs-nav {
    flex-direction: row;
    flex: 1;
    gap: 3px;
    padding: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .exp-tabs-nav::-webkit-scrollbar { display: none; }

  .exp-tab {
    height: 38px;
    padding: 0 10px;
    border-radius: 10px;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
  }

  /* Labels hidden on mobile; JS adds .expanded on click */
  .exp-label {
    max-width: 0;
    opacity: 0;
    margin-left: 0;
    transition:
      max-width   0.4s  cubic-bezier(0.34, 1.2, 0.64, 1),
      opacity     0.25s ease 0.08s,
      margin-left 0.4s  cubic-bezier(0.34, 1.2, 0.64, 1);
  }
  /* Override desktop hover rule on mobile */
  .dash-sidebar:hover .exp-label { max-width: 0; opacity: 0; margin-left: 0; }

  /* Click-to-expand on mobile */
  .dash-sidebar .exp-tab.expanded .exp-label,
  .dash-sidebar .exp-tab.active   .exp-label {
    max-width: 110px !important;
    opacity: 1 !important;
    margin-left: 8px !important;
  }

  .exp-separator,
  .exp-tabs-foot { display: none; }

  .dash-main { flex: 1; height: auto; overflow-y: auto; overflow-x: hidden; }
  .dash-header { margin: 8px 8px 0; min-height: 48px; border-radius: 12px; }
  .dash-grid-container { padding: 0.75rem; overflow: visible; }
}

/* ── Page transitions ─────────────────────────────────────────────────────── */
.dash-body {
    opacity: 0;
    transition: opacity 0.28s ease;
}
.dash-body.page-ready {
    opacity: 1;
}
.dash-body.page-leaving {
    opacity: 0 !important;
    transition: opacity 0.2s ease !important;
    pointer-events: none;
}

/* ── Topbar pills (XP / streak) ───────────────────────────────────────────── */
.topbar-pills {
    display: flex;
    gap: 6px;
    align-items: center;
}
.topbar-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.01em;
    font-family: var(--font-ui);
}
.xp-pill {
    color: #4ecca3;
    background: rgba(78, 204, 163, 0.1);
    border: 1px solid rgba(78, 204, 163, 0.18);
}
.streak-pill {
    color: #f97316;
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.18);
}
[data-theme="light"] .xp-pill {
    color: #2aab82;
    background: rgba(78, 204, 163, 0.1);
    border-color: rgba(78, 204, 163, 0.3);
}
[data-theme="light"] .streak-pill {
    color: #c2410c;
    background: rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.2);
}

/* ── Light theme ──────────────────────────────────────────────────────────── */
[data-theme="light"] .dash-sidebar {
  background: rgba(255, 255, 255, 0.85);
  border-right-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .exp-tab        { color: rgba(0, 0, 0, 0.45); }
[data-theme="light"] .exp-tab:hover  { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.8); }
[data-theme="light"] .exp-tab.active { background: rgba(78,204,163,0.12); color: #2aab82; }
[data-theme="light"] .exp-separator  { background: rgba(0, 0, 0, 0.08); }
[data-theme="light"] .user-card      { background: rgba(78,204,163,0.08) !important; border-color: rgba(78,204,163,0.3); }
[data-theme="light"] .user-card:hover { background: rgba(78,204,163,0.15) !important; }
[data-theme="light"] .user-avatar    { background-color: rgba(78,204,163,0.15); color: #2aab82; }
[data-theme="light"] .dash-header    { background: rgba(255,255,255,0.75); border-color: rgba(0,0,0,0.08); }
