/* ================================
   NEXTSTEP ANNOUNCEMENT BANNER
   ================================ */

#announcement-banner {
  position: fixed;
  top: 70px; /* Sits cleanly just below your standard fixed navbar */
  left: 0;
  right: 0;
  z-index: 999;
  background: linear-gradient(135deg, #0ea5e9, #10b981);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.65rem 3rem 0.65rem 1.5rem;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  flex-wrap: wrap;
  transform: translateY(-150%); /* Start completely hidden above the navbar view */
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#announcement-banner.visible {
  transform: translateY(0); /* Drops into place below the navbar */
}

#announcement-banner.hidden {
  transform: translateY(-150%);
}

.announcement-emoji {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.announcement-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.announcement-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: white;
  color: #0ea5e9;
  text-decoration: none;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.announcement-link:hover {
  background: #f0f9ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.announcement-close {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.announcement-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] #announcement-banner {
  background:
    radial-gradient(circle at 18% 50%, rgba(16, 185, 129, 0.32), transparent 28%),
    radial-gradient(circle at 82% 50%, rgba(96, 165, 250, 0.34), transparent 30%),
    linear-gradient(135deg, #0b1220 0%, #0f2744 48%, #123a63 100%);
  color: #f1f5f9;
  border-bottom: 1px solid rgba(125, 211, 252, 0.36);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.46),
    0 0 28px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .announcement-emoji,
[data-theme="dark"] .announcement-text,
[data-theme="dark"] .announcement-text span {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .announcement-emoji {
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.36));
}

[data-theme="dark"] .announcement-link {
  background: linear-gradient(135deg, #ffffff, #dbeafe);
  color: #0f3f78;
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 4px 14px rgba(14, 165, 233, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

[data-theme="dark"] .announcement-link:hover {
  background: linear-gradient(135deg, #ffffff, #bfdbfe);
  color: #082f49;
  box-shadow:
    0 8px 22px rgba(14, 165, 233, 0.34),
    0 0 18px rgba(125, 211, 252, 0.24);
}

[data-theme="dark"] .announcement-close {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  border: 1px solid rgba(226, 232, 240, 0.28);
}

[data-theme="dark"] .announcement-close:hover {
  background: rgba(255, 255, 255, 0.24);
  color: white;
}

/* 
   FIX: Keep the navbar at top: 0, 
   Instead, push your main page container element downward 
   to make space for the banner without overlapping grids.
*/
body.banner-visible > main,
body.banner-visible .main-content,
body.banner-visible .leaderboard-main {
  margin-top: 40px !important; /* Pushes content down smoothly while banner shows */
  transition: margin-top 0.4s ease;
}

@media (max-width: 768px) {
  #announcement-banner {
    top: 60px; /* Adjusts to fit a smaller mobile navbar height */
    font-size: 0.82rem;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    gap: 0.5rem;
  }

  body.banner-visible > main,
  body.banner-visible .main-content,
  body.banner-visible .leaderboard-main {
    margin-top: 55px !important; /* Slightly larger margin to accommodate stacked mobile lines */
  }
}
/* ── Compass (chatbot) page fix ──
   .compass-shell is a div, not main, so needs its own banner rule.
   When the banner is visible, shrink the shell height and push it down. */
body.banner-visible .compass-shell {
  margin-top: calc(var(--nav-h, 70px) + 40px);
  height: calc(100vh - var(--nav-h, 70px) - 40px);
  transition: margin-top 0.4s ease, height 0.4s ease;
}

@media (max-width: 768px) {
  body.banner-visible .compass-shell {
    margin-top: calc(64px + 55px);
    height: calc(100vh - 64px - 55px);
  }
}
