/* ========================================
   ContentHub Sidebar Navigation
   ======================================== */

/* --- Top Header Bar --- */
.ch-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #fff;
  z-index: 1040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

body.night-mode .ch-topbar,
[data-bs-theme="dark"] .ch-topbar {
  background: #1e1e2d;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

.ch-topbar-hamburger {
  position: absolute;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
  transition: background .2s ease;
  padding: 0;
  color: #333;
  font-size: 22px;
}

body.night-mode .ch-topbar-hamburger,
[data-bs-theme="dark"] .ch-topbar-hamburger {
  color: #e0e0e0;
}

.ch-topbar-hamburger:hover {
  background: rgba(0,0,0,.06);
}

body.night-mode .ch-topbar-hamburger:hover,
[data-bs-theme="dark"] .ch-topbar-hamburger:hover {
  background: rgba(255,255,255,.1);
}

.ch-topbar-logo {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  text-decoration: none !important;
  letter-spacing: -.3px;
  white-space: nowrap;
}

.ch-topbar-logo:hover {
  color: #1a1a2e;
  text-decoration: none !important;
}

body.night-mode .ch-topbar-logo,
[data-bs-theme="dark"] .ch-topbar-logo {
  color: #f0f0f0;
}

body.night-mode .ch-topbar-logo:hover,
[data-bs-theme="dark"] .ch-topbar-logo:hover {
  color: #f0f0f0;
}

/* --- Sidebar Overlay --- */
.ch-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1049;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
  -webkit-tap-highlight-color: transparent;
}

.ch-sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* --- Sidebar Panel --- */
.ch-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: #fff;
  z-index: 1050;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,.15);
  overflow: hidden;
}

body.night-mode .ch-sidebar,
[data-bs-theme="dark"] .ch-sidebar {
  background: #1e1e2d;
  box-shadow: 4px 0 24px rgba(0,0,0,.4);
}

.ch-sidebar.open {
  transform: translateX(0);
}

/* --- Sidebar Header --- */
.ch-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  flex-shrink: 0;
}

body.night-mode .ch-sidebar-header,
[data-bs-theme="dark"] .ch-sidebar-header {
  border-bottom-color: rgba(255,255,255,.08);
}

.ch-sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ch-sidebar-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.ch-sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ch-sidebar-username {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  text-decoration: none !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.night-mode .ch-sidebar-username,
[data-bs-theme="dark"] .ch-sidebar-username {
  color: #f0f0f0;
}

.ch-sidebar-username:hover {
  color: #ee848e;
}

.ch-sidebar-signout {
  font-size: 12px;
  color: #999;
  text-decoration: none !important;
}

.ch-sidebar-signout:hover {
  color: #ee848e;
}

.ch-sidebar-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0,0,0,.05);
  border-radius: 8px;
  cursor: pointer;
  color: #666;
  font-size: 14px;
  flex-shrink: 0;
  transition: background .2s ease, color .2s ease;
}

body.night-mode .ch-sidebar-close,
[data-bs-theme="dark"] .ch-sidebar-close {
  background: rgba(255,255,255,.1);
  color: #ccc;
}

.ch-sidebar-close:hover {
  background: rgba(0,0,0,.1);
  color: #333;
}

/* --- Sidebar Body --- */
.ch-sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0;
}

/* --- Sidebar Nav Links --- */
.ch-sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ch-sidebar-nav li {
  margin: 0;
  padding: 0;
}

.ch-sidebar-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  text-decoration: none !important;
  transition: background .15s ease, color .15s ease;
  cursor: pointer;
}

body.night-mode .ch-sidebar-link,
[data-bs-theme="dark"] .ch-sidebar-link {
  color: #d0d0d0;
}

.ch-sidebar-link:hover {
  background: rgba(0,0,0,.04);
  color: #1a1a2e;
}

body.night-mode .ch-sidebar-link:hover,
[data-bs-theme="dark"] .ch-sidebar-link:hover {
  background: rgba(255,255,255,.06);
  color: #f0f0f0;
}

.ch-sidebar-link.active {
  background: rgba(0,0,0,.04);
  color: #1a1a2e;
  font-weight: 600;
}

body.night-mode .ch-sidebar-link.active,
[data-bs-theme="dark"] .ch-sidebar-link.active {
  background: rgba(255,255,255,.08);
  color: #f0f0f0;
}

.ch-sidebar-link i {
  width: 22px;
  text-align: center;
  font-size: 17px;
  color: #666;
  flex-shrink: 0;
}

body.night-mode .ch-sidebar-link i,
[data-bs-theme="dark"] .ch-sidebar-link i {
  color: #999;
}

.ch-sidebar-link:hover i {
  color: #333;
}

body.night-mode .ch-sidebar-link:hover i,
[data-bs-theme="dark"] .ch-sidebar-link:hover i {
  color: #ccc;
}

/* Top Up highlighted */
.ch-sidebar-topup {
  background: linear-gradient(135deg, #fef9e7, #fef3cd) !important;
  color: #b8860b !important;
  font-weight: 600;
  margin: 4px 10px;
  border-radius: 12px !important;
  padding: 12px 16px;
}

body.night-mode .ch-sidebar-topup,
[data-bs-theme="dark"] .ch-sidebar-topup {
  background: linear-gradient(135deg, rgba(184,134,11,.15), rgba(184,134,11,.1)) !important;
  color: #f0c040 !important;
}

.ch-sidebar-topup:hover {
  background: linear-gradient(135deg, #fef3cd, #fde68a) !important;
  color: #9a7209 !important;
}

.ch-sidebar-topup i {
  color: #daa520 !important;
}

/* Logout link */
.ch-sidebar-logout {
  color: #cc4444 !important;
}

.ch-sidebar-logout i {
  color: #cc4444 !important;
}

/* Divider */
.ch-sidebar-divider {
  height: 1px;
  background: rgba(0,0,0,.06);
  margin: 8px 16px;
}

body.night-mode .ch-sidebar-divider,
[data-bs-theme="dark"] .ch-sidebar-divider {
  background: rgba(255,255,255,.08);
}

/* Guest actions */
.ch-sidebar-guest-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

/* --- Override: hide old main-header --- */
.main-header {
  display: none !important;
}

/* --- Body offset for new top bar --- */
body {
  padding-top: 56px !important;
}

/* Body scroll lock when sidebar open */
body.ch-sidebar-open {
  overflow: hidden !important;
}

/* --- Mobile tweaks --- */
@media (max-width: 767px) {
  .ch-topbar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 2px 12px rgba(0,0,0,.2);
  }

  .ch-topbar-hamburger {
    color: rgba(255,255,255,.9);
  }

  .ch-topbar-hamburger:hover {
    background: rgba(255,255,255,.1);
  }

  .ch-topbar-logo {
    color: #fff;
    font-size: 18px;
  }

  .ch-topbar-logo:hover {
    color: #fff;
  }
}

/* Desktop tweaks */
@media (min-width: 768px) {
  .ch-topbar {
    padding: 0 24px;
  }
  .ch-topbar-hamburger {
    left: 24px;
  }
  .ch-topbar-logo {
    font-size: 22px;
  }
}

/* Chat sidebar offset on desktop */
@media (min-width: 1200px) {
  body:not(.n_chat) .ch-topbar {
    padding-right: 75px;
  }
  body:not(.n_chat) .main-wrapper {
    padding-right: 75px;
  }
  body:not(.n_chat) .ch-public-nav {
    margin-right: -75px;
  }
}

body.n_chat .ch-topbar {
  padding-right: 0;
}

/* Reels sidebar button — highlighted like Top Up */
.ch-sidebar-reels {
  background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045) !important;
  color: #fff !important;
  font-weight: 600;
  margin: 4px 10px;
  border-radius: 12px !important;
  padding: 12px 16px;
  box-shadow: 0 2px 10px rgba(253, 29, 29, .25);
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.ch-sidebar-reels i {
  color: #fff !important;
}
.ch-sidebar-reels:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(253, 29, 29, .35);
  color: #fff !important;
  opacity: .95;
}
body.night-mode .ch-sidebar-reels,
[data-bs-theme="dark"] .ch-sidebar-reels {
  background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045) !important;
  color: #fff !important;
  box-shadow: 0 2px 12px rgba(253, 29, 29, .3);
}
