/**
 * @file common.css
 * @description 公共组件样式表（头部导航 / 按钮 / 下拉菜单等公共组件）
 *              适配 PC / 平板 / 移动端 三端
 * @author oncedrop
 * @update 2026-06-25
 */

/* ========================================================================
   1. 通用变量补充（Header 相关）
   ======================================================================== */
:root {
  --header-height: 72px;
  --header-bg: rgba(255, 255, 255, 0.72);   /* 半透明白底 */
  --header-blur: 12px;                       /* 毛玻璃模糊半径 */
  --header-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);

  /* 断点 */
  --bp-pc: 1200px;       /* PC 大屏 */
  --bp-tablet: 992px;    /* 平板 */
  --bp-mobile: 768px;    /* 移动端 */
}

/* ========================================================================
   2. Header 顶部导航
   ======================================================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: 100%;
  height: var(--header-height);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(var(--header-blur));
  backdrop-filter: blur(var(--header-blur));
  box-shadow: var(--header-shadow);
  transform: translateY(0);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  will-change: transform;
}
.header--hidden {
  transform: translateY(-100%);
  box-shadow: none;
}

.header-container {
  max-width: var(--container-max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* —— Logo —— */
.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo img {
  height: 40px;
  width: auto;
}

/* —— 主导航 —— */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0 26px;
  height: var(--header-height);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-primary);
}

/* 下拉箭头 */
.arrow {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.has-dropdown:hover .arrow {
  transform: rotate(225deg);
}

/* —— 下拉子菜单 —— */
.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s ease;
}

.has-dropdown:hover .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown li a {
  display: block;
  padding: 10px 20px;
  font-size: 16px;
  color: var(--color-text);
  transition: all 0.2s ease;
}

.dropdown li a:hover {
  background: #f5f5f5;
  color: var(--color-primary);
  padding-left: 26px;
}

/* ========================================================================
   3. 按钮样式
   ======================================================================== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 抽屉内的按钮容器（默认 PC 端隐藏，仅移动端显示） */
.nav-actions {
  display: none;
}

.btn {
  display: inline-block;
  padding: 8px 22px;
  font-size: 16px;
  border-radius: 50px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-login {
  color: var(--color-secondary);
  border: 1px solid var(--color-secondary);
  background: #fff;
}

.btn-login:hover {
  background: var(--color-secondary);
  color: #fff;
}

.btn-register {
  color: #fff;
  background: linear-gradient(90deg, #d44a1a, var(--color-primary));
  border-radius: 50px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(247, 130, 16, 0.3);
  border: none;
}

.btn-register:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(247, 130, 16, 0.4);
}

/* ========================================================================
   4. 移动端汉堡菜单按钮（默认隐藏）
   ======================================================================== */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 20px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--color-secondary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* 汉堡按钮激活状态 */
.menu-toggle.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* ========================================================================
   5. 响应式适配（平板/移动端 ≤ 1040px）—— 触发汉堡菜单
   ======================================================================== */
@media screen and (max-width: 1040px) {
  .header-container {
    padding: 0 20px;
  }

  /* 显示汉堡按钮 */
  .menu-toggle {
    display: flex;
    order: 3;
  }

  /* 隐藏顶部右侧按钮，统一放到抽屉菜单中 */
  .header-actions {
    display: none;
  }

  /* 显示抽屉内的登录/注册按钮 */
  .nav-actions {
    display: flex;
    gap: 12px;
    padding: 20px 20px 24px;
    border-top: 1px solid #f0f0f0;
    margin-top: 12px;
  }

  .nav-actions .btn {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-size: 16px;
  }

  /* 导航菜单抽屉化 */
  .nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height));
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(var(--header-blur));
    backdrop-filter: blur(var(--header-blur));
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 999;
  }

  .nav.active {
    transform: translateX(0);
  }

  .nav-menu {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 0;
    gap: 0;
  }

  .nav-item {
    width: 100%;
    border-bottom: 1px solid #f0f0f0;
  }

  .nav-link {
    width: 100%;
    height: auto;
    padding: 14px 20px;
    font-size: 16px;
    justify-content: space-between;
  }

  /* 移动端下拉菜单改为展开式 */
  .dropdown {
    position: static;
    min-width: auto;
    box-shadow: none;
    padding: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .has-dropdown.open .dropdown {
    max-height: 300px;
  }

  .has-dropdown.open .arrow {
    transform: rotate(225deg);
  }

  .dropdown li a {
    padding: 12px 40px;
    font-size: 16px;
    background: #fafafa;
  }

  .dropdown li a:hover {
    padding-left: 46px;
  }
}

/* ========================================================================
   7. 小屏移动端（≤ 480px）
   ======================================================================== */
@media screen and (max-width: 480px) {
  .logo img {
    height: 32px;
  }

  .nav-actions .btn {
    padding: 11px 0;
    font-size: 18px;
  }
}

/* ========================================================================
   8. Footer 底部
   ======================================================================== */
.footer {
  background: #fcefe3;
  padding: 72px 0 64px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.footer-container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 48px;
}

/* —— 品牌区 —— */
.footer-brand {
  max-width: 320px;
}

.footer-logo {
  display: inline-block;
  margin-bottom: 20px;
}

.footer-logo img {
  height: 40px;
  width: auto;
}

.footer-tagline {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}

.footer-desc {
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  opacity: 0.7;
  font-weight: 600;
}

/* —— 链接列 —— */
.footer-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-secondary);
  margin-bottom: 20px;
}

.footer-links li + li {
  margin-top: 12px;
}

.footer-links a {
  font-size: 16px;
  color: var(--color-text);
  opacity: 0.7;
  transition: color 0.2s ease, opacity 0.2s ease;
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--color-primary);
  opacity: 1;
}

/* —— 联系方式 —— */
.footer-contact li + li {
  margin-top: 14px;
}

.footer-contact a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  color: var(--color-text);
  opacity: 0.7;
  transition: color 0.2s ease, opacity 0.2s ease;
  font-weight: 600;
}

.footer-contact a:hover {
  color: var(--color-primary);
  opacity: 1;
}

.footer-contact svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--color-primary);
}

/* ========================================================================
   9. Footer 平板端适配（≤ 992px）
   ======================================================================== */
@media screen and (max-width: 992px) {
  .footer {
    padding: 60px 0 52px;
  }

  .footer-container {
    grid-template-columns: 1fr 1fr;
    gap: 40px 32px;
  }

  .footer-brand {
    grid-column: span 2;
    max-width: 100%;
  }
}

/* ========================================================================
   10. Footer 移动端适配（≤ 768px）
   ======================================================================== */
@media screen and (max-width: 768px) {
  .footer {
    padding: 48px 0 40px;
  }

  .footer-container {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-brand {
    grid-column: span 1;
  }

  .footer-logo img {
    height: 36px;
  }

  .footer-title {
    margin-bottom: 14px;
  }
}

/* ========================================================================
   11. 右下角悬浮联系按钮（公共模块）
   ======================================================================== */
.float-contact {
  position: fixed;
  right: 24px;
  bottom: 32px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.float-contact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.float-contact-btn svg {
  width: 24px;
  height: 24px;
}

.float-contact-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  color: #fff;
}

.float-contact-email {
  background: linear-gradient(90deg, #d44a1a, var(--color-primary));
  box-shadow: 0 4px 16px rgba(247, 130, 16, 0.3);
}

.float-contact-email:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(247, 130, 16, 0.4);
}

.float-contact-whatsapp {
  background: #25d366;
}

.float-contact-whatsapp:hover {
  background: #1ebe57;
}

/* ========================================================================
   12. 悬浮按钮移动端适配（≤ 768px）
   ======================================================================== */
@media screen and (max-width: 768px) {
  .float-contact {
    right: 16px;
    bottom: 24px;
    gap: 10px;
  }

  .float-contact-btn {
    width: 46px;
    height: 46px;
  }

  .float-contact-btn svg {
    width: 22px;
    height: 22px;
  }
}
