/* =============================================================================
 * custom.css —— 购物车商品页自定义样式
 * 作用页面：/themes/cart/province/product.tpl（商品卡片列表）
 *
 * 说明：
 *   1. 仅做视觉与布局优化，不改变任何功能、业务逻辑或链接跳转。
 *   2. 蓝色调：主蓝 #0e62ff（价格 / 按钮 / 图标 / 标签），浅蓝 #eef4ff（标签底），
 *      售罄红 #dc2626（仅售罄状态），中性灰 #495057 / #6b7280（正文与辅助文字）。
 *   3. 扁平化设计：小圆角 + 轻阴影 + 紧凑间距，降低卡片整体高度。
 * ============================================================================= */

/* ----------------------------------------------------------------------------
 * 1. 商品卡片容器 .product-card
 * ---------------------------------------------------------------------------- */
.card{border: 1px solid #FFF;box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05);}

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;               /* 等高对齐：配合 Bootstrap 行内弹性布局，统一卡片高度 */
  overflow: hidden;           /* 裁剪 ::after 右侧插图，使其贴合圆角 */
  background: #fff;
  border: 1px solid #eef0f4;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* 顶部渐变饰条：默认收起，悬停/激活时从左向右展开 */
.product-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(90deg, #0e62ff, #38bdf8);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

/* 卡片右侧服务器插图（背景）：默认灰色 + 模糊，悬停/激活时恢复彩色清晰，
   用于填补 product-desc 右侧空白，图片紧贴卡片右边缘。
   背景图由 CSS 变量 --card-bg 控制：product.tpl 里的脚本读取每张卡片描述中的
   隐藏标记（<i class="js-card-bg" data-bg="图片名" hidden>），把对应图片路径写入
   该卡片的 --card-bg；未配置标记时不显示背景图。 */
.product-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 40px;
  width: 45%;                              /* 占卡片右侧约 45% 宽，可按需调整 */
  background: var(--card-bg, none) no-repeat right center / contain;
  pointer-events: none;                    /* 不拦截鼠标事件，不影响卡片交互 */
  z-index: 0;                              /* 位于卡片内容之下 */
  opacity: 0.65;
  filter: grayscale(100%) blur(2px);       /* 默认：灰色 + 模糊 */
  transition: filter 0.3s ease, opacity 0.3s ease;
}

.product-card:hover::after,
.product-card.active::after {
  opacity: 1;
  filter: grayscale(0) blur(0);            /* 悬停/激活：彩色清晰 */
}

/* 隐藏描述里的背景标记元素（<i class="js-card-bg">）：即使后端把 hidden 属性过滤掉，
   也保证它不占位、不显示，仅作为脚本读取 data-bg 的载体 */
.product-desc .js-card-bg {
  display: none !important;
}

/* 悬停 / 激活（JS 会给 .cartitem 挂 .active，这里与 :hover 保持一致交互态） */
.product-card:hover,
.product-card.active {
  transform: translateY(-4px);
  border-color: rgba(14, 98, 255, 0.35);
  box-shadow: 0 10px 26px rgba(20, 40, 80, 0.10);
}

.product-card:hover::before,
.product-card.active::before {
  transform: scaleX(1);
}

/* 卡片内容区：纵向弹性布局，让「名称 → 描述 → 价格」自上而下排列，
   并使价格始终贴底，避免描述内容长短不一导致各卡片价格高低错位 */
.product-card .card-body {
  position: relative;        /* 提升层级，盖住右侧背景插图，保证文字可读 */
  z-index: 1;
  display: flex;             /* 覆盖 Bootstrap .row 的横向 flex */
  flex-direction: column;    /* 名称 → 内容列 纵向排列 */
  flex-wrap: nowrap;
  width: 100%;
  margin: 0;                 /* 抵消 .row 的负 margin，避免内容左右错位 */
  flex: 1 1 auto;            /* 填满卡片中部（购买按钮之上），为价格贴底预留空间 */
  padding: 14px 16px;
}

/* 内容列：覆盖 Bootstrap .col-sm-12 的 gutter 与宽度，改为纵向 flex 并填满剩余高度 */
.product-card .card-body > .col-sm-12 {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;            /* 填满名称以下的剩余空间，使价格可贴底 */
  width: 100%;
  max-width: 100%;
  padding: 0;                /* 内边距统一由 card-body 控制，消除左右错位 */
}

/* ----------------------------------------------------------------------------
 * 2. 库存角标 .product-stock（卡片右上角）
 * ---------------------------------------------------------------------------- */
.product-stock {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
  color: #0e62ff;
  background: #eef4ff;
  border: 1px solid #d6e4ff;
  border-radius: 999px;
}

/* 售罄状态：红色角标 */
.product-stock--soldout {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fecaca;
}

/* ----------------------------------------------------------------------------
 * 3. 商品名称 .product-name
 * ---------------------------------------------------------------------------- */
.product-name {
  flex: 0 0 auto;             /* 高度由内容决定，不参与弹性伸缩 */
  width: 100%;                /* 撑满整行，分隔线横贯整卡 */
  max-width: 100%;
  margin: 0 0 8px;            /* 去掉原 margin-left:10px 的偏移 hack，与下方内容左对齐 */
  padding: 0 64px 8px 0;      /* 右侧为库存角标预留空间，下方留出分隔线间距 */
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  border-bottom: 1px solid #f0f2f5;
}

/* ----------------------------------------------------------------------------
 * 4. 商品描述 .product-desc
 *    描述为后端输出的 HTML：第一行 <span> 是“商品说明”，其后 <div> 是配置项。
 * ---------------------------------------------------------------------------- */
.product-desc {
  flex: 1 1 auto;            /* 撑开剩余空间，把价格推到卡片底部，保证各行卡片价格水平对齐 */
  font-size: 14px;
  color: #495057;
}

/* 商品说明（span）：置于商品名称正下方，作为一句产品描述 / 卖点文案。
   左对齐 + 左侧蓝色竖线点缀，与名称形成「标题 + 副标题」关系，
   取代原来的居中描边框样式，阅读主次更清晰 */
.product-desc > span {
  display: block;
  margin-bottom: 8px;
  padding: 1px 0 1px 5px;      /* 左侧留白容纳竖线，避免撑高卡片 */
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: #6b7280;               /* 中性灰，弱于名称，突出主次 */
  border-left: 2px solid #0e62ff; /* 蓝色竖线，呼应卡片主色调 */
  border-radius: 0;             /* 去掉原圆角描边 */
  text-align: left;             /* 与名称左对齐，形成描述副标题 */
}

/* 配置项（div）：图标 + 文案，逐行排布 */
.product-desc > div {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0; 
  font-size: 13px;
  line-height: 1.5;
}

/* 配置项图标（remixicon） */
.product-desc > div i {
  flex-shrink: 0;
  width: 16px;
  font-size: 16px;
  color: #0d63ff;
  text-align: center;
}

/* ----------------------------------------------------------------------------
 * 5. 价格 .product-price
 * ---------------------------------------------------------------------------- */
.product-price {
  flex: 0 0 auto;            /* 高度由内容决定，随描述区弹性后贴底展示 */
  margin-top: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1682b;
  letter-spacing: -0.01em;
}

/* 原价（辅助说明） */
.product-card .color-999 {
  color: #9aa3af;
  font-size: 11px;
}

/* ----------------------------------------------------------------------------
 * 6. 底部购买按钮 .card-footer
 *    全宽按钮，悬停/激活时由“蓝字白底”反转为“蓝底白字”
 * ---------------------------------------------------------------------------- */
.product-card .card-footer {
  position: relative;         /* 提升层级，盖住右侧背景插图 */
  z-index: 1;
  margin-top: auto;           /* 把按钮压到卡片底部，保证等高卡片按钮对齐 */
  padding: 0;
  border-top: 1px solid #f0f2f5;
  border-radius: 0 0 10px 10px;
  background: #fff;
}

.product-card .card-footer a {
  display: block;
  width: 100%;
  line-height: 40px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  /* color: #0e62ff;
  background: #fff; */
  border-radius: 0 0 10px 10px;
  transition: color 0.2s ease, background 0.2s ease;

  background: linear-gradient(90deg, rgb(68 128 215), rgb(7 61 239));
  color: #fff;
}

.product-card.active .card-footer,
.product-card:hover .card-footer {
  background: #0e62ff;
}

.product-card.active .card-footer a,
.product-card:hover .card-footer a {
  color: #fff;
  background: #0e62ff;
}
/* ----------------------------------------------------------------------------
 * 7. 描述内部参数标签 .product-desc-os
 *    由 $list.description 传入的标签（如操作系统标识），由「图标 + 文字」组成。
 *    做成浅蓝小徽章，与卡片蓝色调、扁平化风格保持一致。
 * ---------------------------------------------------------------------------- */
.product-desc-os {
  display: inline-flex;        /* 图标与文字水平对齐 */
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;         /* 防止换行把标签撑开 */
  vertical-align: middle;      /* 与相邻文字对齐 */
  color: #0e62ff;
  background: #eef4ff;
  border: 1px solid #d6e4ff;
  border-radius: 4px;
  margin-left: -5px;
}

.product-desc-os > img {
  width: 14px;
  height: 14px;
  object-fit: contain;         /* 图标等比缩放，不拉伸变形 */
}

/* ----------------------------------------------------------------------------
 * 8. 分类导航（省份 / 地区 / 简介 / 通知）—— topbar-categories.tpl
 *    覆盖 topbar.css 旧样式，统一为蓝色调 + 圆角 + 轻阴影，与商品卡片风格一致。
 * ---------------------------------------------------------------------------- */

/* 分类容器：白底圆角卡片 */
.firstgroup_box,
.secondgroup_box {
  min-height: 44px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #eef0f4;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05);
  display: flex;
  align-items: center;
}

/* 左侧标签（选择省份 / 选择地区 / 简介 / 通知） */
.firstgroup_box .firstgroup_box_prov,
.secondgroup_box .secondgroup_box_area {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 64px;
  font-size: 14px;
  color: #0e62ff;
}

/* （简介 / 通知样式） */
#card_gg{
  border-left: 3px solid #0d83fa;
}

/* 右侧内容区：弹性布局 + 自动换行，替代原 float 布局 */
.firstgroup_box .firstgroup_box_group,
.secondgroup_box .secondgroup_box_group {
  flex: 1;
  min-width: 0;               /* 允许在窄容器内正确收缩换行 */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* 分类项：胶囊按钮 */
.firstgroup_box .firstgroup_item,
.secondgroup_box .secondgroup_item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 0px;
  background: #fff;
  border: 1px solid #e5e9f2;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;

  position: relative; /* 关键！作为图片定位参照物hot-sale-label 角标 */
}

/* 分类项链接：让 <a> 铺满整个分类项，整块都是点击热区（消除文字上下/左右的死区） */
.firstgroup_box .firstgroup_item a,
.secondgroup_box .secondgroup_item a {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;      /* 撑满分类项 30px 高度，消除上下约 9px 死区 */
  min-width: 120px;         /* 与分类项同宽，消除左右死区 */
  padding: 0 12px;          /* 点击热区含左右留白 */
  box-sizing: border-box;
  font-size: 13px;
  line-height: 1;
  color: #495057;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 700;
}

/* 激活 / 悬停：蓝底白字 + 轻微投影 */
.firstgroup_box .firstgroup_item.active,
.firstgroup_box .firstgroup_item:hover,
.secondgroup_box .secondgroup_item.active,
.secondgroup_box .secondgroup_item:hover {
  background: #0e62ff;
  border-color: #0e62ff;
  box-shadow: 0 4px 12px rgba(14, 98, 255, 0.25);
  border-radius: 6px;
}

.firstgroup_box .firstgroup_item.active a,
.firstgroup_box .firstgroup_item:hover a,
.secondgroup_box .secondgroup_item.active a,
.secondgroup_box .secondgroup_item:hover a {
  color: #fff;
}

/* 简介 / 通知正文（颜色、字号由 tpl 内联样式控制，这里只处理布局与行高） */
.secondgroup_box .secondgroup_box_group .card-text {
  flex: 1;
  margin: 0;
  line-height: 1.6;
}

/* 移动端：压缩内边距，分类项按两列自适应排列 */
@media (max-width: 576px) {
  .firstgroup_box,
  .secondgroup_box {
    padding: 10px 12px;
  }

  .firstgroup_box .firstgroup_box_prov,
  .secondgroup_box .secondgroup_box_area {
    min-width: 52px;
    margin-right: 8px;
    font-size: 12px;
  }

  .firstgroup_box .firstgroup_item,
  .secondgroup_box .secondgroup_item {
    flex: 1 1 calc(50% - 8px); /* 两列，扣除 gap */
    padding: 0 10px;
  }
}

/* 热销/标识图标（hot.svg=火焰、rx.svg=RX 标）：内联跟随分类名，按“高度”统一缩放，
   随字号与屏幕自适应；去掉原 absolute + 魔法数值定位，避免不同文字长度/屏幕错位 */
.hot-sale-label {
  position: absolute;
  top: -5px;
  right: -8px;
  width: 48px;
  opacity: 0.9;
}

/* ----------------------------------------------------------------------------
 * 9. 分享给好友（触发按钮 + 弹窗）
 * ---------------------------------------------------------------------------- */

/* 触发按钮：位于「欢迎选购」右侧 */
.share-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
  color: #0e62ff;
  background: #fff;
  border: 1px solid #0e62ff;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.share-trigger:hover {
  background: #0e62ff;
  color: #fff;
}

/* 弹窗容器：默认隐藏，is-open 时显示 */
.share-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.share-modal.is-open {
  opacity: 1;
  visibility: visible;
}

/* 模糊遮罩 */
.share-modal__mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* 弹窗主体：白色圆角卡片 */
.share-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  transform: translateY(8px);
  transition: transform .2s ease;
}
.share-modal.is-open .share-modal__dialog {
  transform: translateY(0);
}

/* 弹窗头部 */
.share-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f2f5;
}
.share-modal__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
}
.share-modal__close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: #9aa3af;
  cursor: pointer;
}
.share-modal__close:hover {
  color: #1f2937;
}

/* 弹窗内容 */
.share-modal__body {
  padding: 16px 20px 20px;
}

/* 当前页面链接展示条：名称+链接，右侧带复制按钮 */
.share-url {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: #f7f9fc;
  border: 1px solid #eef0f4;
  border-radius: 8px;
  font-size: 12px;
}
.share-url__label {
  flex-shrink: 0;
  color: #0e62ff;
  font-weight: 600;
}
.share-url__value {
  flex: 1;
  min-width: 0;
  color: #6b7280;
  word-break: break-all;   /* 长链接自动换行，不撑破弹窗 */
}
.share-url__copy {
  flex-shrink: 0;
  border: 1px solid #0e62ff;
  background: #fff;
  color: #0e62ff;
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.share-url__copy:hover {
  background: #0e62ff;
  color: #fff;
}

/* 文案列表 */
.share-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.share-item {
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #eef0f4;
  border-radius: 8px;
}
.share-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.share-item__type {
  font-size: 13px;
  font-weight: 600;
  color: #0e62ff;
}
.share-item__copy {
  border: 1px solid #0e62ff;
  background: #fff;
  color: #0e62ff;
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.share-item__copy:hover {
  background: #0e62ff;
  color: #fff;
}
.share-item__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #495057;
  word-break: break-word;
}

/* 推介计划入口按钮：位于弹窗最下方 */
.share-affiliate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(90deg, rgb(68 128 215), rgb(7 61 239));
  border-radius: 8px;
  text-decoration: none;
  transition: opacity .15s ease, transform .15s ease;
}
.share-affiliate:hover {
  color: #fff;
  opacity: .92;
  transform: translateY(-1px);
}

/* 移动端：弹窗贴近屏幕两侧 */
@media (max-width: 576px) {
  .share-modal {
    padding: 12px;
  }
  .share-modal__dialog {
    max-width: 100%;
  }
}