/* ==========================================================================
   SHARED UI COMPONENTS
   ========================================================================== */

/* Navbar Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-line);
  transition: background-color 0.3s ease;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 18px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: 0;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  box-shadow: var(--shadow-glow);
}

.brand-avatar {
  width: 42px;
  height: 42px;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 50%;
  border: 2px solid #BBF7D0;
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.18);
  background: #FFFFFF;
}

.brand-dept-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border: 1px solid var(--border-line);
  border-radius: 8px;
  background: #FFFFFF;
  padding: 3px;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text-main);
  white-space: nowrap;
}

.brand-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--accent-amber);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nav Links */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  flex-wrap: nowrap;
}

.nav-menu a {
  --tab-accent: #22C55E;
  --tab-bg: #DCFCE7;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
  transition: all 0.2s ease;
  position: relative;
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--tab-accent);
  background: var(--tab-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tab-accent) 35%, transparent);
}

.nav-menu a::after {
  display: none;
}

.nav-menu li:nth-child(1) a { --tab-accent: #16A34A; --tab-bg: #DCFCE7; }
.nav-menu li:nth-child(2) a { --tab-accent: #0D9488; --tab-bg: #CCFBF1; }
.nav-menu li:nth-child(3) a { --tab-accent: #0284C7; --tab-bg: #E0F2FE; }
.nav-menu li:nth-child(4) a { --tab-accent: #65A30D; --tab-bg: #ECFCCB; }
.nav-menu li:nth-child(5) a { --tab-accent: #7C3AED; --tab-bg: #EDE9FE; }
.nav-menu li:nth-child(6) a { --tab-accent: #CA8A04; --tab-bg: #FEF9C3; }
.nav-menu li:nth-child(7) a { --tab-accent: #DB2777; --tab-bg: #FCE7F3; }
.nav-menu li:nth-child(8) a { --tab-accent: #15803D; --tab-bg: #DCFCE7; }

.nav-menu a:hover::after,
.nav-menu a.active::after {
  width: 100%;
}

/* Actions in Nav */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Theme Toggle Switch */
.theme-toggle-btn {
  display: none;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-line);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: var(--shadow-sm);
}

.mobile-toggle {
  display: none;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-line);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: #22C55E;
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: #16A34A;
  box-shadow: 0 10px 22px rgba(34, 197, 94, 0.22);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-line);
}

.btn-secondary:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-teal);
  background: #DCFCE7;
  transform: translateY(-2px);
}

.btn-amber {
  background: var(--accent-amber);
  color: #FFFFFF;
}

.btn-amber:hover {
  background: #E08728;
  box-shadow: 0 0 20px rgba(255, 159, 67, 0.4);
}

/* Engineering Technical Eyebrow Block */
.tech-titleblock {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border-line);
  border-radius: 4px;
  background: var(--bg-tertiary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
  overflow: hidden;
  max-width: 100%;
}

.tech-titleblock span {
  padding: 6px 14px;
  border-right: 1px solid var(--border-line);
  color: var(--text-muted);
  min-width: 0;
}

.tech-titleblock span:last-child {
  border-right: none;
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Chips / Tags */
.chip {
  display: inline-flex;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-line);
  transition: all 0.2s ease;
}

.chip:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

/* Card Components */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: 12px;
  padding: 28px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

/* Modal Popup System */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 17, 24, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-active);
  border-radius: 16px;
  max-width: 760px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 36px;
  position: relative;
  transform: scale(0.94);
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-line);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.modal-close:hover {
  color: var(--accent-amber);
  border-color: var(--accent-amber);
}

/* Responsive Mobile Navigation */
@media (max-width: 900px) {
  .topbar-inner {
    height: 64px;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 12px;
    right: 12px;
    max-height: calc(100vh - 84px);
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-line);
    border-radius: 8px;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 8px;
    box-shadow: var(--shadow-md);
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-menu a {
    display: block;
    width: 100%;
    padding: 11px 12px;
    text-align: left;
    white-space: normal;
  }

  .mobile-toggle {
    display: flex;
  }
}

@media (max-width: 560px) {
  .brand-logo {
    gap: 10px;
  }

  .brand-name {
    font-size: 0.98rem;
  }

  .brand-title {
    max-width: 180px;
    font-size: 0.62rem;
  }

  .tech-titleblock {
    display: flex;
    flex-wrap: wrap;
  }

  .tech-titleblock span {
    flex: 1 1 auto;
    padding: 6px 10px;
    font-size: 0.66rem;
    text-align: center;
  }
}

@media (max-width: 400px) {
  .brand-title {
    display: none;
  }

  .brand-avatar {
    width: 38px;
    height: 38px;
  }
}
