/* ==========================================================================
   nanhu cart theme · cart.css
   产品选购页（配色取自楠狐购物车：墨青渐变系）+ 响应式（PC / 手机端）
   ========================================================================== */

:root {
  --navh: 80px;            /* 官网导航高度（桌面端） */
  --subnavh: 50px;         /* 页内返回栏高度 */
  --sidebar-w: clamp(240px, 19vw, 340px);   /* 左侧分类栏：自适应宽度（替代固定 220px），随视口变化 */
  --cart-navy: #124f68;    /* 分类选中文字 */
  --teal-1: #14506b;
  --teal-2: #176f89;
  --teal-3: #238ca0;
  --teal-border: #126782;
  --price-red: #ff0000;
  --title-orange: #ff6d00;
  --inventory-pink: #eb2f96;
}

* { box-sizing: border-box; }

/* 购物车页隐藏官网页脚与公告条，避免与全屏布局冲突 */
.cloud-footer { display: none !important; }
.site-notice-bar { display: none !important; }

body { overflow: hidden; }

/* 顶部导航（含语言/费用/用户下拉）层级：购物车内容层为 z-index:100，
   导航栏默认 z-index:99 会把从导航栏内部弹出的下拉菜单盖住，故提到内容层之上 */
.sky-container .sky-navbar { z-index: 200 !important; }

/* ============================ 页内返回栏 ============================ */
.navtop-standingPosition {
  position: fixed;
  top: var(--navh);
  left: 0;
  right: 0;
  z-index: 20;
  height: var(--subnavh);
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid #f0f2f5;
}
.nav-top-page {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
}
.nav-top-page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.nav-top-page .return { display: flex; align-items: center; gap: 6px; }
.nav-top-page .return i { color: #84868c; font-size: 13px; }
.nav-top-page .return span { font-size: 14px; color: #84868c; font-weight: 400; }
.nav-top-page .return:hover i,
.nav-top-page .return:hover span { color: var(--teal-2); }
.nav-top-page .page-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #181818;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-top-page p { margin: 0; font-size: 12px; color: #98a0aa; }
.nav-top-page p:empty { display: none; }

/* ============================ 页面骨架 ============================ */
.shopping-cart-page {
  position: fixed;
  top: calc(var(--navh) + var(--subnavh));
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}
.shopping-cart-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 10px;
}
.shopping-cart-side {
  height: 100%;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #fff;
}
.sky-cart-sidebar {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 20px 10px;
  overflow: hidden;
}
.shopping-cart-product {
  flex: 1;
  width: 100%;
  height: 100%;
  padding: 20px 60px 40px 0;
  overflow-y: auto;
}

/* ============================ 搜索框 ============================ */
.sky-cart-search { position: relative; flex-shrink: 0; }
.sky-cart-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #eef1f5;
  border-radius: 9px;
  background: #f5f7fa;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.sky-cart-search-box:focus-within {
  background: #fff;
  border-color: rgba(23, 111, 137, 0.45);
  box-shadow: 0 4px 14px rgba(23, 111, 137, 0.1);
}
.sky-cart-search-icon i { color: #98a0aa; font-size: 13px; }
#search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  color: #333;
}
#search-input::placeholder { color: #a4a9b3; }
.sky-cart-search-clear { display: none; cursor: pointer; color: #b6bcc6; }
.sky-cart-search-clear:hover { color: #7c8490; }
.sky-cart-search-box.has-value .sky-cart-search-clear { display: block; }

/* 手机端分类按钮（桌面端隐藏） */
.cart-menu-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid #e3eaf0;
  border-radius: 9px;
  background: #fff;
  color: #145b76;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  cursor: pointer;
}
.cart-menu-toggle:hover { border-color: var(--teal-3); }

/* ============================ 左侧分类菜单 ============================ */
.sky-cart-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 12px;
  padding: 4px 0 40px;
  background: #f9fafc;
  border-radius: 10px;
  overflow-y: auto;
}
.sky-cart-menu::-webkit-scrollbar { width: 6px; }
.sky-cart-menu::-webkit-scrollbar-thumb { background: #dfe4ea; border-radius: 3px; }

.sky-cart-menu-empty { padding: 30px 20px; color: #98a0aa; font-size: 13px; }

.sky-cart-menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}
.sky-cart-menu-title {
  position: relative;
  width: calc(100% - 16px);
  margin: 4px 8px 0;
  padding: 11px 36px 11px 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #334e62;
  background: #f7f9fb;
  border: 1px solid #e3eaf0;
  border-left: 3px solid transparent;
  border-radius: 7px;
  box-shadow: 0 1px 2px rgba(31, 55, 72, 0.04);
  cursor: pointer;
  transition: all 0.2s;
}
.sky-cart-menu-title span {
  display: block;
  white-space: normal;
  word-break: break-word;
}
.sky-cart-menu-title::before {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #9aa7b5;
  transition: transform 0.3s, border-top-color 0.3s;
}
.sky-cart-menu-item.open .sky-cart-menu-title::before {
  transform: translateY(-50%) rotate(180deg);
  border-top-color: var(--teal-3);
}
.sky-cart-menu-title:hover { color: #145b76; background: #eff4f8; }
.sky-cart-menu-title.active {
  color: #145b76;
  background: #eaf4f7;
  border-color: #c8dfe7;
  border-left-color: #2385a2;
  box-shadow: 0 2px 7px rgba(35, 133, 162, 0.1);
}

.sky-cart-submenu { display: none; width: 100%; }
.sky-cart-menu-item.open .sky-cart-submenu { display: block; }
.submenu-item-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 6px 0;
}
.sky-cart-submenu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 0 16px 0 14px;
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: background 0.2s;
}
.sky-cart-submenu-item:hover { background: #f2f6ff; }
.sky-cart-submenu-item.active {
  background: #e6f2f6;
  border-left-color: #16819b;
}
.submenu-item-u { min-width: 0; }
.submenu-item-u h5 {
  margin: 0;
  min-width: 0;
  padding: 9px 0;
  line-height: 1.5;
  font-size: 14px;
  font-weight: 400;
  color: #29465c;
  white-space: normal;
  word-break: break-word;
}
.sky-cart-submenu-item.active h5 { color: var(--cart-navy); font-weight: 600; }

.cart-menu-mask { display: none; }

/* ============================ 右侧产品区 ============================ */
.cart-page-announcement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid #dceef3;
  border-radius: 10px;
  background: #f2fafc;
}
.cart-page-announcement-badge {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--teal-1), var(--teal-3));
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.cart-page-announcement-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cart-page-announcement-copy p { margin: 0; font-size: 12.5px; line-height: 1.7; color: #3d6274; }

/* 绿色「公告」卡 */
.cart-page-announce {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  margin: 0 0 12px;
  padding: 12px 16px;
  border: 1px solid #cdeccf;
  border-radius: 10px;
  background: #eefaf0;
}
.cart-page-announce-ico {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #26a65b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.cart-page-announce-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cart-page-announce-copy p { margin: 0; font-size: 12.5px; line-height: 1.7; color: #2f6b45; }

/* 底部「同意协议」卡（绿色） */
.cart-agreement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0 6px;
  padding: 14px 18px;
  border: 1px solid #cdeccf;
  border-radius: 10px;
  background: #eefaf0;
}
.cart-agreement-ico {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #26a65b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.cart-agreement-copy { flex: 1; min-width: 0; }
.cart-agreement-copy p { margin: 0 0 5px; font-size: 12.5px; line-height: 1.9; color: #2f6b45; word-break: break-word; }
.cart-agreement-copy p:last-child { margin-bottom: 0; }
.cart-agreement-copy a { color: #1a7f4b; text-decoration: underline; }

/* 产品名前的国家国旗（HK|香港云服务器… → 国旗 + 香港云服务器…），渲染函数在 product.tpl / configureproduct.tpl / ordersummary.tpl 内联定义 */
.fx-flag { display: inline-flex; align-items: center; margin-right: 5px; vertical-align: -2px; }
.fx-flag img { height: 1.05em; width: auto; border-radius: 2px; box-shadow: 0 0 0 1px rgba(15, 45, 75, .1); }
.fx-flag-txt { font-weight: 600; }

/* 左侧分类：热销红标（楠狐风格立体 HOT 徽标，文案取自名称第 3 段） */
.fx-cart-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  height: 18px;
  line-height: 16px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 1px 1px rgba(120, 0, 0, .55);
  background: linear-gradient(180deg, #ff9a8b 0%, #f0271f 45%, #c00d12 100%);
  border: 1px solid #ffc9c2;
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 -3px 4px rgba(120, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .25);
  vertical-align: middle;
  white-space: nowrap;
}
/* 产品名红标之后的自定义内容（名称第 4 段起，如 国家|名称|红字|自定义内容） */
.fx-name-extra {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 400;
  color: #7c8490;
}

.product-sort {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}
.product-sort-info { font-size: 13px; color: #7c8490; }
.product-sort-info b { margin: 0 2px; color: var(--teal-2); font-size: 15px; }
.product-sort-select {
  height: 36px;
  padding: 0 30px 0 12px;
  border: 1px solid #e3eaf0;
  border-radius: 8px;
  background: #fff
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23848c99' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  font-size: 13px;
  color: #334e62;
  appearance: none;
  -webkit-appearance: none;
  outline: 0;
  cursor: pointer;
}
.product-sort-select:focus { border-color: rgba(23, 111, 137, 0.5); }

/* ---------- 产品网格 ---------- */
.sky-productList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid #c9dce8;
  background: linear-gradient(145deg, #f8fcff 0%, #eef7fb 52%, #e5f1f7 100%);
  box-shadow: 0 5px 20px 3px rgba(230, 233, 249, 0.3);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: #9fc6d8;
  box-shadow: -2px 2px 20px rgba(55, 99, 170, 0.1), 8px 8px 20px rgba(55, 99, 170, 0.1);
}

.product-card-header {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  background: #f7f7f9;
}
.product-card-header .header-title h5 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  color: var(--title-orange);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.product-card-main { flex: 1; }
.product-card-body .product-description {
  width: 100%;
  padding: 10px 20px 0;
  word-break: break-word;
}
.product-card-body .product-description * {
  color: #83838e;
  font-size: 13px;
  line-height: 26px;
}
.product-stock { margin: 8px 20px 0; font-size: 12.5px; color: #98a0aa; }
.product-stock span { color: var(--inventory-pink); }

/* ---------- 价格与购买按钮 ---------- */
.product-Parameters { margin-top: auto; }
.pricing-info { padding: 10px 20px 0; text-align: left; }
.pricing-info .price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}
.pricing-info .currency { align-self: flex-start; margin-top: 2px; color: #123b68; font-size: 14px; }
.pricing-info .amount { color: var(--price-red); font-size: 24px; font-weight: 700; }
.pricing-info .suffix { color: var(--price-red); font-size: 14px; }
.pricing-info .period { color: #777; font-size: 13px; }
.pricing-info .original-price,
.pricing-info .trial-price { display: block; width: 100%; margin-top: 2px; font-size: 12px; }
.pricing-info .original-price { color: #98a0aa; }
.pricing-info .trial-price { color: #e64a19; }
.pricing-info .price-soldout {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 4px;
  background: #f2f4f7;
  color: #98a0aa;
  font-size: 13px;
}

.buy-now-button {
  display: block;
  width: 180px;
  max-width: calc(100% - 40px);
  margin: 12px auto 14px;
  border: 1px solid var(--teal-border);
  border-radius: 4px;
  background: linear-gradient(135deg, #14506b 0%, #176f89 52%, #238ca0 100%);
  color: #fff !important;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 42px;
  box-shadow: 0 4px 10px rgba(20, 80, 107, 0.22);
  transition: all 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.buy-now-button:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(20, 80, 107, 0.3);
}
.buy-now-button.disabled { cursor: not-allowed; opacity: 0.65; }
.buy-now-button.disabled:hover { transform: none; box-shadow: 0 4px 10px rgba(20, 80, 107, 0.22); }

/* ---------- 分页 / 空状态 ---------- */
.cart-pagination { display: flex; justify-content: center; padding: 6px 0 25px; }
.cart-pagination ul.pagination {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cart-pagination .pagination li a,
.cart-pagination .pagination li span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #e3eaf0;
  border-radius: 6px;
  background: #fff;
  color: #5d6b7a;
  font-size: 13px;
  text-decoration: none;
}
.cart-pagination .pagination li.active a,
.cart-pagination .pagination li.active span {
  background: var(--teal-2);
  border-color: var(--teal-2);
  color: #fff;
}
.cart-pagination .pagination li a:hover { border-color: var(--teal-3); color: var(--teal-2); }

.cart-no-result { margin: 30px 0 40px; text-align: center; color: #98a0aa; font-size: 13px; }

.cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 60vh;
  color: #98a0aa;
  font-size: 14px;
}
.cart-empty-state i { font-size: 40px; color: #c6ced8; }
.cart-empty-state a { color: var(--teal-2); font-size: 13px; }

/* ==========================================================================
   响应式：≤992px 切换为文档流布局，分类菜单收纳为抽屉
   ========================================================================== */
@media (max-width: 992px) {
  body { overflow: auto; }

  .navtop-standingPosition {
    position: sticky;
    top: 0;
    height: auto;
    min-height: 46px;
    padding: 8px 12px;
  }
  .nav-top-page { flex-wrap: wrap; gap: 6px 10px; height: auto; }
  .nav-top-page .page-title { font-size: 15px; white-space: normal; }
  .nav-top-page p { display: none; }

  .shopping-cart-page { position: static; height: auto; overflow: visible; }
  .shopping-cart-content { display: block; max-width: none; height: auto; padding: 0; }

  .shopping-cart-side {
    width: 100%;
    min-width: 0;
    height: auto;
    background: transparent;
  }
  .sky-cart-sidebar {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    height: auto;
    padding: 12px 12px 0;
  }
  .sky-cart-search { flex: 1; min-width: 0; }
  .cart-menu-toggle { display: inline-flex; }

  /* 分类菜单：左侧抽屉 */
  .sky-cart-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1002;
    width: 86%;
    max-width: 340px;
    margin: 0;
    padding: 16px 10px 60px;
    background: #f7f9fb;
    border-radius: 0 14px 14px 0;
    box-shadow: 0 0 40px rgba(20, 60, 80, 0.18);
    transform: translateX(-104%);
    transition: transform 0.28s ease;
    overflow-y: auto;
  }
  .cart-menu-open .sky-cart-menu { transform: none; }
  .cart-menu-mask {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: none;
    background: rgba(12, 34, 45, 0.42);
  }
  .cart-menu-open .cart-menu-mask { display: block; }

  .shopping-cart-product {
    height: auto;
    padding: 14px 12px 30px;
    overflow: visible;
  }
  .sky-productList { grid-template-columns: 1fr; gap: 12px; }
  .cart-page-announcement { margin: 0 0 12px; }
  .product-sort { margin: 0 0 12px; }
}

@media (max-width: 560px) {
  .product-card-header { padding: 12px 16px; }
  .product-card-body .product-description { padding: 10px 16px 0; }
  .product-card-body .product-description * { font-size: 12.5px; line-height: 23px; }
  .pricing-info { padding: 10px 16px 0; }
  .buy-now-button {
    width: 100%;
    max-width: none;
    margin: 10px 0 12px;
    border-radius: 6px;
  }
}

/* ==========================================================================
   兼容层：购物车被「客户端中心」布局包裹时（/cart 实际位于 .sky-content 内）
   --------------------------------------------------------------------------
   根因：.shopping-cart-page 原为 position:fixed;left:0;right:0;z-index:auto
         （视口全宽，不受 .sky-main-content{margin-left:--nav-l-w} 约束）；
         而客户端中心有固定全局侧栏 .sky-sidebar
         （position:fixed;width:--nav-l-w:200px;不透明;z-index:99）
         与固定面包屑 .sky-container-fluid（z-index:88）。
         视口 < 约 1820px 时，购物车左列会被全局侧栏从左侧盖住约 190px ——
         表现为分类标题变空白方块、子项只剩最末一个字、搜索框只剩尾部。
   修复：桌面端在 .sky-content 作用域内【直接隐藏全局侧栏 .sky-sidebar】
         （display:none，彻底移除覆盖源，不再依赖 z-index 层叠博弈），
         并释放主内容区/面包屑为全宽；购物车主体改为沉浸式全宽、
         顶部对齐客户端中心顶栏下方，保留购物车自带的分类栏与「返回」栏。
   说明：仅桌面端生效；≤992px 已由上方媒体查询切换为文档流布局，无需处理。
   ========================================================================== */
@media (min-width: 993px) {
  /* 关键：直接隐藏「客户端中心」全局侧栏 —— 购物车自带分类栏，二者本冲突；
     且该侧栏为 fixed/200px/不透明白底/z-index:99，会从左侧盖住购物车左列
     （表现：分类标题只剩末字、搜索框只剩尾部、出现空白方块）。
     用 display:none 彻底移除覆盖源，不依赖 z-index 层叠博弈，最稳。 */
  .sky-container .sky-sidebar { display: none !important; }

  /* 释放主内容区/面包屑为全宽，避免隐藏侧栏后的左侧留白与错位 */
  .sky-container .sky-main-content { margin-left: 0 !important; }
  .sky-container .sky-container-fluid { margin-left: 0 !important; width: 100% !important; }
  .sky-container .sky-footer-Copyright { left: 20px !important; }

  /* 页内返回栏：紧贴客户端中心顶栏（--nav-top-h:48px）下方 */
  .sky-content .navtop-standingPosition {
    top: var(--nav-top-h, 48px);
    z-index: 100;
  }
  /* 购物车主体：沉浸式全宽 + 不透明底，置于面包屑之上 */
  .sky-content .shopping-cart-page {
    top: calc(var(--nav-top-h, 48px) + var(--subnavh));
    z-index: 100;
    background: var(--rightBgColor, #f1f3fb);
  }
}
