/* ========================================
   Mobile Header & Menu
   (migrated from header.php inline <style>)
   ======================================== */

/* Mobile Header */
.ct-ck-mobile-header {
  display: none; /* 默认隐藏，通过媒体查询显示 */
  position: relative;
  background: #161616;
  color: #d9d9d9;
  padding: 0;
  z-index: 50;
}

.ct-ck-mobile-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  height: 56px;
}

.ct-ck-mobile-header .ct-header-logo {
  flex-shrink: 0;
}

.ct-ck-mobile-header .ct-header-logo_img {
  height: 28px;
  width: auto;
  -webkit-user-drag: none;
  user-select: none;
}

.ct-ck-mobile-actions {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
}

.ct-ck-store-btn-mobile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f24a00;
  color: #fff;
  padding: 6px 12px;
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  transition: background-color 0.2s ease;
  border: none;
  cursor: pointer;
  border-radius: 50px;
}

.ct-ck-store-btn-mobile span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.ct-ck-store-btn-mobile svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.ct-ck-store-btn-mobile:link {
  color: #fff;
}

.ct-ck-mobile-menu-btn {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  flex-shrink: 0;
  position: relative;
}

.ct-ck-menu-icon-hamburger,
.ct-ck-menu-icon-close {
  position: absolute;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.ct-ck-menu-icon-hamburger {
  opacity: 1;
  transform: rotate(0deg);
}

.ct-ck-menu-icon-close {
  opacity: 0;
  transform: rotate(-90deg);
}

/* 菜单展开时，显示关闭图标，隐藏汉堡图标 */
.ct-ck-mobile-menu-btn.is-active {
  color: #f24a00;
}

.ct-ck-mobile-menu-btn.is-active .ct-ck-menu-icon-hamburger {
  opacity: 0;
  transform: rotate(90deg);
}

.ct-ck-mobile-menu-btn.is-active .ct-ck-menu-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* 汉堡菜单图标动画 */
.ct-ck-menu-icon {
  overflow: visible;
}

.ct-ck-menu-icon__line {
  transform-origin: center;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 菜单打开状态 */
.ct-ck-mobile-menu-btn.is-active .ct-ck-menu-icon__line--top {
  transform: translateY(5px) rotate(45deg);
}

.ct-ck-mobile-menu-btn.is-active .ct-ck-menu-icon__line--middle {
  opacity: 0;
}

.ct-ck-mobile-menu-btn.is-active .ct-ck-menu-icon__line--bottom {
  transform: translateY(-5px) rotate(-45deg);
}

/* Mobile Menu Backdrop */
.ct-ck-mobile-menu-backdrop {
  position: fixed;
  top: 0; /* 将通过JS动态设置为header底部位置 */
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ct-ck-mobile-menu-backdrop.is-active {
  opacity: 1;
  visibility: visible;
}

/* Mobile menu bottom account block */
.ct-ck-mobile-account {
  margin-top: 24px;
  padding: 16px 20px 24px;
}

.ct-ck-mobile-account__signup {
  display: block;
  width: 100%;
  text-align: center;
  background: #f24a00;
  color: #ffffff;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}

.ct-ck-mobile-account__existing {
  margin-top: 10px;
  text-align: center;
  font-size: 14px;
  color: #ffffff;
}

.ct-ck-mobile-account__existing a {
  color: #f24a00;
  text-decoration: underline;
  margin-left: 4px;
}

.ct-ck-mobile-account__user {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: #ffffff;
}

.ct-ck-mobile-account__greeting {
  color: #ffffff;
  /* text-decoration: none; */
  flex: 1;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ct-ck-mobile-account__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: border-color 0.2s ease;
}

.ct-ck-mobile-account__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ct-ck-mobile-account__name {
  flex: 1;
}

.ct-ck-mobile-account__logout {
  background: transparent;
  border: 1px solid #f24a00;
  color: #f24a00;
  text-decoration: none;
  cursor: pointer;
  font-size: 15px;
  padding: 8px 16px;
  border-radius: 999px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

/* Mobile Menu Panel */
.ct-ck-mobile-menu {
  position: fixed;
  top: 0; /* 将通过JS动态设置 */
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 400px;
  background: #2d2d2d;
  color: #ffffff;
  z-index: 9999;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
}

.ct-ck-mobile-menu.is-active {
  transform: translateX(0);
}

.ct-ck-mobile-menu__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  height: 56px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  background: #252525;
  z-index: 10;
  overflow: hidden;
}

.ct-ck-mobile-menu__header-title {
  font-size: 16px;
  font-weight: 500;
  color: #ffffff;
  flex: 1;
}

.ct-ck-mobile-menu__back,
.ct-ck-mobile-menu__close {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.ct-ck-mobile-menu__back:hover,
.ct-ck-mobile-menu__close:hover {
  color: #f24a00;
}

.ct-ck-mobile-menu__header .ct-header-logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.ct-ck-mobile-menu__header .ct-header-logo_img {
  height: 28px;
  width: auto;
}

/* Mobile Menu Navigation */
.ct-ck-mobile-menu__nav {
  width: 100%;
  overflow-x: hidden;
}

.ct-ck-mobile-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-decoration: none;
  width: 100%;
  box-sizing: border-box;
}

.ct-ck-mobile-menu__label {
  font-size: 16px;
  font-weight: 500;
  color: #ffffff;
}

.ct-ck-mobile-menu__arrow {
  width: 24px;
  height: 24px;
  fill: #ffffff;
  opacity: 0.6;
}

/* Product submenu cards */
.ct-ck-mobile-submenu__nav--products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  row-gap: 24px;
  column-gap: 24px;
  padding: 16px;
}

.ct-ck-mobile-product {
  display: block;
  text-decoration: none;
  color: inherit;
}

.ct-ck-mobile-product__image {
  height: 160px;
  background: #f5f5f5;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ct-ck-mobile-product__image img {
  width: 100%;
  display: block;
}

.ct-ck-mobile-product__texts {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ct-ck-mobile-product__title {
  font-size: 18px;
  font-weight: 500;
  color: #ffffff;
  line-height: 1.2;
  text-align: center;
}

.ct-ck-mobile-product__desc {
  font-size: 14px;
  color: #a1a1a1;
  line-height: 1.4;
  text-align: center;
}

/* Mobile Submenu */
.ct-ck-mobile-submenu {
  position: fixed;
  top: 0; /* 将通过JS动态设置 */
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 400px;
  background: #252525;
  color: #ffffff;
  z-index: 10001;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-x: hidden;
  overflow-y: auto;
}

.ct-ck-mobile-submenu.is-active {
  transform: translateX(0);
}

.ct-ck-mobile-submenu__header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  height: 56px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  background: #252525;
  z-index: 10;
}

.ct-ck-mobile-submenu__back {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.ct-ck-mobile-submenu__title {
  font-size: 18px;
  font-weight: 500;
  color: #ffffff;
}

.ct-ck-mobile-submenu__nav {
  width: 100%;
  overflow-x: hidden;
}

/* Override for product grid to保留左右内边距 */
.ct-ck-mobile-submenu__nav.ct-ck-mobile-submenu__nav--products {
  padding: 24px;
}

.ct-ck-mobile-submenu__section-title {
  font-size: 20px;
  font-weight: 500;
  margin: 24px 0 0 24px;
}

.ct-ck-mobile-submenu__btn + .ct-ck-mobile-submenu__section-title {
  margin-top: 5px;
}

.ct-ck-mobile-submenu__btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 48px);
  margin: 16px 24px 8px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(242, 74, 0, 0.12);
  border: 1px solid rgba(242, 74, 0, 0.35);
  color: #f24a00;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  box-shadow: none;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.ct-ck-mobile-submenu__btn:link,
.ct-ck-mobile-submenu__btn:visited {
  color: #f24a00;
}

.ct-ck-mobile-submenu__btn:hover {
  transform: translateY(-1px);
  background: rgba(242, 74, 0, 0.16);
  border-color: rgba(242, 74, 0, 0.55);
}

.ct-ck-mobile-submenu__btn:active {
  transform: translateY(0);
  background: rgba(242, 74, 0, 0.2);
}

.ct-ck-mobile-submenu__btn:focus-visible {
  outline: 2px solid rgba(242, 74, 0, 0.55);
  outline-offset: 2px;
}

.ct-ck-mobile-submenu__btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.ct-ck-mobile-submenu__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  text-decoration: none;
  color: #dbdbdb;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
  box-sizing: border-box;
}

.ct-ck-mobile-submenu__item:link {
  color: #dbdbdb;
}

.ct-ck-mobile-submenu__icon {
  width: 20px;
  height: 20px;
  fill: #ffffff;
  flex-shrink: 0;
  transition: fill 0.2s ease;
}

.ct-ck-mobile-submenu__icon:hover {
  fill: #ffffff;
  stroke: #ffffff;
  color: #ffffff;
}

.ct-ck-mobile-submenu__item span {
  font-size: 16px;
  color: #dbdbdb;
}

/* Media Queries */
@media (max-width: 1200px) {
  /* 隐藏PC端Header */
  .ct-ck-header {
    display: none !important;
  }

  /* 显示移动端Header */
  .ct-ck-mobile-header {
    display: block;
    position: sticky;
    top: 0;
  }
}

@media (min-width: 1201px) {
  /* PC端隐藏移动端Header */
  .ct-ck-mobile-header,
  .ct-ck-mobile-menu,
  .ct-ck-mobile-menu-backdrop {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .ct-ck-mobile-menu,
  .ct-ck-mobile-submenu {
    max-width: 100%;
  }
}
