/* ==========================================================================
   5th Semester Shared Navigation System
   Academic Navy & Slate Theme
   ========================================================================== */

:root {
  --topbar-height: 56px;
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --topbar-border: #e2e8f0;
  --hub-navy: #1e3a8a;
  --hub-navy-dark: #0f172a;
  --hub-blue: #2563eb;
  --hub-amber: #d97706;
  --hub-green: #16a34a;
}

/* Global Fixed/Sticky Topbar */
.semester-topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--topbar-border);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Left: Hub Navigation Link & Badges */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hub-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 7px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--hub-navy);
  text-decoration: none;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  transition: all 0.2s ease;
}

.hub-btn:hover {
  background: #dbeafe;
  transform: translateX(-1px);
}

.hub-btn svg {
  flex-shrink: 0;
}

.semester-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Center: Interactive Course Switcher Dropdown */
.topbar-center {
  position: relative;
  display: flex;
  align-items: center;
}

.course-switcher {
  position: relative;
}

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
  user-select: none;
}

.dropdown-trigger:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.dropdown-trigger.open {
  border-color: var(--hub-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.active-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px #bbf7d0;
  flex-shrink: 0;
}

.dropdown-arrow {
  font-size: 10px;
  color: #64748b;
  transition: transform 0.2s ease;
}

.dropdown-trigger.open .dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu Modal */
.course-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  width: 320px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10001;
}

.course-dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #1e293b;
  transition: background 0.15s ease;
  font-size: 13px;
}

.dropdown-item:hover {
  background: #f1f5f9;
}

.dropdown-item.active {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.dropdown-item .ci {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.dropdown-item.active .ci {
  background: #ffffff;
  border-color: #93c5fd;
}

.dropdown-item .ci-text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.dropdown-item .ci-text strong {
  font-family: 'Outfit', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
}

.dropdown-item .ci-text small {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.dropdown-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 6px 0;
}

.dropdown-item.hub-link {
  color: var(--hub-navy);
}

/* Right: Tools & Quick Actions */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.nav-btn.active {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

/* Sidebar & Body adjustments when Topbar is present */
body.has-semester-topbar {
  padding-top: 0 !important;
}

body.has-semester-topbar .sidebar {
  top: var(--topbar-height) !important;
  height: calc(100vh - var(--topbar-height)) !important;
}

body.has-semester-topbar nav {
  top: var(--topbar-height) !important;
  height: calc(100vh - var(--topbar-height)) !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .semester-topbar {
    padding: 0 12px;
  }
  .semester-badge {
    display: none;
  }
  .current-course-name {
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .course-dropdown-menu {
    width: 290px;
    left: 10px;
    transform: none;
  }
  .course-dropdown-menu.show {
    transform: translateY(0);
  }
}
