/* 
 * 现代化顶部导航栏样式 - TG-Image - 极致美化版
 */

/* 顶部导航栏 */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
  border-bottom: 1px solid rgba(67, 97, 238, 0.1);
  box-shadow: 0 4px 20px rgba(67, 97, 238, 0.08), 0 2px 10px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all var(--transition);
  height: 70px;
  backdrop-filter: blur(20px);
  border-radius: 0 0 20px 20px;
}

body.dark-mode .header {
  background: linear-gradient(135deg, rgba(26, 27, 35, 0.95) 0%, rgba(36, 37, 48, 0.9) 100%);
  border-bottom-color: rgba(67, 97, 238, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), 0 2px 10px rgba(67, 97, 238, 0.1);
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, 
    rgba(67, 97, 238, 0.02) 0%, 
    rgba(139, 92, 246, 0.01) 50%, 
    rgba(67, 97, 238, 0.02) 100%);
  pointer-events: none;
}

/* 左侧区域 */
.header-left {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.02);
}

.logo-img {
  height: 40px;
  width: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(67, 97, 238, 0.3));
  transition: transform 0.3s ease;
}

.logo-img:hover {
  transform: rotate(10deg) scale(1.1);
}

.logo h1 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, #4361ee 0%, #8b5cf6 50%, #06ffa5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
  text-shadow: 0 2px 10px rgba(67, 97, 238, 0.2);
}

/* 移动端菜单按钮 */
.mobile-menu-toggle {
  display: none;
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.1) 0%, rgba(139, 92, 246, 0.08) 100%);
  border: 1px solid rgba(67, 97, 238, 0.2);
  color: var(--text-color);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.6rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.mobile-menu-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.mobile-menu-toggle:hover::before {
  left: 100%;
}

body.dark-mode .mobile-menu-toggle {
  color: var(--dark-text);
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.15) 0%, rgba(139, 92, 246, 0.12) 100%);
  border-color: rgba(67, 97, 238, 0.3);
}

.mobile-menu-toggle:hover {
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.2) 0%, rgba(139, 92, 246, 0.15) 100%);
  color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.2);
}

/* 中间区域 - 搜索框 */
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 600px;
  margin: 0 1rem;
}

.search-container {
  position: relative;
  width: 100%;
  max-width: 500px;
}

.search-input {
  width: 100%;
  padding: 0.85rem 1.2rem 0.85rem 3rem;
  border: 2px solid rgba(67, 97, 238, 0.1);
  border-radius: 25px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 250, 252, 0.6) 100%);
  color: var(--text-color);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.05);
  backdrop-filter: blur(10px);
}

body.dark-mode .search-input {
  background: linear-gradient(135deg, rgba(26, 27, 35, 0.8) 0%, rgba(36, 37, 48, 0.6) 100%);
  border-color: rgba(67, 97, 238, 0.2);
  color: var(--dark-text);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.15), 0 6px 25px rgba(67, 97, 238, 0.1);
  transform: translateY(-2px);
}

.search-input::placeholder {
  color: var(--text-light);
  transition: color 0.3s ease;
}

.search-input:focus::placeholder {
  color: transparent;
}

.search-icon {
  position: absolute;
  left: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 1.2rem;
  pointer-events: none;
  transition: all 0.3s ease;
}

body.dark-mode .search-icon {
  color: var(--dark-text-light);
}

.search-input:focus + .search-icon {
  color: var(--primary-color);
  transform: translateY(-50%) scale(1.1);
}

/* 右侧区域 */
.header-right {
  display: flex;
  align-items: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* 头部操作按钮 */
.header-action-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(248, 250, 252, 0.05) 100%);
  border: 1px solid rgba(67, 97, 238, 0.1);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.header-action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.1) 0%, rgba(139, 92, 246, 0.08) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.dark-mode .header-action-btn {
  color: var(--dark-text);
  background: linear-gradient(135deg, rgba(26, 27, 35, 0.3) 0%, rgba(36, 37, 48, 0.2) 100%);
  border-color: rgba(67, 97, 238, 0.2);
}

.header-action-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(67, 97, 238, 0.2);
}

.header-action-btn:hover::before {
  opacity: 1;
}

/* 主题切换按钮 */
.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  width: 50px;
  height: 26px;
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  border-radius: 13px;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
}

.theme-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-toggle-icon {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fbbf24;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-toggle input:checked + .theme-toggle-icon {
  transform: translateX(24px);
  background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
  color: #60a5fa;
}

.theme-toggle:hover {
  background: linear-gradient(135deg, #4361ee 0%, #8b5cf6 100%);
}

/* 登录按钮 */
.login-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.5rem;
  background: linear-gradient(135deg, #4361ee 0%, #8b5cf6 100%);
  color: white;
  border-radius: 25px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
  position: relative;
  overflow: hidden;
}

.login-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.login-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(67, 97, 238, 0.4);
}

.login-btn:hover::before {
  left: 100%;
}

.login-btn i {
  font-size: 1.1rem;
}

/* 用户下拉菜单 */
.user-dropdown {
  position: relative;
}

.user-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(248, 250, 252, 0.05) 100%);
  border: 2px solid rgba(67, 97, 238, 0.1);
  border-radius: 25px;
  color: var(--text-color);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

body.dark-mode .user-dropdown-btn {
  color: var(--dark-text);
  background: linear-gradient(135deg, rgba(26, 27, 35, 0.3) 0%, rgba(36, 37, 48, 0.2) 100%);
  border-color: rgba(67, 97, 238, 0.2);
}

.user-dropdown-btn:hover {
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.1) 0%, rgba(139, 92, 246, 0.08) 100%);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.15);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4361ee 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

.user-dropdown-content {
  position: absolute;
  top: calc(100% + 0.8rem);
  right: 0;
  min-width: 220px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
  border: 1px solid rgba(67, 97, 238, 0.1);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(67, 97, 238, 0.15), 0 4px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px) scale(0.95);
  transition: all 0.3s ease;
  backdrop-filter: blur(20px);
}

body.dark-mode .user-dropdown-content {
  background: linear-gradient(135deg, rgba(26, 27, 35, 0.95) 0%, rgba(36, 37, 48, 0.9) 100%);
  border-color: rgba(67, 97, 238, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 20px rgba(67, 97, 238, 0.1);
}

.user-dropdown:hover .user-dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1.2rem;
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  font-weight: 500;
}

.dropdown-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(135deg, #4361ee 0%, #8b5cf6 100%);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

body.dark-mode .dropdown-item {
  color: var(--dark-text);
}

.dropdown-item:hover {
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.08) 0%, rgba(139, 92, 246, 0.06) 100%);
  color: var(--primary-color);
  transform: translateX(8px);
}

.dropdown-item:hover::before {
  transform: scaleY(1);
}

.dropdown-item i {
  font-size: 1.2rem;
  color: var(--text-light);
  transition: all 0.3s ease;
}

body.dark-mode .dropdown-item i {
  color: var(--dark-text-light);
}

.dropdown-item:hover i {
  color: var(--primary-color);
  transform: scale(1.1);
}

/* 响应式设计 */
@media (max-width: 992px) {
  .header-center {
    max-width: 400px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0.5rem 1rem;
    height: 60px;
    border-radius: 0 0 15px 15px;
  }
  
  .mobile-menu-toggle {
    display: flex;
  }
  
  .header-center {
    display: none;
  }
  
  .login-btn span {
    display: none;
  }
  
  .login-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  
  .user-dropdown-btn span,
  .user-dropdown-btn i:last-child {
    display: none;
  }
  
  .user-dropdown-btn {
    padding: 0.3rem;
    border: none;
    background: none;
  }
  
  .header-actions {
    gap: 0.5rem;
  }
}

/* 滚动时header效果 */
.header.scrolled {
  backdrop-filter: blur(25px);
  box-shadow: 0 6px 30px rgba(67, 97, 238, 0.12), 0 4px 15px rgba(0, 0, 0, 0.08);
}

body.dark-mode .header.scrolled {
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.35), 0 4px 15px rgba(67, 97, 238, 0.15);
}
