/* ============================================
   EduNaija — layout.css
   Top bar, sidebar, hamburger, overlay, pages
   ============================================ */

/* ── APP SHELL ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* ── TOP BAR ── */
.top-bar {
  height: var(--nav-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  position: relative;
  z-index: 50;
  flex-shrink: 0;
}

/* Hamburger */
.hamburger {
  width: 38px;
  height: 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 6px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  flex-shrink: 0;
}
.hamburger:hover { background: var(--bg3); }
.hamburger span {
  display: block;
  height: 2px;
  background: var(--text-sub);
  border-radius: 2px;
  transition: var(--transition);
  transform-origin: center;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Logo */
.top-logo {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.top-logo span { color: var(--gold); }

/* Topic badge */
.topic-pill {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-sub);
  max-width: 140px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: var(--transition);
}
.topic-pill:hover { border-color: var(--gold-dim); color: var(--gold); }

/* Top bar icons */
.top-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.top-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
  font-size: 18px;
  transition: var(--transition);
  position: relative;
}
.top-icon-btn:hover { background: var(--bg3); color: var(--text); }

/* Notification dot */
.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--gold);
  border-radius: 50%;
  border: 1.5px solid var(--bg2);
}

/* Profile avatar button */
.profile-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--text-inverse);
  font-weight: 600;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  border: 2px solid transparent;
}
.profile-btn:hover { border-color: var(--gold-soft); box-shadow: var(--shadow-gold); }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100dvh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
  overflow: hidden;
}
.sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }

/* Sidebar header */
.sidebar-header {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.sidebar-logo span { color: var(--gold); }
.sidebar-close {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background: var(--bg3);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}
.sidebar-close:hover { background: var(--bg4); color: var(--text); }

/* New chat button */
.new-chat-btn {
  margin: var(--space-4);
  padding: 10px 16px;
  background: var(--gold-glow);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-md);
  color: var(--gold);
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: var(--transition);
  flex-shrink: 0;
}
.new-chat-btn:hover {
  background: var(--gold);
  color: var(--text-inverse);
  border-color: var(--gold);
}
.new-chat-btn svg { width: 16px; height: 16px; }

/* Sidebar search */
.sidebar-search {
  margin: 0 var(--space-4) var(--space-3);
  position: relative;
  flex-shrink: 0;
}
.sidebar-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--text-sm);
  transition: var(--transition);
}
.sidebar-search input:focus { border-color: var(--gold-dim); }
.sidebar-search input::placeholder { color: var(--text-muted); }
.sidebar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

/* Sidebar nav links */
.sidebar-nav {
  padding: 0 var(--space-3);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: var(--text-sub);
  font-size: var(--text-sm);
  font-weight: 400;
  transition: var(--transition);
  cursor: pointer;
}
.sidebar-nav-item:hover { background: var(--bg3); color: var(--text); }
.sidebar-nav-item.active { background: var(--gold-glow); color: var(--gold); }
.sidebar-nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

/* Chat history section */
.sidebar-section-label {
  padding: 0 var(--space-4);
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.sidebar-history {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-3);
  padding-bottom: var(--space-4);
}

.chat-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: var(--text-sub);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item:hover { background: var(--bg3); color: var(--text); }
.chat-item.active { background: var(--gold-glow); color: var(--gold); }
.chat-item-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.chat-item.active .chat-item-dot { background: var(--gold); }

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--space-3);
  flex-shrink: 0;
}
.sidebar-footer-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: var(--text-sub);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-footer-item:hover { background: var(--bg3); color: var(--text); }
.sidebar-footer-item.danger:hover { background: var(--danger-soft); color: var(--danger); }
.sidebar-footer-item svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── PROFILE DROPDOWN ── */
.profile-wrap { position: relative; }
.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: var(--transition);
  transform-origin: top right;
}
.profile-dropdown.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.profile-dropdown-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.profile-dropdown-name {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text);
  margin-bottom: 2px;
}
.profile-dropdown-email {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.profile-dropdown-plan {
  margin-top: var(--space-2);
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 11px var(--space-4);
  color: var(--text-sub);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: var(--transition);
}
.profile-dropdown-item:hover { background: var(--bg3); color: var(--text); }
.profile-dropdown-item.danger { color: var(--danger); }
.profile-dropdown-item.danger:hover { background: var(--danger-soft); }
.profile-dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── DESKTOP: sidebar always visible ── */
@media (min-width: 900px) {
  .sidebar {
    position: relative;
    transform: none !important;
    box-shadow: none !important;
    flex-shrink: 0;
  }
  #app { flex-direction: row; }
  .top-bar { display: none; }
  .main-content { flex: 1; }
  .overlay { display: none !important; }
  .hamburger { display: none; }
}
