/* Main navigation (Campus Life / New & Trending / News). Shared by the home page and every inner page.
   Hover opens the panels on desktop; click/tap opens them on touch screens and phones (.is-open, see main-menu.js). */

.main-menu-wrap { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
.top-menu { display: flex; align-items: center; gap: .25rem; margin: 0; padding: 0; list-style: none; flex-wrap: nowrap; }
.top-menu .nav-item { position: relative; }
.top-menu .nav-item.mega-trigger { position: static; }   /* the mega menu centres under the whole bar */
.top-menu .nav-link {
  color: rgba(255, 255, 255, .8) !important; font-size: .9rem; font-weight: 500; padding: .45rem .85rem; cursor: pointer;
  white-space: nowrap; border-radius: var(--radius-pill, 999px); transition: color .16s, background-color .16s;
}
.top-menu .nav-link:hover, .top-menu .nav-link:focus-visible,
.top-menu .is-open > .nav-link, .top-menu .nav-item:hover > .nav-link {
  color: var(--brand-400, #00d084) !important; background-color: var(--accent-light, rgba(0, 208, 132, .12)); outline: none; box-shadow: none;
}
.top-menu-empty { padding: 1rem; text-align: center; color: var(--text-faint, #94a3b8); font-size: .82rem; }
.hot-badge { background: #ff3366; color: #fff; font-size: .6rem; padding: .15em .45em; border-radius: 4px; font-weight: 700; letter-spacing: .5px; }

/* ---- Panels: shared look ---- */
.cc-menu, .mega-menu {
  background: linear-gradient(145deg, #f0fdf8 0%, #f8fffe 60%, #f0fdf8 100%);
  border: 1.5px solid rgba(0, 208, 132, .18); overflow: hidden;
  box-shadow: 0 18px 40px -12px rgba(13, 27, 42, .28);
}
.menu-panel, .mega-menu {
  position: absolute; z-index: 3001; opacity: 0; visibility: hidden;
  transition: opacity .2s ease, transform .25s cubic-bezier(.4, 0, .2, 1), visibility 0s linear .18s;
}
.menu-panel { top: calc(100% + .55rem); left: 0; min-width: 330px; max-width: 92vw; border-radius: 16px; transform: translateY(-8px); }
.mega-menu { top: 100%; left: 50%; width: 820px; max-width: 95vw; transform: translateX(-50%) translateY(-8px); border-top: 3px solid var(--accent, #00d084); border-radius: 0 0 20px 20px; }

/* Invisible bridge so the pointer can travel from the link to its panel without it closing */
.menu-pop::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: .7rem; display: none; }

.is-open > .menu-panel, .is-open > .mega-menu,
.menu-pop:has(:focus-visible) > .menu-panel, .mega-trigger:has(:focus-visible) > .mega-menu {
  opacity: 1; visibility: visible; transition-delay: 0s; transform: none;
}
.is-open > .mega-menu, .mega-trigger:has(:focus-visible) > .mega-menu { transform: translateX(-50%); }
.is-open.menu-pop::after { display: block; }

@media (hover: hover) and (min-width: 992px) {
  .menu-pop:hover > .menu-panel, .mega-trigger:hover > .mega-menu { opacity: 1; visibility: visible; transition-delay: 0s; }
  .menu-pop:hover > .menu-panel { transform: none; }
  .mega-trigger:hover > .mega-menu { transform: translateX(-50%); }
  .menu-pop:hover::after { display: block; }
}

/* ---- Panel contents ---- */
.cc-menu-header { background: rgba(0, 208, 132, .08); padding: 10px 16px; border-bottom: 1px solid rgba(0, 208, 132, .12); display: flex; align-items: center; justify-content: space-between; }
.cc-menu-header--split { border-top: 1px solid rgba(0, 208, 132, .12); }
.cc-menu-header-label { font-size: .7rem; font-weight: 700; color: var(--brand-text, #007a4d); text-transform: uppercase; letter-spacing: 1px; }
.cc-menu-footer { padding: 10px 16px; border-top: 1px solid rgba(0, 208, 132, .1); text-align: center; background: rgba(0, 208, 132, .04); }
.cc-menu-footer a { font-size: .78rem; color: var(--brand-text, #007a4d); text-decoration: none; font-weight: 600; }
.cc-menu-footer a:hover { color: var(--accent, #00d084); }
.cc-drop-item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; text-decoration: none; border-top: 1px solid rgba(0, 208, 132, .07); transition: background .2s; }
.cc-drop-item:hover { background: rgba(0, 208, 132, .07); }
.cc-drop-icon { width: 38px; height: 38px; border-radius: var(--radius, 10px); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1rem; }
.cc-drop-text { flex: 1; min-width: 0; }
.cc-drop-title { font-size: .82rem; font-weight: 600; color: var(--text-primary, #0d1b2a); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-drop-sub { font-size: .71rem; color: var(--text-tertiary, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-drop-arrow { color: var(--brand-400, #00d084); font-size: .8rem; }
.rank-num { width: 28px; height: 28px; border-radius: var(--radius-sm, 6px); display: flex; align-items: center; justify-content: center; font-size: .82rem; font-weight: 800; flex-shrink: 0; }

.mega-menu-inner { display: grid; grid-template-columns: 190px 1fr; }
.mega-sidebar { background: rgba(0, 208, 132, .05); border-right: 1px solid rgba(0, 208, 132, .12); padding: 1rem 0; border-radius: 0 0 0 20px; }
.mega-sidebar-label, .mega-section-label { font-size: .68rem; font-weight: 700; color: var(--text-faint, #94a3b8); text-transform: uppercase; letter-spacing: 1px; }
.mega-sidebar-label { padding: 0 1.1rem; margin-bottom: .6rem; }
.mega-sidebar-item { display: flex; align-items: center; gap: .65rem; padding: .55rem 1.1rem; font-size: .82rem; font-weight: 600; color: var(--text-secondary, #475569); text-decoration: none; border-left: 3px solid transparent; transition: all .2s; }
.mega-sidebar-item:hover, .mega-sidebar-item.active { color: var(--brand-text, #007a4d); background: rgba(0, 208, 132, .08); border-left-color: var(--accent, #00d084); }
.mega-sidebar-item i { color: var(--accent, #00d084); font-size: .9rem; }
.mega-content { padding: 1.25rem 1.5rem; }
.mega-section-label { margin-bottom: .75rem; padding-bottom: .5rem; border-bottom: 1px solid rgba(0, 208, 132, .12); }
.mega-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.mega-item { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem; border-radius: var(--radius, 10px); text-decoration: none; border: 1.5px solid transparent; transition: all .2s; }
.mega-item:hover { background: rgba(0, 208, 132, .08); border-color: rgba(0, 208, 132, .2); transform: translateY(-2px); }
.mega-icon { width: 38px; height: 38px; border-radius: var(--radius, 10px); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.mega-item-title { font-size: .84rem; font-weight: 700; color: var(--text-primary, #0d1b2a); margin-bottom: .2rem; line-height: 1.3; }
.mega-item:hover .mega-item-title { color: var(--brand-text, #007a4d); }
.mega-item-desc { font-size: .72rem; color: var(--text-tertiary, #64748b); line-height: 1.45; }

/* ---- Dark theme ---- */
:root[data-theme="dark"] .cc-menu, :root[data-theme="dark"] .mega-menu { background: linear-gradient(145deg, #101c2c 0%, #0d1826 100%); border-color: rgba(0, 208, 132, .22); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .6); }
:root[data-theme="dark"] .mega-sidebar { background: rgba(0, 208, 132, .06); border-right-color: rgba(255, 255, 255, .06); }
:root[data-theme="dark"] .cc-menu-header { background: rgba(0, 208, 132, .1); border-bottom-color: rgba(255, 255, 255, .06); }
:root[data-theme="dark"] .cc-menu-header--split, :root[data-theme="dark"] .cc-drop-item { border-top-color: rgba(255, 255, 255, .06); }
:root[data-theme="dark"] .cc-menu-header-label, :root[data-theme="dark"] .cc-menu-footer a { color: var(--brand-400, #00d084); }
:root[data-theme="dark"] .cc-menu-footer { border-top-color: rgba(255, 255, 255, .06); }
:root[data-theme="dark"] .mega-section-label { border-bottom-color: rgba(255, 255, 255, .08); }
:root[data-theme="dark"] .mega-item:hover { background: rgba(0, 208, 132, .1); }
:root[data-theme="dark"] .cc-drop-title, :root[data-theme="dark"] .mega-item-title { color: var(--text-primary, #f1f5f9); }

/* ---- Tablet and phone: the menu drops to its own row under the logo and icons; panels span the screen ---- */
@media (max-width: 991.98px) {
  .top-navbar .container-fluid, .cc-top-navbar .container-fluid { flex-wrap: wrap !important; row-gap: .15rem; }
  .cc-top-navbar .nav-icon-group { width: auto; margin-bottom: 0; margin-left: auto; }
  .cc-top-navbar .nav-hamburger-btn { margin-left: 0 !important; }
  .cc-top-navbar { padding-bottom: .35rem; }
  .main-menu-wrap { order: 5; flex: 0 0 100%; margin: 0 -.25rem; }
  .top-menu { width: 100%; justify-content: space-between; gap: 0; }
  .top-menu .nav-link { font-size: .84rem; padding: .4rem .6rem; }
  .top-menu .nav-item, .top-menu .nav-item.mega-trigger { position: static; }
  .menu-pop::after { display: none !important; }
  .menu-panel, .mega-menu {
    position: fixed; top: var(--menu-top, 112px); left: .75rem; right: .75rem; width: auto; min-width: 0; max-width: none;
    max-height: calc(100vh - var(--menu-top, 112px) - 1rem); max-height: calc(100dvh - var(--menu-top, 112px) - 1rem); overflow-y: auto;
    transform: translateY(-6px); border-radius: 0 0 16px 16px;
  }
  .is-open > .menu-panel, .is-open > .mega-menu { transform: none; }
  .mega-sidebar { display: none; }
  .mega-menu-inner { grid-template-columns: 1fr; }
  .mega-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) { .mega-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .menu-panel, .mega-menu { transition: opacity .01s, visibility 0s; } }

/* ---- Profile avatar (guest sign-in button and initials) ---- */
.cc-avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #00e39a, #00a86b); color: #0d1b2a; font-size: 1.1rem; line-height: 1;
  box-shadow: 0 0 0 2px rgba(0, 208, 132, .35), 0 4px 12px -4px rgba(0, 208, 132, .6);
  transition: transform .2s cubic-bezier(.4, 0, .2, 1), box-shadow .2s;
}
.cc-avatar i { transform: translateY(1px); }
a:hover > .cc-avatar { transform: scale(1.06); box-shadow: 0 0 0 3px rgba(0, 208, 132, .45), 0 6px 16px -4px rgba(0, 208, 132, .7); }
