/* ─────────────────────────────────────────
   cart.css  — آیاک
   متغیرها و کامپوننت‌های مشترک با checkout_detail.css
   ───────────────────────────────────────── */

:root {
  --co-brand:       #1a3a5c;
  --co-brand-mid:   #2a5082;
  --co-brand-light: #e8f0f9;
  --co-teal:        #0d9488;
  --co-teal-bg:     #f0fdfa;
  --co-coral:       #e05240;
  --co-coral-bg:    #fff5f4;
  --co-green:       #16a34a;
  --co-green-bg:    #f0fdf4;
  --co-red:         #dc2626;
  --co-surface:     #ffffff;
  --co-bg:          #f2f5f9;
  --co-border:      rgba(0,0,0,.08);
  --co-border-med:  rgba(0,0,0,.12);
  --co-text:        #1e293b;
  --co-muted:       #64748b;
  --co-radius:      16px;
  --co-shadow:      0 2px 12px rgba(0,0,0,.06);
  --co-shadow-md:   0 6px 24px rgba(0,0,0,.09);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body { background: var(--co-bg); }

/* ────────────────────────────────────────
   Shared atoms (copied from checkout_detail.css)
   تغییر ندهید — این کلاس‌ها در هر دو صفحه مشترک‌اند
   ──────────────────────────────────────── */

.cart-page {
  font-family: var(--font-primary);
  direction: rtl;
  color: var(--co-text);
  padding-bottom: 80px;
}

.co-progress-wrap {
  background: var(--co-surface);
  border-bottom: 1px solid var(--co-border);
  padding: 20px 0;
}

.co-progress {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.co-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.co-step-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--co-bg);
  border: 2px solid var(--co-border-med);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--co-muted);
  transition: all .3s;
}

.co-step.active .co-step-dot {
  background: #fff;
  border-color: var(--co-brand);
  color: var(--co-brand);
  box-shadow: 0 0 0 4px var(--co-brand-light);
}

.co-step.done .co-step-dot {
  background: var(--co-brand);
  border-color: var(--co-brand);
  color: #fff;
}

.co-step span {
  font-size: 12px;
  color: var(--co-muted);
  white-space: nowrap;
}

.co-step.active span, .co-step.done span {
  color: var(--co-brand);
  font-weight: 600;
}

.co-step-line {
  flex: 1;
  height: 2px;
  background: var(--co-border-med);
  min-width: 40px;
  max-width: 80px;
  margin-bottom: 22px;
}

.co-step-line.done { background: var(--co-brand); }

.co-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 0;
}

.co-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.co-card {
  background: var(--co-surface);
  border-radius: var(--co-radius);
  border: 1px solid var(--co-border);
  box-shadow: var(--co-shadow);
  overflow: hidden;
  animation: cardIn .45s cubic-bezier(.22,.68,0,1.2) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.co-card-body.no-pad { padding: 0; }

.co-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.co-icon-wrap.coral { background: var(--co-coral-bg); color: var(--co-coral); }
.co-icon-wrap.teal  { background: var(--co-teal-bg);  color: var(--co-teal);  }

.co-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--co-border-med);
  background: transparent;
  color: var(--co-brand);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, color .2s;
  font-family: inherit;
}

.co-link-btn:hover { background: var(--co-brand); color: #fff; border-color: var(--co-brand); }

.co-sidebar { position: sticky; top: 24px; }

.co-summary {
  background: var(--co-surface);
  border-radius: var(--co-radius);
  border: 1px solid var(--co-border);
  box-shadow: var(--co-shadow-md);
  overflow: hidden;
  animation: cardIn .45s .2s cubic-bezier(.22,.68,0,1.2) both;
}

.co-summary-head {
  background: var(--co-brand);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
}

.co-summary-badge {
  background: rgba(255,255,255,.18);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
}

.co-summary-body { padding: 18px 20px; }

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--co-border);
  gap: 12px;
}

.summary-row span { color: var(--co-muted); }

.summary-row strong {
  color: var(--co-brand);
  font-weight: 700;
  font-size: 15px;
}

.summary-row strong small { font-size: 11px; font-weight: 400; color: var(--co-muted); }

.summary-row.discount strong { color: var(--co-green); }

.summary-divider { height: 1px; background: var(--co-border-med); margin: 10px 0 16px; }

.summary-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 18px;
}

.summary-total span { font-size: 15px; font-weight: 600; color: var(--co-text); }
.summary-total strong { font-size: 21px; font-weight: 800; color: var(--co-green); }

.pay-btn {
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
  font-family: inherit;
}

.pay-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(22,163,74,.28);
  color: #fff;
}

.secure-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--co-muted);
}

.secure-row i { color: var(--co-green); }

.co-mobile-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--co-surface);
  border-top: 1px solid var(--co-border-med);
  padding: 12px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.07);
}

.co-mobile-price span { display: block; font-size: 11px; color: var(--co-muted); }
.co-mobile-price strong { font-size: 17px; font-weight: 800; color: var(--co-brand); }

.co-mobile-pay {
  height: 46px;
  padding: 0 22px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
}

/* ────────────────────────────────────────
   Cart-specific styles
   ──────────────────────────────────────── */

.cart-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cart-page-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cart-page-title h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--co-brand);
  margin-bottom: 2px;
}

.cart-page-title p {
  font-size: 13px;
  color: var(--co-muted);
}

.cart-footer-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Notice banner */
.cart-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14px;
  color: #1e40af;
  margin-bottom: 20px;
  line-height: 1.8;
}

.cart-notice a { color: #1d4ed8; font-weight: 700; }
.cart-notice i { margin-top: 3px; flex-shrink: 0; font-size: 16px; }

/* Item rows */
.cart-item-row {
  display: grid;
  grid-template-columns: 80px 1fr 160px 140px;
  gap: 18px;
  align-items: center;
  padding: 20px 24px;
  transition: background .2s;
}

.cart-item-row:hover { background: #fafbfc; }
.cart-item-row.bordered { border-bottom: 1px solid var(--co-border); }

/* image */
.cart-item-img {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--co-border);
}

.cart-item-img img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}

.cart-item-img:hover img { transform: scale(1.05); }

/* info */
.cart-item-info { min-width: 0; }

.cart-item-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--co-brand);
  text-decoration: none;
  margin-bottom: 8px;
  line-height: 1.5;
  transition: color .2s;
}

.cart-item-title:hover { color: var(--co-teal); }

.cart-item-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f1f5f9;
  color: var(--co-muted);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
}

.meta-pill.muted { background: #f8fafc; }

.cart-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge-digital {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.cart-digital-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
}

.badge-custom {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
}

.badge-discount {
  display: inline-block;
  background: #fee2e2;
  color: #991b1b;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

/* qty column */
.cart-item-qty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.qty-form {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 6px 8px;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--co-surface);
  color: var(--co-brand);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.qty-btn:hover { background: var(--co-brand-light); }
.qty-btn:disabled { opacity: .4; cursor: default; }

.qty-input {
  width: 44px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--co-text);
  border: none;
  background: transparent;
  font-family: inherit;
  outline: none;
}

.unit-price {
  text-align: center;
  line-height: 1.6;
}

.price-original {
  display: block;
  font-size: 11px;
  color: var(--co-muted);
  text-decoration: line-through;
}

.price-discounted {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--co-red);
}

.price-normal {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--co-brand);
}

.price-unit {
  font-size: 11px;
  color: var(--co-muted);
}

/* total column */
.cart-item-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.row-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--co-brand);
}

.row-price span { font-size: 12px; font-weight: 400; color: var(--co-muted); margin-right: 3px; }

.row-saving {
  font-size: 11px;
  color: var(--co-green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.remove-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--co-muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background .2s, color .2s;
}

.remove-btn:hover { background: #fee2e2; color: var(--co-red); }

/* coupon */
.coupon-form {
  display: flex;
  gap: 8px;
  margin: 14px 0 8px;
}

.coupon-form input {
  flex: 1;
  height: 42px;
  border: 1px solid var(--co-border-med);
  border-radius: 10px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  background: var(--co-surface);
  color: var(--co-text);
  transition: border-color .2s, box-shadow .2s;
}

.coupon-form input::placeholder { color: var(--co-muted); opacity: .7; }
.coupon-form input:focus { border-color: var(--co-brand); box-shadow: 0 0 0 3px var(--co-brand-light); }

.coupon-form button {
  height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--co-border-med);
  background: var(--co-surface);
  color: var(--co-brand);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, color .2s;
  white-space: nowrap;
}

.coupon-form button:hover { background: var(--co-brand); color: #fff; border-color: var(--co-brand); }

.coupon-active {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--co-green-bg);
  color: #15803d;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #bbf7d0;
  margin-bottom: 4px;
}

.coupon-active i { color: var(--co-green); }

/* Empty cart */
.empty-cart {
  text-align: center;
  padding: 80px 24px;
  background: var(--co-surface);
  border-radius: var(--co-radius);
  border: 1px solid var(--co-border);
  box-shadow: var(--co-shadow);
  animation: cardIn .5s cubic-bezier(.22,.68,0,1.2) both;
}

.empty-cart-icon {
  font-size: 56px;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.empty-cart h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--co-brand);
  margin-bottom: 12px;
}

.empty-cart p {
  font-size: 14px;
  color: var(--co-muted);
  line-height: 1.9;
  max-width: 400px;
  margin: 0 auto 28px;
}

/* ── Responsive ────────────────────────── */
@media (max-width: 980px) {
  .co-layout { grid-template-columns: 1fr; }
  .co-sidebar { position: relative; top: auto; }
}

@media (max-width: 768px) {
  .co-sidebar { display: none; }
  .co-mobile-bar { display: flex; }
  .cart-page { padding-bottom: 76px; }

  .cart-item-row {
    grid-template-columns: 64px 1fr;
    grid-template-rows: auto auto;
  }

  .cart-item-qty {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    border-top: 1px solid var(--co-border);
    padding-top: 14px;
    margin-top: 4px;
  }

  .cart-item-total {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .cart-item-row { padding: 16px; gap: 12px; }
}