/* ================= LEFT GLASSMORPHISM SIDEBAR (HOVER TO EXPAND) ================= */
:root {
  --sidebar-h: min(calc(100vh - 118px), clamp(510px, 78vh, 710px));
}

.floating-theme-dock {
  position: fixed;
  left: 18px;
  width: 72px;
  bottom: calc(50% - 26px + (var(--sidebar-h) / 2) + 14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 605;
  pointer-events: none;
}

.sun-moon-toggle {
  pointer-events: auto;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 9999px;
  overflow: hidden;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.78);
  background: #090f2a;
  box-shadow:
    0 10px 26px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(15, 23, 42, 0.12),
    inset 0 1px 1px rgba(255, 255, 255, 0.45);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), filter 0.25s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  outline: none;
}

body.dark-mode .sun-moon-toggle {
  border-color: #34343f;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.92),
    0 0 0 1.5px #000000,
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.sun-moon-toggle:hover {
  transform: translateY(-2px) scale(1.05);
  filter: brightness(1.08);
}

.sun-moon-toggle:active {
  transform: translateY(0) scale(0.96);
}

.sun-moon-toggle-mobile {
  width: 40px;
  height: 40px;
}

.sm-sky {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: -1;
}

.sm-sky-night {
  background: linear-gradient(180deg, #090f2a 0%, #16204b 60%, #2a2f66 100%);
  opacity: 0;
}

.sm-sky-day {
  background: linear-gradient(180deg, #4ea8ff 0%, #9fd3ff 60%, #e3f3ff 100%);
  opacity: 1;
}

.sm-star {
  position: absolute;
  border-radius: 9999px;
  background: #ffffff;
  opacity: 0.65;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
}

.sm-body {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform, opacity;
}

.sm-body-moon {
  color: #fde68a;
  filter: drop-shadow(0 0 8px rgba(252, 211, 77, 0.65));
  opacity: 0;
  transform: translate(-42%, 115%);
}

.sm-body-sun {
  color: #fb923c;
  filter: drop-shadow(0 0 10px rgba(251, 146, 60, 0.75));
  opacity: 1;
  transform: none;
}

.sm-icon {
  width: 50%;
  height: 50%;
  display: block;
}

/* Smooth synchronized View Transition for Light <-> Dark theme switch */
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: none !important;
}

#themeToggleBtn {
  view-transition-name: sun-moon-toggle-desktop;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 460ms;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  mix-blend-mode: normal;
}

::view-transition-old(sun-moon-toggle-desktop),
::view-transition-new(sun-moon-toggle-desktop) {
  animation: none;
}

.top-nav-card {
  position: fixed;
  top: calc(50% + 26px);
  left: 18px;
  bottom: auto;
  transform: translateY(-50%);
  width: 72px;
  height: var(--sidebar-h);
  max-height: var(--sidebar-h);
  z-index: 600;
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.84) 0%,
    rgba(248, 250, 252, 0.76) 50%,
    rgba(254, 226, 226, 0.68) 100%
  );
  backdrop-filter: blur(26px) saturate(175%);
  -webkit-backdrop-filter: blur(26px) saturate(175%);
  padding: 18px 11px;
  border-radius: 26px;
  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.1),
    0 4px 16px rgba(239, 68, 68, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.65);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  gap: 8px;
  overflow: hidden;
  transition:
    width 0.62s cubic-bezier(0.25, 0.8, 0.25, 1),
    background 0.4s ease,
    box-shadow 0.62s cubic-bezier(0.25, 0.8, 0.25, 1),
    border-color 0.4s ease;
}

body.dark-mode .top-nav-card {
  background: linear-gradient(
    165deg,
    rgba(16, 16, 20, 0.92) 0%,
    rgba(8, 8, 10, 0.94) 55%,
    rgba(12, 12, 15, 0.92) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.92),
    0 4px 22px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.top-nav-card:hover {
  width: 256px;
  box-shadow:
    0 28px 68px rgba(15, 23, 42, 0.18),
    0 8px 26px rgba(239, 68, 68, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

body.dark-mode .top-nav-card:hover {
  border-color: rgba(255, 255, 255, 0.26);
  box-shadow:
    0 30px 75px rgba(0, 0, 0, 0.92),
    0 8px 28px rgba(255, 255, 255, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

/* Cột cố định 46px bên trái (= 72px - 2*1px border card - 2*11px padding card - 2*1px border item) để icon nằm chính giữa tuyệt đối */
.nav-icon-slot {
  width: 46px;
  min-width: 46px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

/* Navigation Items List */
.nav-pills {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  flex: 0 0 auto;
  margin: 0;
}

/* Thanh nền & vạch sáng trượt dọc mượt mà khi chuyển tab */
.nav-active-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  border-radius: 14px;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    90deg,
    rgba(239, 68, 68, 0.16) 0%,
    rgba(239, 68, 68, 0.05) 100%
  );
  border: 1px solid rgba(239, 68, 68, 0.24);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.12);
  transition:
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
  will-change: transform;
}

.nav-active-indicator.is-instant {
  transition: none !important;
}

body.dark-mode .nav-active-indicator {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.nav-active-indicator::before {
  content: '';
  position: absolute;
  left: -11px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  border-radius: 0 6px 6px 0;
  background: var(--primary-red);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.75);
}

body.dark-mode .nav-active-indicator::before {
  background: #ffffff;
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.9),
    0 0 20px rgba(255, 255, 255, 0.45);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  height: 44px;
  background: transparent;
  border: 1px solid transparent;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: 14px;
  cursor: pointer;
  transition:
    background-color 0.22s ease,
    color 0.22s ease;
  position: relative;
  z-index: 2;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(148, 163, 184, 0.12);
}

body.dark-mode .nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active,
.nav-item.active:hover {
  color: var(--primary-red);
  font-weight: 800;
  background: transparent;
}

body.dark-mode .nav-item.active,
body.dark-mode .nav-item.active:hover {
  color: #ffffff;
  background: transparent;
}

.nav-item.active::after {
  display: none;
}

.nav-item-label {
  opacity: 0;
  transform: translateX(-10px);
  transition:
    opacity 0.28s ease,
    transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
  pointer-events: none;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-nav-card:hover .nav-item-label {
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.42s ease 0.08s,
    transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1) 0.04s;
  pointer-events: auto;
}

.nav-item-arrow {
  margin-left: auto;
  padding-right: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0;
  transform: translateX(-6px);
  transition:
    opacity 0.28s ease,
    transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1),
    color 0.2s ease;
}

.top-nav-card:hover .nav-item-arrow {
  opacity: 0.55;
  transform: translateX(0);
  transition:
    opacity 0.42s ease 0.1s,
    transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1) 0.06s,
    color 0.2s ease;
}

.top-nav-card:hover .nav-item.active .nav-item-arrow,
.top-nav-card:hover .nav-item:hover .nav-item-arrow,
.top-nav-card:hover .theme-toggle-btn:hover .nav-item-arrow {
  opacity: 1;
  color: currentColor;
  transform: translateX(2px);
}

/* ================= LIVE PULSE BADGE IN SIDEBAR ================= */
.live-pulse-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 14px;
  height: 14px;
}

.live-pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 8px #ef4444;
}

.live-pulse-badge::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.45);
  animation: liveRipple 1.6s infinite ease-out;
}

@keyframes liveRipple {
  0% {
    transform: scale(0.6);
    opacity: 1;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.nav-mobile-header {
  display: none;
}

.hamburger-menu-btn {
  display: none;
}

/* Bottom Footer Block (Restock Timer + Theme Toggle + Account Card) */
.nav-right {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}

.restock-icon-slot {
  flex-direction: column;
  gap: 2px;
}

.nav-icon-slot .bot-nav-emoji,
.nav-icon-slot .bot-status-emoji {
  display: block;
  margin: 0;
}

.restock-mini-time {
  font-size: 0.56rem;
  font-weight: 800;
  font-family: monospace;
  color: var(--primary-red);
  line-height: 1;
  letter-spacing: -0.3px;
  text-align: center;
  width: 100%;
  transition: opacity 0.35s ease, max-height 0.4s ease;
  max-height: 12px;
}

body.dark-mode .restock-mini-time {
  color: #fca5a5;
}

.top-nav-card:hover .restock-mini-time {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
}

.restock-text-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  padding-right: 14px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-10px);
  transition:
    opacity 0.28s ease,
    transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
  pointer-events: none;
}

.top-nav-card:hover .restock-text-wrap {
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.42s ease 0.08s,
    transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1) 0.04s;
  pointer-events: auto;
}

.theme-toggle-btn {
  background: transparent;
  border: 1px solid transparent;
  width: 100%;
  height: 40px;
  padding: 0;
  border-radius: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.theme-toggle-btn:hover {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-primary);
}

body.dark-mode .theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.theme-toggle-icon {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: transform 0.25s ease;
}

.theme-toggle-btn:hover .theme-toggle-icon {
  transform: rotate(20deg) scale(1.08);
}

.theme-toggle-text {
  opacity: 0;
  transform: translateX(-10px);
  transition:
    opacity 0.28s ease,
    transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
  pointer-events: none;
  flex: 1;
  text-align: left;
}

.top-nav-card:hover .theme-toggle-text {
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.42s ease 0.08s,
    transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1) 0.04s;
  pointer-events: auto;
}

.sidebar-account-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 14px;
  white-space: nowrap;
  transition: background-color 0.22s ease;
}

.top-nav-card:hover .sidebar-account-row {
  background: rgba(148, 163, 184, 0.08);
}

body.dark-mode .top-nav-card:hover .sidebar-account-row {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-account-avatar-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-flex;
}

.sidebar-account-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
}

.sidebar-online-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
}

.sidebar-account-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  opacity: 0;
  transform: translateX(-10px);
  transition:
    opacity 0.28s ease,
    transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.top-nav-card:hover .sidebar-account-info {
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.42s ease 0.08s,
    transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1) 0.04s;
}

.sidebar-account-name {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-account-role {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.sidebar-account-role .anime-emoji {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-left: 2px;
  display: inline-block;
}

/* ================= SIDEBAR AUTH & USER SECTION ================= */
.sidebar-auth-section {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}

.sidebar-login-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(88, 101, 242, 0.25);
  background: rgba(88, 101, 242, 0.08);
  border-radius: 14px;
  text-decoration: none;
  color: #5865F2;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.22s ease, border-color 0.22s ease, transform 0.2s ease;
}

body.dark-mode .sidebar-login-link {
  background: rgba(88, 101, 242, 0.16);
  border-color: rgba(88, 101, 242, 0.4);
  color: #7983f5;
}

.sidebar-login-link:hover {
  background: rgba(88, 101, 242, 0.18);
  border-color: rgba(88, 101, 242, 0.55);
}

body.dark-mode .sidebar-login-link:hover {
  background: rgba(88, 101, 242, 0.28);
  border-color: rgba(88, 101, 242, 0.7);
}

.discord-login-icon-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(88, 101, 242, 0.15);
  color: #5865F2;
}

body.dark-mode .discord-login-icon-slot {
  color: #7983f5;
  background: rgba(88, 101, 242, 0.25);
}

.sidebar-login-text-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  opacity: 0;
  transform: translateX(-10px);
  transition:
    opacity 0.28s ease,
    transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
  pointer-events: none;
}

.top-nav-card:hover .sidebar-login-text-wrap {
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.42s ease 0.08s,
    transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1) 0.04s;
  pointer-events: auto;
}

.sidebar-login-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #5865F2;
  line-height: 1.2;
}

body.dark-mode .sidebar-login-label {
  color: #8a93ff;
}

.sidebar-login-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.sidebar-user-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.sidebar-user-main {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 14px;
  white-space: nowrap;
  transition: background-color 0.22s ease;
}

.top-nav-card:hover .sidebar-user-main {
  background: rgba(148, 163, 184, 0.08);
}

body.dark-mode .top-nav-card:hover .sidebar-user-main {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 32px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  color: #ef4444;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    background 0.2s ease,
    color 0.2s ease;
}

body.dark-mode .sidebar-logout-btn {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.top-nav-card:hover .sidebar-logout-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.sidebar-logout-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

body.dark-mode .sidebar-logout-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* Mobile actions icons for auth */
.mobile-login-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(88, 101, 242, 0.12);
  border: 1px solid rgba(88, 101, 242, 0.3);
  color: #5865F2;
  text-decoration: none;
  box-shadow: var(--shadow-subtle);
  transition: all 0.2s ease;
}

body.dark-mode .mobile-login-icon-btn {
  background: rgba(88, 101, 242, 0.22);
  color: #7983f5;
}

.mobile-user-avatar-wrap {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.mobile-user-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

