/* Shared header / topbar */

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

.header {
  background: linear-gradient(135deg, #0a0a0f 0%, #000 100%);
  padding: 12px 16px;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s, border-color 0.2s;
  box-shadow: 0 2px 8px rgb(0 150 136 / 5%);
}

html.light .header {
  background: linear-gradient(135deg, #f0fffe 0%, #fff 100%);
  border-bottom: 1px solid #b2dfdb;
  box-shadow: 0 2px 8px rgb(0 150 136 / 5%);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.header-logo:hover {
  animation: logo-bounce 0.5s ease infinite;
}

@keyframes logo-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-3px) rotate(-5deg); }
  75% { transform: translateY(-3px) rotate(5deg); }
}

.header h1 {
  margin: 0;
  color: #e0e0e0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
}

html.light .header h1 {
  color: #1a1a1a;
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-tagline {
  font-size: 11px;
  color: #666;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.4;
  margin: 0;
}

html.light .header-tagline {
  color: #888;
}

.header-browse-link {
  color: #26a69a;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid rgb(38 166 154 / 30%);
  transition: all 0.2s;
  white-space: nowrap;
}

.header-browse-link:hover {
  background: rgb(38 166 154 / 10%);
  border-color: #26a69a;
}

html.light .header-browse-link {
  color: #00897b;
  border-color: rgb(0 137 123 / 30%);
}

html.light .header-browse-link:hover {
  background: rgb(0 137 123 / 8%);
  border-color: #00897b;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Nav dropdowns */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-btn {
  color: #26a69a;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid rgb(38 166 154 / 30%);
  background: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 8px;
}

.nav-dropdown-btn:hover {
  background: rgb(38 166 154 / 10%);
  border-color: #26a69a;
}

html.light .nav-dropdown-btn {
  color: #00897b;
  border-color: rgb(0 137 123 / 30%);
}

.nav-dropdown:hover .nav-dropdown-btn {
  background: rgb(38 166 154 / 10%);
  border-color: #26a69a;
}

html.light .nav-dropdown-btn:hover,
html.light .nav-dropdown:hover .nav-dropdown-btn {
  background: rgb(0 137 123 / 8%);
  border-color: #00897b;
}

.nav-caret {
  font-size: 10px;
  transition: transform 0.2s;
  display: inline-block;
}

.nav-dropdown:hover .nav-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 4px;
  min-width: 130px;
  z-index: 100;
  box-shadow: 0 4px 16px rgb(0 0 0 / 40%);
}

html.light .nav-dropdown-menu {
  background: #fff;
  border-color: #e0e0e0;
  box-shadow: 0 4px 16px rgb(0 0 0 / 12%);
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 7px 12px;
  color: #ccc;
  text-decoration: none;
  font-size: 13px;
  border-radius: 7px;
  transition: background 0.15s, color 0.15s;
}

.theme-toggle {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 20px;
  padding: 4px;
  display: flex;
  gap: 4px;
  align-items: center;
  transition: all 0.2s;
}

html.light .theme-toggle {
  background: #f0f0f0;
  border-color: #ccc;
}

.theme-option {
  padding: 4px 8px;
  border-radius: 16px;
  font-size: 14px;
  background: transparent;
  opacity: 0.5;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-option:hover {
  opacity: 0.8;
}

.theme-option:focus {
  outline: none;
  border-color: #26a69a;
  opacity: 1;
}

html.light .theme-option:focus {
  border-color: #00897b;
}

.theme-option.active {
  background: #333;
  opacity: 1;
}

html.light .theme-option.active {
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 10%);
}

@media (width <= 600px) {
  body {
    overflow-x: hidden;
  }

  .header-tagline {
    display: none;
  }

  .header-nav {
    gap: 6px;
  }

  .theme-toggle {
    display: none;
  }

  #user-info span#username-display {
    display: none;
  }

  #login-btn {
    font-size: 0;
    padding: 5px 10px;
  }

  #login-btn::after {
    content: 'Sign in';
    font-size: 13px;
  }
}

/* Shared footer */

.footer {
  text-align: right;
  padding: 24px 16px;
  color: #9aa0a6;
  font-size: 13px;
}

html.light .footer {
  color: #666;
}

.footer a {
  color: #8ab4f8;
  text-decoration: none;
}

.header h1 a {
  color: inherit;
  text-decoration: none;
}

.nav-dropdown-menu a:hover {
  background: rgb(38 166 154 / 12%);
  color: #26a69a;
}

.footer a:hover {
  text-decoration: underline;
}

html.light .nav-dropdown-menu a {
  color: #333;
}

html.light .footer a {
  color: #1a73e8;
}

html.light .nav-dropdown-menu a:hover {
  background: rgb(0 137 123 / 8%);
  color: #00897b;
}
