/* Top Nav */

.top-nav-wrapper {
  background: #1a1a1a;
  border-bottom: 1px solid #333;
  width: 100%;
  position: relative;
  z-index: 1000;
}

.top-header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 18px;
}

.menu-toggle-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}

.menu-toggle-btn:hover {
  opacity: 0.75;
}

@media (min-width: 769px) {
  .menu-toggle-btn {
    display: none;
  }
}

.nav-brand {
  margin-right: auto;
}

.nav-brand a {
  font-size: 21px;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  letter-spacing: 1.5px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.nav-auth {
  position: relative;
}

.user-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 2px solid #cbd5e1;
  color: #1e293b;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.user-avatar-btn:hover {
  transform: scale(1.04);
  border-color: #4ade80;
}

.user-initials {
  color: #1e293b;
  font-weight: 700;
}

.top-sub-nav {
  display: flex;
  gap: 18px;
  align-items: center;
}

.sub-nav-link {
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  transition: color 0.15s;
}

.sub-nav-link:hover {
  color: #4ade80;
}

/* Sidebar */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  z-index: 999998;
  opacity: 0;
  transition: opacity 0.2s;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

.sidebar-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 275px;
  height: 100%;
  background: #161616;
  border-right: 1px solid #2c2c2c;
  z-index: 999999;
  transition: left 0.28s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 5px 0 20px rgba(0, 0, 0, 0.55);
}

.sidebar-menu.open {
  left: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid #2a2a2a;
}

.sidebar-title {
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

.sidebar-close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.sidebar-close-btn:hover {
  color: #fff;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  color: #ccc;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: #222;
  color: #4ade80;
}

.sidebar-divider {
  height: 1px;
  background: #2a2a2a;
  margin: 8px 0;
}

/* User dropdown */

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 7px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
  min-width: 170px;
  z-index: 1001;
  flex-direction: column;
  overflow: hidden;
}

.user-dropdown.show {
  display: flex;
}

.dropdown-header {
  padding: 11px 14px;
  border-bottom: 1px solid #2d2d2d;
  background: #222;
}

.user-greeting {
  color: #888;
  font-size: 11px;
  display: block;
}

.username {
  color: #fff;
  font-size: 13px;
}

.dropdown-item {
  padding: 9px 14px;
  color: #ddd;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.dropdown-item:hover {
  background: #2a2a2a;
  color: #4ade80;
}

.logout-item {
  border-top: 1px solid #2d2d2d;
  color: #ef4444;
}

.logout-item:hover {
  background: #ef4444;
  color: #fff;
}

.nav-btn {
  padding: 5px 13px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.btn-login {
  background: #4ade80;
  color: #121212;
}

/* Desktop search */

.desktop-search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.desktop-search-input {
  background: #222;
  border: 1px solid #333;
  color: #fff;
  padding: 6px 12px 6px 32px;
  border-radius: 18px;
  font-size: 13px;
  outline: none;
  width: 230px;
  transition: border-color 0.15s, background 0.15s, width 0.25s;
}

.desktop-search-input:focus {
  border-color: #4ade80;
  background: #1a1a1a;
  width: 290px;
}

.desktop-search-icon {
  position: absolute;
  left: 11px;
  color: #888;
  pointer-events: none;
}

.search-dropdown-results {
  display: none;
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: min(400px, 92vw);
  min-width: 300px;
  max-height: 68vh;
  overflow: hidden;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7);
  z-index: 1005;
  flex-direction: column;
}

.search-dropdown-results.show {
  display: flex;
}

.search-dd-tabs {
  display: flex;
  gap: 2px;
  padding: 7px 7px 0;
  border-bottom: 1px solid #2a2a2a;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

.search-dd-tabs::-webkit-scrollbar {
  display: none;
}

.search-dd-tab {
  background: none;
  border: none;
  color: #888;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px 7px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.search-dd-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.search-dd-tab.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 -2px 0 #4ade80;
}

.search-dd-list {
  overflow-y: auto;
  max-height: calc(68vh - 90px);
  padding: 3px 0;
  flex: 1;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border-bottom: 1px solid #2d2d2d;
  text-decoration: none;
  color: #fff;
  transition: background 0.15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #2a2a2a;
}

.search-result-item img {
  width: 38px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  background: #333;
  flex-shrink: 0;
}

.search-result-item img.square {
  height: 38px;
  border-radius: 5px;
}

.search-result-item .avatar-fallback {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #4ade80;
  color: #121212;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.search-result-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.search-result-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  font-size: 12px;
  color: #888;
}

.search-loading {
  padding: 18px 14px;
  text-align: center;
  color: #888;
  font-size: 13px;
}

.search-dd-footer {
  border-top: 1px solid #2a2a2a;
  padding: 9px 13px;
  flex-shrink: 0;
}

.search-dd-footer a {
  color: #4ade80;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.search-dd-footer a:hover {
  text-decoration: underline;
}

/* Mobile */

.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .top-sub-nav,
  .desktop-search-container {
    display: none;
  }

  .top-header-main {
    position: relative;
    justify-content: space-between;
  }

  .nav-brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin-right: 0;
  }

  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: #181818;
    border-top: 1px solid #2a2a2a;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 99999;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #888;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    flex: 1;
    height: 100%;
  }

  .bottom-nav-item:hover,
  .bottom-nav-item.active {
    color: #fff;
  }

  .bottom-nav-item svg {
    stroke: currentColor;
  }

  body {
    padding-bottom: 62px;
  }
}