/* Unified Header and Footer Styles for Eggy Car Website */

/* Header Styles */
header {
  background-color: transparent;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md) 5%;
  width: 100%;
  transition: transform 0.3s ease;
  box-sizing: border-box;
}

/* Header hidden when scrolling down */
header.hidden {
  transform: translateY(-100%);
}

.logo {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  margin-right: var(--spacing-lg);
}

.logo img {
  height: 70px; /* 20% larger than original 58px */
  margin-right: var(--spacing-sm);
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.logo a {
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  text-decoration: none;
  display: block;
}

/* Navigation */
nav {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

nav ul li {
  margin-left: var(--spacing-lg);
}

nav ul li a {
  color: white;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  background-color: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  display: block;
  text-decoration: none;
}

nav ul li a:hover {
  background-color: var(--secondary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 语言选择器样式 */
.language-selector {
  position: relative;
  margin-left: var(--spacing-lg);
}

.language-selector-button {
  display: flex;
  align-items: center;
  color: white;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  background-color: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden; /* 为波纹效果添加溢出隐藏 */
}

.language-selector-button:hover {
  background-color: var(--secondary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 添加波纹效果 */
.language-selector-button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%, -50%);
  transform-origin: 50% 50%;
}

.language-selector-button:active::after {
  animation: ripple 0.4s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }
  20% {
    transform: scale(25, 25);
    opacity: 0.3;
  }
  100% {
    opacity: 0;
    transform: scale(40, 40);
  }
}

.language-selector-button .globe-icon {
  margin-right: 8px;
  font-size: 1rem;
}

/* 添加下拉指示器动画 */
.language-selector-button .fa-chevron-down {
  transition: transform 0.3s ease;
  margin-left: 5px;
  font-size: 0.8rem;
}

.language-selector.active .language-selector-button .fa-chevron-down {
  transform: rotate(180deg);
}

.language-selector-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  min-width: 150px;
  z-index: 1001; /* 增加z-index确保在移动菜单之上 */
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.language-selector.active .language-selector-dropdown {
  max-height: 200px;
  opacity: 1;
  overflow-y: auto;
}

.language-option {
  padding: 12px 15px;
  color: white;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  position: relative;
  overflow: hidden; /* 为波纹效果添加溢出隐藏 */
}

.language-option:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.language-option.active {
  background-color: var(--secondary-color);
}

/* 添加波纹效果到语言选项 */
.language-option::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%, -50%);
  transform-origin: 50% 50%;
}

.language-option:active::after {
  animation: ripple 0.4s ease-out;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: white;
  margin-left: var(--spacing-md);
  flex: 0 0 auto;
  z-index: 1001;
  width: 44px; /* 增加触摸区域 */
  height: 44px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.menu-toggle:active {
  background-color: rgba(255, 255, 255, 0.2);
}

/* 当页面放大时，隐藏汉堡菜单按钮 */
@media (min-width: 769px) {
  .menu-toggle {
    display: none !important;
  }
}

/* Footer Styles */
footer {
  background-color: transparent;
  padding: var(--spacing-xl) 5% var(--spacing-md);
  margin-top: var(--spacing-xl);
  width: 100%;
  text-align: center;
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 1000px; /* 减小宽度 */
  margin: 0 auto;
  text-align: center;
}

/* 上部分：Logo */
.footer-logo-section {
  margin-bottom: var(--spacing-md);
  width: 100%;
  text-align: center;
}

.footer-logo-section img {
  height: 70px;
  transition: transform 0.3s ease;
  margin: 0 auto; /* 确保居中 */
  display: block; /* 确保居中生效 */
}

.footer-logo-section img:hover {
  transform: scale(1.05);
}

/* 中部分：导航按钮 */
.footer-nav {
  width: 100%;
  text-align: center;
  margin: var(--spacing-md) 0;
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-nav ul li {
  margin: 0 var(--spacing-sm);
  padding: var(--spacing-xs) 0;
}

.footer-nav ul li a {
  color: white;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  background-color: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  display: inline-block; /* 使按钮保持一致的大小 */
}

.footer-nav ul li a:hover {
  background-color: var(--secondary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 下部分：版权信息 */
.copyright {
  text-align: center;
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 1000px; /* 减小宽度 */
  margin-left: auto;
  margin-right: auto;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  font-size: 0.9rem;
  width: 100%;
}

/* PC Optimization for footer */
@media (min-width: 1400px) {
  footer {
    padding: calc(var(--spacing-xl) * 1.2) 5% var(--spacing-lg);
  }

  .footer-container {
    max-width: 1000px; /* 保持一致的宽度 */
    flex-direction: column; /* 保持上中下结构 */
    justify-content: center;
    align-items: center;
    padding-bottom: var(--spacing-md);
  }

  .footer-logo-section {
    margin-bottom: var(--spacing-md);
    width: 100%;
    text-align: center;
  }

  .footer-logo-section img {
    height: 80px;
    margin: 0 auto;
    display: block;
  }

  .footer-nav {
    width: 100%;
    text-align: center;
    margin: var(--spacing-md) 0;
  }

  .footer-nav ul {
    justify-content: center;
    margin: 0;
  }

  .footer-nav ul li a {
    padding: 0.6rem 1.2rem;
    font-size: 1.05rem;
  }

  .copyright {
    max-width: 1000px; /* 保持一致的宽度 */
    font-size: 1rem;
    padding-top: var(--spacing-md);
    width: 100%;
  }
}

/* PC-specific enhancements */
@media (min-width: 1200px) {
  header {
    padding: var(--spacing-md) 5%;
    max-width: 1800px;
    margin: 0 auto;
  }

  nav ul li a {
    font-size: 1.05rem;
    padding: 0.6rem 1.2rem;
  }

  .footer-container {
    max-width: 1000px; /* 保持一致的宽度 */
  }

  .copyright {
    max-width: 1000px; /* 保持一致的宽度 */
  }
}

/* Responsive styles for header and footer */
@media (max-width: 768px) {
  header {
    padding: var(--spacing-md) 3%;
  }

  .menu-toggle {
    display: flex; /* 改为flex以支持居中对齐 */
    order: 3;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  /* 当页面放大时隐藏汉堡菜单 */
  .menu-toggle.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .logo {
    order: 1;
    margin-right: auto;
  }

  .logo img {
    height: 50px; /* 移动端减小logo大小 */
  }

  nav {
    order: 2;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
  }

  nav ul {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* 增加背景不透明度 */
    backdrop-filter: blur(15px); /* 增加模糊效果 */
    -webkit-backdrop-filter: blur(15px);
    flex-direction: column;
    padding: var(--spacing-md) 0;
    z-index: 1000;
    border-radius: 0 0 16px 16px; /* 添加圆角 */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* 添加阴影 */
    transform: translateY(-5px); /* 初始位置 */
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease, display 0.3s ease; /* 添加过渡效果 */
  }

  nav ul.active {
    display: flex;
    transform: translateY(0); /* 显示时的位置 */
    opacity: 1;
  }

  nav ul li {
    margin: 0;
    padding: var(--spacing-sm) var(--spacing-lg);
    text-align: center;
  }

  nav ul li a {
    display: flex;
    width: 90%; /* 稍微减小宽度 */
    margin: 0 auto; /* 居中 */
    text-align: center;
    justify-content: center;
    border-radius: 30px; /* 增加圆角 */
    background-color: rgba(255, 255, 255, 0.1); /* 轻微背景 */
  }

  nav ul li a:active {
    background-color: var(--secondary-color);
    transform: scale(0.98);
  }

  /* 移动端语言选择器样式 */
  .language-selector {
    margin: 0;
    padding: var(--spacing-sm) var(--spacing-lg);
    text-align: center;
  }

  .language-selector-button {
    width: 90%;
    margin: 0 auto;
    justify-content: center;
    border-radius: 30px;
    background-color: rgba(255, 255, 255, 0.15);
    display: flex;
    text-align: center;
    padding: 12px 20px; /* 增加内边距，扩大触摸区域 */
    position: relative;
    overflow: hidden; /* 为波纹效果添加溢出隐藏 */
  }

  /* 添加波纹效果 */
  .language-selector-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
  }

  .language-selector-button:active::after {
    animation: ripple 0.4s ease-out;
  }

  @keyframes ripple {
    0% {
      transform: scale(0, 0);
      opacity: 0.5;
    }
    20% {
      transform: scale(25, 25);
      opacity: 0.3;
    }
    100% {
      opacity: 0;
      transform: scale(40, 40);
    }
  }

  /* 添加下拉指示器动画 */
  .language-selector-button .fa-chevron-down {
    transition: transform 0.3s ease;
  }

  .language-selector.active .language-selector-button .fa-chevron-down {
    transform: rotate(180deg);
  }

  /* 增强视觉提示 */
  .language-selector-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), transparent);
    border-radius: 30px;
    pointer-events: none;
  }

  .language-selector-dropdown {
    position: relative;
    width: 90%;
    margin: 8px auto 0;
    left: 0;
    right: 0;
    max-height: 0;
    z-index: 1002; /* 确保在移动菜单之上 */
    background-color: rgba(0, 0, 0, 0.8); /* 增加背景不透明度 */
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    border-radius: 15px;
  }

  .language-selector.active .language-selector-dropdown {
    max-height: 180px;
    opacity: 1;
  }

  /* 移动端页脚优化 */
  footer {
    padding: var(--spacing-lg) 5% var(--spacing-md);
    margin-top: var(--spacing-lg);
  }

  .footer-container {
    padding: 0;
    flex-direction: column; /* 确保上中下结构 */
    align-items: center;
    justify-content: center;
  }

  .footer-logo-section {
    margin-bottom: var(--spacing-sm);
    width: 100%;
    text-align: center;
  }

  .footer-logo-section img {
    height: 50px;
    margin: 0 auto;
    display: block;
  }

  /* 在移动端完全隐藏页脚导航 */
  .footer-nav {
    display: none;
  }

  .copyright {
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    text-align: center;
  }
}
