/* ============================================================
   iTOOL — Cart Page CSS
   For WooCommerce cart page
   Class prefix: .aitc-
   Theme: navy (#1e2a78) + green (#22c55e)
   RTL / Persian (local Dana font)
   ============================================================ */

:root {
  --aitc-bg: #f5f5f5;
  --aitc-surface: #ffffff;
  --aitc-ink: #111111;
  --aitc-muted: #6b7280;
  --aitc-muted-2: #9ca3af;
  --aitc-line: rgba(0,0,0,0.06);
  --aitc-line-dash: #d1d5db;
  --aitc-primary: #1e2a78;
  --aitc-primary-2: #2a3a8c;
  --aitc-primary-soft: rgba(30,42,120,0.08);
  --aitc-accent: #22c55e;
  --aitc-accent-2: #15803d;
  --aitc-danger: #dc2626;
  --aitc-radius: 20px;
  --aitc-radius-sm: 12px;
  --aitc-shadow-1: 0 1px 2px rgba(16,24,40,.04);
  --aitc-shadow-2: 0 18px 40px -14px rgba(16,24,40,.14);
  --aitc-font: var(--itoll-font-family);
}

body.woocommerce-cart {
  background: var(--aitc-bg);
}

/* Break woocommerce div out of Blocksy's narrow container */
body.woocommerce-cart .entry-content,
body.woocommerce-cart .ct-container,
body.woocommerce-cart .ct-container-full,
body.woocommerce-cart .is-layout-constrained > .woocommerce,
body.woocommerce-cart .woocommerce {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Remove Blocksy's vertical spacing on cart page */
body.woocommerce-cart .ct-container-full[data-vertical-spacing] {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Hide Blocksy hero + page title — we have aitc-page-head */
body.woocommerce-cart .hero-section,
body.woocommerce-cart .is-width-constrained.hero-section,
body.woocommerce-cart [data-type="type-1"] .hero-section,
body.woocommerce-cart .entry-header,
body.woocommerce-cart h1.entry-title,
body.woocommerce-cart .ct-page-title {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}


/* Scope all rules so we don't fight the parent theme */
.aitc-page-head,
.aitc-page-head *,
.aitc-cart,
.aitc-cart * {
  box-sizing: border-box;
}

.aitc-page-head,
.aitc-cart {
  font-family: var(--aitc-font);
  color: var(--aitc-ink);
  direction: rtl;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.aitc-page-head {
  background: linear-gradient(180deg, #eef1f7 0%, #f5f5f5 100%);
  padding: 36px 24px 30px;
  border-bottom: 1px solid var(--aitc-line);
}
.aitc-page-head__wrap {
  max-width: 1280px;
  margin: 0 auto;
}
.aitc-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--aitc-muted);
  margin-bottom: 10px;
  font-weight: 500;
}
.aitc-breadcrumb a {
  color: var(--aitc-muted);
  text-decoration: none;
  transition: color .2s;
}
.aitc-breadcrumb a:hover { color: var(--aitc-primary); }
.aitc-breadcrumb .sep { color: var(--aitc-muted-2); }

.aitc-page-head h1 {
  margin: 0;
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 800;
  color: var(--aitc-ink);
  letter-spacing: 0;
}

/* ============================================
   PAGE LAYOUT
   ============================================ */
.aitc-cart {
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 24px 70px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 28px;
  align-items: start;
  background: var(--aitc-bg);
  box-shadow: 0 0 0 100vmax var(--aitc-bg);
  clip-path: inset(0 -100vmax);
}

.aitc-cart__left,
.aitc-cart__right {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* ============================================
   CARDS
   ============================================ */
.aitc-card {
  background: var(--aitc-surface);
  border: 1px solid var(--aitc-line);
  border-radius: var(--aitc-radius);
  box-shadow: 0 8px 22px rgba(16,24,40,.05);
  overflow: hidden;
}

/* ============================================
   ITEMS TABLE
   ============================================ */
.aitc-table {
  width: 100%;
  border-collapse: collapse;
  font-feature-settings: "tnum";
}

.aitc-table thead th {
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--aitc-muted);
  padding: 18px 24px;
  background: #fafbfc;
  border-bottom: 1px solid var(--aitc-line);
  letter-spacing: 0.02em;
}

.aitc-table thead th.qty,
.aitc-table thead th.subtotal {
  text-align: center;
}
.aitc-table thead th.remove { width: 60px; }

.aitc-table tbody td {
  padding: 22px 24px;
  border-bottom: 1px solid var(--aitc-line);
  vertical-align: middle;
}
.aitc-table tbody tr:last-child td { border-bottom: 0; }

/* Product cell */
.aitc-item {
  display: flex;
  align-items: center;
  gap: 18px;
}
.aitc-item__media {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border-radius: var(--aitc-radius-sm);
  background:
    radial-gradient(circle at 30% 25%, rgba(34,197,94,0.05), rgba(34,197,94,0) 60%),
    linear-gradient(135deg, #fafbfc 0%, #f0f2f7 100%);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--aitc-line);
}
.aitc-item__media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.aitc-item__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.aitc-item__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--aitc-ink);
  text-decoration: none;
  line-height: 1.5;
  transition: color .2s;
}
.aitc-item__name:hover { color: var(--aitc-primary); }
.aitc-item__price {
  font-size: 13px;
  color: var(--aitc-muted);
  font-weight: 500;
}

/* Quantity stepper */
.aitc-qty {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--aitc-primary);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  height: 42px;
}
.aitc-qty button {
  width: 38px;
  height: 100%;
  background: transparent;
  border: 0;
  color: var(--aitc-primary);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s;
}
.aitc-qty button:hover {
  background: var(--aitc-primary);
  color: #fff;
}
.aitc-qty input {
  width: 48px;
  height: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--aitc-ink);
  -moz-appearance: textfield;
}
.aitc-qty input::-webkit-outer-spin-button,
.aitc-qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.aitc-qty input:focus { outline: none; }

.aitc-table .qty { text-align: center; }

/* Subtotal cell */
.aitc-subtotal {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--aitc-ink);
  font-feature-settings: "tnum";
}
.aitc-subtotal small {
  font-size: 11px;
  color: var(--aitc-muted);
  font-weight: 500;
  margin-right: 4px;
}

/* Remove button */
.aitc-remove {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--aitc-line);
  background: #fff;
  color: var(--aitc-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.aitc-remove:hover {
  background: rgba(220,38,38,0.08);
  color: var(--aitc-danger);
  border-color: rgba(220,38,38,0.2);
}
.aitc-remove:active { transform: scale(0.94); }
.aitc-remove svg { width: 16px; height: 16px; }

/* ============================================
   COUPON + ACTIONS
   ============================================ */
.aitc-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-top: 1px dashed var(--aitc-line-dash);
  flex-wrap: wrap;
}

.aitc-coupon {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 260px;
  max-width: 440px;
}
.aitc-coupon input {
  flex: 1;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--aitc-line);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: var(--aitc-ink);
  transition: border-color .2s, box-shadow .2s;
  min-width: 0;
}
.aitc-coupon input::placeholder { color: var(--aitc-muted-2); }
.aitc-coupon input:focus {
  outline: none;
  border-color: var(--aitc-primary);
  box-shadow: 0 0 0 3px rgba(30,42,120,0.12);
}

/* ============================================
   BUTTONS
   ============================================ */
.aitc-cart .aitc-btn,
.aitc-totals .aitc-btn,
.aitc-cart .aitc-btn.button,
.aitc-totals .aitc-btn.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 24px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s, transform .15s, opacity .2s;
}
.aitc-cart .aitc-btn:active,
.aitc-totals .aitc-btn:active { transform: translateY(1px); }
.aitc-cart .aitc-btn svg,
.aitc-totals .aitc-btn svg { width: 16px; height: 16px; }

.aitc-cart .aitc-btn--primary,
.aitc-totals .aitc-btn--primary,
.aitc-cart .aitc-btn--primary.button,
.aitc-totals .aitc-btn--primary.button {
  background: var(--aitc-primary) !important;
  color: #fff !important;
  box-shadow: 0 4px 10px -3px rgba(30,42,120,0.35);
}
.aitc-cart .aitc-btn--primary:hover,
.aitc-totals .aitc-btn--primary:hover,
.aitc-cart .aitc-btn--primary.button:hover,
.aitc-totals .aitc-btn--primary.button:hover {
  background: var(--aitc-primary-2) !important;
  color: #fff !important;
  box-shadow: 0 8px 18px -4px rgba(30,42,120,0.45);
}

.aitc-cart .aitc-btn--soft,
.aitc-cart .aitc-btn--soft.button {
  background: #e9ebf3 !important;
  color: var(--aitc-primary) !important;
  box-shadow: none !important;
}
.aitc-cart .aitc-btn--soft:hover,
.aitc-cart .aitc-btn--soft.button:hover {
  background: #dde1ee !important;
  color: var(--aitc-primary) !important;
}

.aitc-cart .aitc-btn--block,
.aitc-totals .aitc-btn--block {
  width: 100%;
  height: 52px;
  font-size: 15px;
}

.aitc-btn[disabled],
.aitc-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   ORDER TOTALS (right sidebar)
   ============================================ */
.aitc-totals {
  position: sticky;
  top: 20px;
  padding: 28px 24px;
  background: var(--aitc-surface);
  border: 1px solid var(--aitc-line);
  border-radius: var(--aitc-radius);
  box-shadow: 0 8px 22px rgba(16,24,40,.05);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.aitc-totals__title {
  font-size: 17px;
  font-weight: 800;
  color: var(--aitc-ink);
  margin: 0;
  letter-spacing: 0;
}

.aitc-totals__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--aitc-line-dash);
}
.aitc-totals__row:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

.aitc-totals__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--aitc-muted);
}
.aitc-totals__value {
  font-size: 15px;
  font-weight: 700;
  color: var(--aitc-ink);
  font-feature-settings: "tnum";
}
.aitc-totals__value small {
  font-size: 11px;
  font-weight: 500;
  color: var(--aitc-muted);
  margin-right: 4px;
}

/* Shipment block */
.aitc-shipment {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--aitc-line-dash);
}
.aitc-shipment__label {
  font-size: 14px;
  font-weight: 700;
  color: var(--aitc-muted);
  margin: 0;
}
.aitc-shipment__desc {
  font-size: 13px;
  line-height: 1.85;
  color: var(--aitc-muted);
  margin: 0;
}
.aitc-shipment__link {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--aitc-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  transition: color .2s, gap .2s;
}
.aitc-shipment__link:hover {
  color: var(--aitc-primary-2);
  gap: 10px;
}
.aitc-shipment__link::after {
  content: "←";
  font-size: 14px;
  font-family: system-ui;
}

/* Grand total */
.aitc-totals__grand {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
}
.aitc-totals__grand .aitc-totals__label {
  font-size: 15px;
  font-weight: 700;
  color: var(--aitc-ink);
}
.aitc-totals__grand .aitc-totals__value {
  font-size: 18px;
  font-weight: 800;
  color: var(--aitc-ink);
}

/* ============================================
   EMPTY CART
   ============================================ */
.aitc-empty {
  text-align: center;
  padding: 60px 24px;
}
.aitc-empty__icon {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--aitc-primary-soft);
  color: var(--aitc-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.aitc-empty__icon svg { width: 40px; height: 40px; }
.aitc-empty__title { font-size: 18px; font-weight: 800; margin: 0 0 6px; }
.aitc-empty__desc  { color: var(--aitc-muted); font-size: 14px; margin: 0 0 20px; }

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet — stack columns */
@media (max-width: 1024px) {
  .aitc-cart {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .aitc-totals { position: static; }
}

/* ============================================
   MOBILE (max 720px)
   ساختار جدید: div.aitc-item با grid — نه table
   RTL: راست→چپ: [عکس 90px] [info 1fr] [حذف 42px]
   ردیف ۲: [قیمت کل] ← → [استپر]
   ============================================ */
@media (max-width: 720px) {

  .aitc-page-head { padding: 20px 16px 16px; }
  .aitc-breadcrumb { font-size: 13px; margin-bottom: 6px; }
  .aitc-page-head h1 { font-size: 22px; line-height: 1.35; }

  .aitc-cart { padding: 14px 12px 40px; gap: 14px; }

  .aitc-card { border-radius: 20px; }

  /* items list */
  .aitc-items-list { padding: 0; }

  .aitc-item {
    display: grid;
    /* RTL: col 1=راست(عکس), col 2=وسط(info), col 3=چپ(حذف) */
    grid-template-columns: 90px 1fr 42px;
    grid-template-rows: auto auto;
    grid-template-areas:
      "media info  del"
      "foot  foot  foot";
    column-gap: 12px;
    row-gap: 14px;
    padding: 18px 16px;
    border-bottom: 1px solid var(--aitc-line);
    align-items: start;
  }
  .aitc-item:last-child { border-bottom: 0; }

  /* عکس — راست */
  .aitc-item__media {
    grid-area: media;
    width: 90px;
    height: 90px;
    padding: 8px;
    border-radius: 14px;
    align-self: center;
  }

  /* نام + قیمت واحد — وسط */
  .aitc-item__info {
    grid-area: info;
    align-self: center;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
  }
  .aitc-item__name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
    text-align: right;
  }
  .aitc-item__price {
    font-size: 13px;
    color: var(--aitc-muted);
    font-weight: 500;
    text-align: right;
  }

  /* حذف — چپ */
  .aitc-item__del {
    grid-area: del;
    align-self: start;
    display: flex;
    justify-content: center;
    padding-top: 2px;
  }

  /* ردیف پایین: قیمت کل راست، استپر چپ */
  .aitc-item__foot {
    grid-area: foot;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .aitc-subtotal {
    font-size: 15px;
    font-weight: 800;
    text-align: right;
    color: var(--aitc-ink);
  }

  /* دکمه حذف */
  .aitc-remove { width: 38px; height: 38px; border-radius: 11px; }
  .aitc-remove svg { width: 17px; height: 17px; }

  /* استپر */
  .aitc-qty { height: 42px; border-width: 2px; border-radius: 12px; }
  .aitc-qty button { width: 36px; font-size: 18px; }
  .aitc-qty input { width: 44px; font-size: 15px; }

  /* actions */
  .aitc-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 16px 16px 20px;
  }
  .aitc-coupon {
    flex-direction: column;
    max-width: 100%;
    min-width: 0;
    gap: 8px;
  }
  .aitc-coupon input {
    height: 46px;
    font-size: 14px;
    text-align: right;
    border-radius: 12px;
  }
  .aitc-cart .aitc-btn,
  .aitc-cart .aitc-btn.button {
    height: 50px;
    border-radius: 12px;
    font-size: 15px;
  }

  /* totals */
  .aitc-totals { padding: 22px 18px; gap: 15px; border-radius: 20px; }
  .aitc-totals__title { font-size: 18px; }
  .aitc-totals__label { font-size: 14px; }
  .aitc-totals__value { font-size: 14px; }
  .aitc-shipment__label { font-size: 14px; }
  .aitc-shipment__desc { font-size: 13px; }
  .aitc-shipment__link { font-size: 14px; }
  .aitc-totals__grand .aitc-totals__label { font-size: 15px; font-weight: 700; }
  .aitc-totals__grand .aitc-totals__value { font-size: 17px; font-weight: 800; }
  .aitc-totals .aitc-btn--block { height: 52px; border-radius: 13px; font-size: 15px; }
}

/* Very small phones */
@media (max-width: 400px) {
  .aitc-cart { padding-right: 10px; padding-left: 10px; }
  .aitc-item { grid-template-columns: 80px 1fr 38px; padding: 16px 12px; }
  .aitc-item__media { width: 80px; height: 80px; }
  .aitc-item__name { font-size: 14px; }
  .aitc-item__price { font-size: 12px; }
  .aitc-subtotal { font-size: 14px; }
  .aitc-qty { height: 38px; }
  .aitc-qty button { width: 32px; font-size: 16px; }
  .aitc-qty input { width: 38px; font-size: 14px; }
  .aitc-remove { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .aitc-cart *, .aitc-page-head * { transition: none !important; }
}
