/**
 * BIGBROSTUDIO — 艺术定制购物车与侧边抽屉组件 (Cart Drawer)
 * 严格遵照工作室自然纸韵、朱红与墨色体系，所有图标均为纯矢量细线 SVG (stroke: currentColor, 1.8px)。
 */

/* ---------- 顶栏右侧操作区容器 (Header Actions Group) ---------- */
.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  margin-left: auto;
}

@media (max-width: 1040px) {
  .header-actions {
    gap: 8px;
    margin-left: auto;
  }
}

/* ---------- 顶栏购物车入口按钮 (Header Trigger) ---------- */
.cart-entry {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 38px;
  padding: 0 14px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px !important;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1;
  color: inherit;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  gap: 7px;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.site-header.is-solid .cart-entry,
.site-header.is-scrolled .cart-entry,
.legal-header .cart-entry {
  color: var(--ink, #1a1917);
  border-color: var(--line, #dfdad0);
  background-color: rgba(244, 241, 234, 0.5);
}

.site-header.is-solid .cart-entry:hover,
.site-header.is-scrolled .cart-entry:hover,
.legal-header .cart-entry:hover {
  border-color: var(--ink, #1a1917);
  background-color: var(--paper-deep, #e7e2d6);
}

.cart-entry:hover {
  transform: translateY(-1px);
}

.cart-entry svg {
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.8;
}

.cart-entry-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background-color: var(--cinnabar, #b33929);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  transition: transform 180ms ease, background-color 180ms ease;
}

.cart-entry-count[data-count="0"] {
  display: none;
}

@media (max-width: 768px) {
  .cart-entry {
    width: 40px;
    min-height: 40px;
    padding: 0;
    justify-content: center;
    gap: 0;
    flex: 0 0 40px;
  }

  .cart-entry span:not(.cart-entry-count) {
    display: none;
  }

  .cart-entry-count {
    position: absolute;
    top: -4px;
    right: -4px;
  }
}

/* 移动端底部轻量悬浮胶囊 (Mobile Floating Cart Pill) */
.mobile-cart-pill {
  display: none;
}

@media (max-width: 768px) {
  .mobile-cart-pill {
    display: inline-flex;
    align-items: center;
    position: fixed;
    right: 18px;
    bottom: 84px;
    z-index: 99990;
    padding: 10px 16px;
    background: var(--night, #111827);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    gap: 8px;
    transition: transform 180ms ease, box-shadow 180ms ease;
  }

  .mobile-cart-pill:active {
    transform: scale(0.96);
  }

  .mobile-cart-pill.is-hidden {
    display: none !important;
  }
}

/* ---------- 侧边抽屉面板 (Slide-over Cart Drawer) ---------- */
.cart-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.cart-drawer-backdrop.is-active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.cart-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  color: var(--ink, #1a1917);
  box-shadow: -8px 0 36px rgba(0, 0, 0, 0.22);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 300ms;
  overflow: hidden;
}

.cart-drawer-panel.is-active {
  transform: translateX(0) !important;
  visibility: visible !important;
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0s;
}

/* 抽屉顶部头部 */
.cart-drawer-head {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 18px 24px !important;
  border-bottom: 1px solid var(--line, #dfdad0) !important;
  background: #ffffff !important;
  flex-shrink: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.cart-head-title-wrap {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  margin: 0 !important;
}

.cart-head-title-wrap svg {
  color: var(--cinnabar, #b33929) !important;
  flex-shrink: 0 !important;
}

.cart-drawer-title {
  margin: 0 !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  color: var(--ink, #1a1917) !important;
}

.cart-drawer-badge {
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  color: var(--ink-soft, #6b6863) !important;
  background: rgba(0, 0, 0, 0.06) !important;
  padding: 2px 8px !important;
  border-radius: 999px !important;
  line-height: 1.4 !important;
}

.cart-close-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  color: var(--ink-soft, #6b6863) !important;
  cursor: pointer !important;
  transition: all 160ms cubic-bezier(0.16, 1, 0.3, 1) !important;
  outline: none !important;
  flex-shrink: 0 !important;
}

.cart-close-btn:hover {
  background: var(--paper-warm, #f3efe6) !important;
  color: var(--ink, #1a1917) !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
  transform: scale(1.06);
}

/* 抽屉促销横幅 */
.cart-promo-banner {
  margin: 0;
  padding: 10px 22px;
  background: rgba(30, 130, 76, 0.08);
  border-bottom: 1px dashed rgba(30, 130, 76, 0.25);
  font-size: 0.8rem;
  line-height: 1.5;
  color: #185a34;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cart-promo-banner svg {
  flex-shrink: 0;
  color: #1e824c;
}

/* 抽屉可滚动内容区 */
.cart-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 22px;
  -webkit-overflow-scrolling: touch;
}

/* 空状态 */
.cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 16px;
  color: var(--ink-soft, #6b6863);
}

.cart-empty-icon {
  margin-bottom: 14px;
  opacity: 0.55;
}

.cart-empty-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink, #1a1917);
}

.cart-empty-desc {
  margin: 0 0 24px;
  font-size: 0.86rem;
  line-height: 1.6;
  max-width: 280px;
}

.cart-browse-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--night, #111827);
  color: #ffffff;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 160ms ease;
}

.cart-browse-btn:hover {
  opacity: 0.9;
}

/* 定制工件卡片 (Cart Item Card) */
.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-item-card {
  position: relative;
  background: #faf8f5;
  border: 1px solid var(--line, #dfdad0);
  border-radius: 8px;
  padding: 16px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.cart-item-card:hover {
  border-color: #cac4b8;
}

.cart-item-card.has-error {
  border-color: var(--cinnabar, #b33929);
  background-color: #fffaf9;
  animation: shakeCard 320ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shakeCard {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* 卡片头部 */
.cart-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cart-item-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cart-item-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ink, #1a1917);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-item-meta {
  font-size: 0.78rem;
  color: var(--ink-soft, #6b6863);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cart-item-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 6px;
  color: #bab5aa;
}

.cart-item-price-wrap {
  text-align: right;
  flex-shrink: 0;
}

.cart-item-price {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ink, #1a1917);
}

.cart-item-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink-soft, #6b6863);
  cursor: pointer;
  padding: 4px;
  margin-top: 4px;
  border-radius: 4px;
  transition: color 140ms ease, background-color 140ms ease;
}

.cart-item-remove-btn:hover {
  color: var(--cinnabar, #b33929);
  background-color: rgba(179, 57, 41, 0.08);
}

/* 照片插槽 (Photo Slot - 方式B核心交互) */
.cart-photo-slot {
  margin-bottom: 12px;
}

/* 未上传照片：虚线框提示槽 */
.cart-photo-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px dashed #c8c2b6;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.cart-photo-empty:hover {
  border-color: var(--cinnabar, #b33929);
  background-color: #fffdfc;
}

.cart-photo-empty-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-photo-empty-left svg {
  color: var(--ink-soft, #6b6863);
}

.cart-photo-empty-copy {
  display: flex;
  flex-direction: column;
}

.cart-photo-empty-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink, #1a1917);
}

.cart-photo-empty-hint {
  font-size: 0.74rem;
  color: var(--ink-soft, #6b6863);
}

.cart-badge-pending {
  font-size: 0.72rem;
  font-weight: 700;
  color: #8c6a23;
  background: rgba(194, 155, 72, 0.12);
  border: 1px solid rgba(194, 155, 72, 0.35);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

/* 已上传照片：高清预览卡片 */
.cart-photo-filled {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid var(--line, #dfdad0);
  border-radius: 6px;
}

.cart-photo-filled-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.cart-thumb-img {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--line, #dfdad0);
  flex-shrink: 0;
}

.cart-photo-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-photo-filename {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink, #1a1917);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.cart-badge-ready {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1e824c;
  margin-top: 2px;
}

.cart-badge-ready svg {
  color: #1e824c;
}

.cart-photo-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.cart-photo-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line, #dfdad0);
  background: #ffffff;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-soft, #6b6863);
  cursor: pointer;
  transition: all 140ms ease;
}

.cart-photo-btn:hover {
  border-color: var(--ink, #1a1917);
  color: var(--ink, #1a1917);
}

.cart-photo-btn.btn-remove:hover {
  border-color: var(--cinnabar, #b33929);
  color: var(--cinnabar, #b33929);
}

/* 工件特定叮嘱输入框 */
.cart-item-note-row {
  margin-top: 8px;
}

.cart-item-note-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line, #dfdad0);
  border-radius: 4px;
  font-size: 0.78rem;
  background: #ffffff;
  color: var(--ink, #1a1917);
  font-family: inherit;
  transition: border-color 140ms ease;
}

.cart-item-note-input:focus {
  outline: none;
  border-color: var(--ink, #1a1917);
}

/* 抽屉内底部操作栏：加购其他画风 */
.cart-continue-browse {
  margin-top: 14px;
  text-align: center;
}

.cart-add-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 14px;
  border: 1px dashed var(--line, #dfdad0);
  border-radius: 6px;
  background: transparent;
  color: var(--ink, #1a1917);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 160ms ease;
}

.cart-add-more-btn:hover {
  border-color: var(--ink, #1a1917);
  background-color: #faf8f5;
}

/* ---------- 抽屉底部结账收敛区 (Drawer Footer) ---------- */
.cart-drawer-foot {
  padding: 18px 22px;
  background: #faf8f5;
  border-top: 1px solid var(--line, #dfdad0);
  flex-shrink: 0;
}

.cart-contact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.cart-field-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cart-field-col label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink, #1a1917);
}

.cart-field-col label em {
  color: var(--cinnabar, #b33929);
  font-style: normal;
}

.cart-field-col input {
  padding: 8px 10px;
  border: 1px solid var(--line, #dfdad0);
  border-radius: 5px;
  font-size: 0.82rem;
  background: #ffffff;
  color: var(--ink, #1a1917);
  font-family: inherit;
  transition: border-color 140ms ease;
}

.cart-field-col input:focus {
  outline: none;
  border-color: var(--ink, #1a1917);
}

.cart-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cart-total-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink, #1a1917);
}

.cart-total-amount {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink, #1a1917);
  letter-spacing: -0.02em;
}

.cart-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 20px;
  background: var(--night, #111827);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, transform 120ms ease, opacity 160ms ease;
  letter-spacing: 0.01em;
}

.cart-submit-btn:hover:not(:disabled) {
  background-color: #2a3447;
  transform: translateY(-1px);
}

.cart-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cart-trust-line {
  margin: 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--ink-soft, #6b6863);
  text-align: center;
}

.cart-trust-line svg {
  color: var(--sage, #2e6b50);
}

/* 定制页面的【加入定制清单】副按钮样式 */
.btn-add-to-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid var(--line, #dfdad0);
  background: rgba(244, 241, 234, 0.7);
  color: var(--ink, #1a1917);
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 160ms ease;
}

.btn-add-to-cart:hover {
  border-color: var(--ink, #1a1917);
  background-color: #ffffff;
  transform: translateY(-1px);
}

.btn-add-to-cart svg {
  color: currentColor;
}

/* 画谱页面的轻量加购款式按钮 */
.style-catalog-add-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 40px !important;
  margin-top: 8px !important;
  padding: 8px 14px !important;
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  border: 1px dashed var(--line, #dfdad0) !important;
  background: transparent !important;
  color: var(--ink, #1a1917) !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  gap: 6px !important;
  transition: all 160ms ease !important;
}

.style-catalog-add-btn:hover {
  border-color: var(--ink, #1a1917) !important;
  background: #ffffff !important;
  transform: translateY(-1px) !important;
}

.style-catalog-add-btn.is-in-cart,
.btn-add-to-cart.is-in-cart {
  border-style: solid !important;
  border-color: rgba(184, 51, 42, 0.45) !important;
  background: rgba(184, 51, 42, 0.05) !important;
  color: var(--cinnabar, #b8332a) !important;
  font-weight: 700 !important;
}

.style-catalog-add-btn.is-in-cart:hover,
.btn-add-to-cart.is-in-cart:hover {
  background: rgba(184, 51, 42, 0.1) !important;
  border-color: var(--cinnabar, #b8332a) !important;
}
