/* ========== 主题切换器 ========== */
.theme-switcher {
  position: relative;
  display: flex;
  border: none;
  margin: 0 0 0 15px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-switcher__legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-switcher__radio {
  position: relative;
  width: 32px;
  height: 32px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  background: transparent;
}

.theme-switcher__radio::before {
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: currentColor;
  opacity: 0.6;
  transition: all 0.3s ease;
}

.theme-switcher__radio--light::before {
  content: "\f185"; /* fa-sun */
}

.theme-switcher__radio--auto::before {
  content: "\f108"; /* fa-desktop */
}

.theme-switcher__radio--dark::before {
  content: "\f186"; /* fa-moon */
}

.theme-switcher__radio:hover::before {
  opacity: 0.8;
  transform: translate(-50%, -50%) scale(1.1);
}

.theme-switcher__radio:checked {
  background: transparent;
}

.theme-switcher__radio:checked::before {
  opacity: 1;
  color: #3b82f6;
}

.theme-switcher__status {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  background: rgba(59, 130, 246, 0.3);
  border-radius: 14px;
  transition: transform 0.3s ease;
  pointer-events: none;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

/* Status indicator position */
.theme-switcher__radio--light:checked ~ .theme-switcher__status {
  transform: translateX(0);
}

.theme-switcher__radio--auto:checked ~ .theme-switcher__status {
  transform: translateX(32px);
}

.theme-switcher__radio--dark:checked ~ .theme-switcher__status {
  transform: translateX(64px);
}

/* Dark theme styles */
[data-theme="dark"] .theme-switcher {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .theme-switcher__radio::before {
  color: #ffffff;
  opacity: 0.7;
}

[data-theme="dark"] .theme-switcher__radio:hover::before {
  color: #ffffff;
  opacity: 0.9;
}

[data-theme="dark"] .theme-switcher__radio:checked {
  background: transparent;
}

[data-theme="dark"] .theme-switcher__radio:checked::before {
  color: #8b5cf6;
  opacity: 1;
}

[data-theme="dark"] .theme-switcher__status {
  background: rgba(139, 92, 246, 0.3);
}

/* ========== 导航栏基础样式 ========== */
.navbar {
  background: rgba(255, 255, 255, 0.9) !important;
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  box-shadow: 0 2px 20px rgba(59, 130, 246, 0.15);
  z-index: 1030 !important;
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

/* Light mode navbar */
[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.9) !important;
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  box-shadow: 0 2px 20px rgba(59, 130, 246, 0.15);
  z-index: 1030 !important;
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

/* Dark mode navbar */
[data-theme="dark"] .navbar {
  background: rgba(15, 23, 42, 0.9) !important;
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  box-shadow: 0 2px 20px rgba(139, 92, 246, 0.2);
  z-index: 1030 !important;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

/* ========== 品牌 LOGO 样式 ========== */
.navbar-brand img {
  height: 30px;
}

.navbar-brand {
  display: flex;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  gap: 0;
  font-family: 'Montserrat', sans-serif !important;
}

.brand-letter {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(.68,-0.55,.27,1.55);
  position: relative;
  background: linear-gradient(90deg, #2563eb, #3b82f6, #8b5cf6, #7c3aed, #2563eb 80%);
  background-size: 900% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brand-glow-move 3s linear infinite;
}

/* 同步所有字母的流光动画 */
@keyframes brand-glow-move {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.brand-letter.shared {
  pointer-events: none;
}

/* JavaScript触发的跳动效果 */
.brand-letter.jump-active {
  animation: letter-jump 0.5s cubic-bezier(.68,-0.55,.27,1.55);
}

@keyframes letter-jump {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-12px) scale(1.15); }
  60%  { transform: translateY(0) scale(1); }
  100% { transform: translateY(0) scale(1); }
}

/* ========== 导航链接样式 ========== */
.navbar-nav .nav-link {
  font-family: 'Montserrat', sans-serif !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
}

.navbar-nav .dropdown-toggle {
  font-family: 'Montserrat', sans-serif !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
}

.navbar-toggler {
  border-color: #dee2e6;
}

/* Align navbar items to the right */
.navbar-nav {
  margin-left: auto;
  text-align: left;
}

.navbar-nav .nav-item {
  margin-right: 15px;
}

.navbar-nav .nav-link {
  padding: 10px 15px;
  font-size: 1rem;
  color: rgba(229, 231, 235, 0.9) !important;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.navbar-nav .nav-link:hover {
  color: rgba(165, 243, 252, 1) !important;
  text-shadow: 0 0 10px rgba(165, 243, 252, 0.5);
}

/* Light mode navbar text */
[data-theme="light"] .navbar-brand,
[data-theme="light"] .navbar-nav .nav-link {
  color: #1f2937 !important;
}

[data-theme="light"] .navbar-nav .nav-link:hover {
  color: #3b82f6 !important;
}

/* ========== 下拉菜单样式 ========== */
.dropdown-menu {
  background-color: #ffffff;
  border: 1px solid #dee2e6;
  box-shadow: none;
}

.dropdown-item {
  color: #212529;
}

.dropdown-item:hover, .dropdown-item:focus {
  background-color: #e9ecef;
  color: #212529;
}

.navbar .dropdown-menu {
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  margin-top: 0;
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(139, 92, 246, 0.3);
  background: rgba(15, 23, 42, 0.95) !important;
  padding: 8px 0;
  min-width: 200px;
  transform-origin: top center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar .dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.navbar .dropdown-item {
  color: rgba(229, 231, 235, 0.9) !important;
  padding: 12px 20px;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif !important;
  letter-spacing: 0.3px !important;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.navbar .dropdown-item:hover {
  background: rgba(139, 92, 246, 0.2) !important;
  color: rgba(165, 243, 252, 1) !important;
  text-shadow: 0 0 8px rgba(165, 243, 252, 0.4);
}

.navbar .dropdown-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.3), rgba(165, 243, 252, 0.1));
  transition: width 0.3s ease;
}

.navbar .dropdown-item:hover::before {
  width: 100%;
}

/* Light mode dropdown */
[data-theme="light"] .navbar .dropdown-menu {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

[data-theme="light"] .navbar .dropdown-item {
  color: #374151 !important;
}

[data-theme="light"] .navbar .dropdown-item:hover {
  background: rgba(59, 130, 246, 0.1) !important;
  color: #1f2937 !important;
}

/* Dark theme dropdown */
[data-theme="dark"] .dropdown-menu {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dropdown-item {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .dropdown-item:hover {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
  .theme-switcher {
    margin-left: 10px;
  }
  
  .theme-switcher__radio {
    width: 28px;
    height: 28px;
  }
  
  .theme-switcher__radio::before {
    font-size: 12px;
  }
  
  .theme-switcher__status {
    width: 24px;
    height: 24px;
    border-radius: 12px;
  }
  
  .theme-switcher__radio--auto:checked ~ .theme-switcher__status {
    transform: translateX(28px);
  }
  
  .theme-switcher__radio--dark:checked ~ .theme-switcher__status {
    transform: translateX(56px);
  }
}

@media (max-width: 991px) {
  .navbar-collapse {
    padding-top: 1rem;
  }
  
  .theme-toggle {
    margin-top: 10px;
    align-self: flex-start;
  }
}

@media (max-width: 991.98px) {
  .navbar.bg-dark {
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
}