
/* ============================================
   购物车页面 v2.0 - CandyCake Style
   ============================================ */

/* === 页面布局 === */
.cc-cart-wrap {
  padding: 24px 32px;
  min-height: calc(100vh - 180px);
}

.cc-cart-container {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 1200px) {
  .cc-cart-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .cc-cart-wrap {
    padding: 16px;
  }
}

/* === 页面标题 === */
.cc-cart-header {
  margin-bottom: 24px;
}

.cc-cart-title {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cc-cart-title i {
  font-size: 28px;
  color: #2563eb;
}

.cc-cart-count {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  padding: 4px 12px;
  border-radius: 999px;
}

/* === 通用卡片 === */
.cc-cart-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.cc-cart-card + .cc-cart-card {
  margin-top: 20px;
}

.cc-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cc-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cc-card-title i {
  color: #2563eb;
}

.cc-card-body {
  padding: 20px 24px;
}

/* === 商品列表 === */
.cc-products-list {
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 8px;
}

.cc-products-list::-webkit-scrollbar {
  width: 6px;
}

.cc-products-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.cc-product-item {
  padding: 16px;
  border: 1px solid #f1f5f9;
  border-radius: 14px;
  background: #fafbfc;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.cc-product-item:hover {
  border-color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.cc-product-item:last-child {
  margin-bottom: 0;
}

.cc-product-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cc-product-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.cc-product-actions {
  display: flex;
  gap: 8px;
}

.cc-product-actions .btn {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.cc-btn-edit {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.cc-btn-edit:hover {
  background: #dbeafe;
  color: #1d4ed8;
}

.cc-btn-del {
  background: #fff5f5;
  color: #ef4444;
  border: 1px solid #fecaca;
}

.cc-btn-del:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* 配置项标签 */
.cc-product-configs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.cc-config-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  color: #475569;
}

.cc-config-tag span {
  color: #0f172a;
  font-weight: 600;
  margin-left: 4px;
}

/* 价格行 */
.cc-product-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-top: 1px dashed #e2e8f0;
}

.cc-product-price-row:first-of-type {
  border-top: none;
  padding-top: 0;
}

.cc-price-label {
  font-size: 13px;
  color: #64748b;
}

.cc-price-value {
  font-size: 13px;
  color: #0f172a;
}

.cc-price-discount {
  color: #ef4444;
}

.cc-price-subtotal {
  font-size: 16px;
  font-weight: 700;
  color: #2563eb;
}

/* 数量编辑 */
.cc-qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.cc-qty-control input {
  width: 60px;
  height: 32px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
}

.cc-qty-btn {
  padding: 4px 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}

.cc-qty-btn:hover {
  background: #e2e8f0;
}

/* === 购物车空状态 === */
.cc-cart-empty {
  padding: 48px 24px;
  text-align: center;
}

.cc-empty-icon {
  font-size: 64px;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.cc-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.cc-empty-desc {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 20px;
}

.cc-empty-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.cc-empty-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.cc-empty-actions .btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.cc-empty-actions .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
  color: #fff;
}

.cc-empty-actions .btn-outline-primary {
  background: #fff;
  color: #2563eb;
  border: 1px solid #2563eb;
}

.cc-empty-actions .btn-outline-primary:hover {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #1d4ed8;
}

/* === 订单汇总（右侧） === */
.cc-summary-card {
  position: sticky;
  top: 100px;
}

.cc-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.cc-summary-row:last-child {
  border-bottom: none;
}

.cc-summary-label {
  font-size: 14px;
  color: #64748b;
}

.cc-summary-value {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.cc-summary-total {
  background: linear-gradient(135deg, #f8fbff, #eff6ff);
  padding: 16px;
  margin: 24px -24px -20px;
  border-top: 2px dashed #e2e8f0;
}

.cc-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.cc-total-label {
  font-size: 14px;
  color: #64748b;
}

.cc-total-amount {
  font-size: 28px;
  font-weight: 800;
  color: #e64a19;
}

.cc-total-prefix {
  font-size: 16px;
  font-weight: 600;
}

/* === 支付方式 === */
.cc-payment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.cc-payment-item {
  position: relative;
  padding: 14px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.cc-payment-item:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.cc-payment-item.active {
  border-color: #2563eb;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.cc-payment-item input {
  position: absolute;
  opacity: 0;
}

.cc-payment-icon {
  height: 28px;
  max-width: 80px;
  object-fit: contain;
}

.cc-payment-name {
  font-size: 12px;
  color: #475569;
  text-align: center;
}

.cc-payment-item.active .cc-payment-name {
  color: #1d4ed8;
  font-weight: 600;
}

.cc-payment-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #fff;
  transition: all 0.2s ease;
}

.cc-payment-item.active .cc-payment-check {
  border-color: #2563eb;
  background: #2563eb;
}

.cc-payment-item.active .cc-payment-check::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%) rotate(-45deg);
  width: 8px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
}

/* 禁用状态 */
.cc-payment-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === 余额抵扣 === */
.cc-balance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: linear-gradient(135deg, #fefce8, #fef9c3);
  border: 1px solid #fde047;
  border-radius: 12px;
}

.cc-balance-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cc-balance-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #facc15, #eab308);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}

.cc-balance-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cc-balance-title {
  font-size: 14px;
  font-weight: 600;
  color: #854d0e;
}

.cc-balance-amount {
  font-size: 12px;
  color: #a16207;
}

.cc-balance-amount strong {
  color: #b45309;
  font-weight: 700;
}

/* === 优惠码 === */
.cc-promo-wrap {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed #e2e8f0;
}

.cc-promo-input {
  display: flex;
  gap: 8px;
}

.cc-promo-input input {
  flex: 1;
  height: 44px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  background: #f8fafc;
}

.cc-promo-input input:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cc-promo-btn {
  height: 44px;
  padding: 0 20px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cc-promo-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.cc-promo-applied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #6ee7b7;
  border-radius: 12px;
}

.cc-promo-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #059669;
  font-weight: 600;
}

.cc-promo-tag i {
  font-size: 18px;
}

.cc-promo-remove {
  color: #64748b;
  font-size: 13px;
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}

.cc-promo-remove:hover {
  color: #ef4444;
  border-color: #fecaca;
  background: #fff5f5;
}

/* === 条款与结算 === */
.cc-checkout-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #f1f5f9;
}

.cc-terms-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.cc-checkbox {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: #475569;
}

.cc-checkbox input {
  position: absolute;
  opacity: 0;
}

.cc-checkbox-box {
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.cc-checkbox input:checked + .cc-checkbox-box {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: #2563eb;
}

.cc-checkbox input:checked + .cc-checkbox-box::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 7px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.cc-checkbox a {
  color: #2563eb;
  text-decoration: none;
}

.cc-checkbox a:hover {
  text-decoration: underline;
}

.cc-checkout-btn {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

.cc-checkout-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.4);
}

.cc-checkout-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.cc-checkout-btn i {
  font-size: 20px;
}

/* 按钮加载状态 */
.cc-checkout-btn.is-loading,
.cc-mobile-checkout.is-loading {
  background: linear-gradient(135deg, #64748b, #475569);
  pointer-events: none;
}

.cc-btn-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cc-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes cc-spin {
  to { transform: rotate(360deg); }
}

/* === 登录/注册区域 === */
.cc-auth-card {
  margin-bottom: 20px;
}

.cc-auth-toggle {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.cc-auth-toggle .btn {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  font-weight: 600;
}

.cc-auth-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .cc-auth-form {
    grid-template-columns: 1fr;
  }
}

.cc-auth-form .form-group {
  margin: 0;
}

.cc-auth-form .form-group.full-width {
  grid-column: span 2;
}

@media (max-width: 768px) {
  .cc-auth-form .form-group.full-width {
    grid-column: span 1;
  }
}

.cc-auth-form .form-control {
  height: 44px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 0 14px;
  font-size: 14px;
  background: #f8fafc;
}

.cc-auth-form .form-control:focus {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* === 移动端底部栏 === */
.cc-mobile-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.1);
  padding: 12px 16px;
  z-index: 1000;
}

@media (max-width: 768px) {
  .cc-mobile-bar {
    display: block;
  }
  
  .cc-summary-card {
    display: none;
  }
}

.cc-mobile-bar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cc-mobile-total {
  display: flex;
  flex-direction: column;
}

.cc-mobile-total-label {
  font-size: 12px;
  color: #64748b;
}

.cc-mobile-total-amount {
  font-size: 22px;
  font-weight: 800;
  color: #e64a19;
}

.cc-mobile-checkout {
  flex: 1;
  max-width: 200px;
  height: 48px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
}

/* === 错误提示 === */
.cc-alert {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cc-alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.cc-alert i {
  font-size: 20px;
}

/* === 响应式调整 === */
@media (max-width: 768px) {
  .cc-cart-header {
    margin-bottom: 16px;
  }
  
  .cc-cart-title {
    font-size: 20px;
  }
  
  .cc-card-body {
    padding: 16px;
  }
  
  .cc-product-head {
    flex-direction: column;
    gap: 12px;
  }
  
  .cc-product-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .cc-payment-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .cc-balance-card {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .cc-balance-left {
    flex-direction: column;
  }
}

/* 隐藏原有样式干扰 */
.new-user { display: none; }
.old-user.btn { display: inline-block !important; }
.new-user.btn { display: inline-block !important; }
