/*
========================================================
File: cart-page.css
Path: /assets/css/
Description:
Custom cart page styling aligned with the provided reference.
========================================================
*/

:root {
  --asc-cart-blue: #064588;
  --asc-cart-blue-soft: #dcebfb;
  --asc-cart-blue-bg: #f3f8fe;
  --asc-cart-blue-line: #cddced;
  --asc-cart-green: #177738;
  --asc-cart-green-2: #239046;
  --asc-cart-danger: #c24141;
  --asc-cart-danger-bg: #ffe1e1;
  --asc-cart-text: #0f3253;
  --asc-cart-text-soft: #506378;
}

.woocommerce-cart {
  background:
    radial-gradient(
      circle at top right,
      rgb(232 241 251 / 88%),
      transparent 34%
    ),
    radial-gradient(
      circle at left center,
      rgb(225 240 255 / 70%),
      transparent 24%
    ),
    linear-gradient(180deg, #f7fbff 0%, #eef4fb 55%, #edf2f8 100%);
}

.woocommerce-cart .entry-content,
.woocommerce-cart .site-content {
  background: transparent;
}

.woocommerce-cart .entry-title,
.woocommerce-cart .woocommerce h1 {
  margin: 8px auto 16px;
  max-width: 1240px;
  padding: 0 12px;
  color: #071827;
  font-family: "Cairo", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(34px, 4.1vw, 54px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-align: start;
}

.woocommerce-cart .woocommerce {
  max-width: 1240px;
  margin: 0 auto 36px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(340px, 30vw, 420px);
  gap: clamp(20px, 2vw, 28px);
  align-items: start;
}

.woocommerce-cart .woocommerce-notices-wrapper {
  grid-column: 1 / -1;
}

.woocommerce-cart .woocommerce-cart-form,
.woocommerce-cart .cart-collaterals {
  min-width: 0;
}

.woocommerce-cart .woocommerce-cart-form {
  position: relative;
  overflow-x: auto;
}

.woocommerce-cart .woocommerce-cart-form.is-updating table.shop_table {
  opacity: 0.72;
  transition: opacity 0.2s ease;
}

.woocommerce-cart table.shop_table {
  width: 100%;
  margin: 0;
  border: 1px solid var(--asc-cart-blue-line) !important;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  border-collapse: separate;
  border-spacing: 0;
  max-width: 100%;
  table-layout: auto;
  box-shadow:
    0 18px 38px rgb(8 44 81 / 14%),
    inset 0 1px 0 rgb(255 255 255 / 90%);
}

.woocommerce-cart table.shop_table thead th.product-thumbnail,
.woocommerce-cart table.shop_table tbody td.product-thumbnail {
  display: none;
}

.woocommerce-cart table.shop_table thead th {
  padding: 16px 14px;
  border: 0;
  background: linear-gradient(180deg, #e8f2ff 0%, #d8eaff 100%);
  color: #0b2338;
  font-family: "Cairo", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(16px, 1.18vw, 24px);
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  box-shadow: inset 0 -1px 0 rgb(151 183 212 / 48%);
}

.woocommerce-cart table.shop_table thead th.product-name {
  text-align: start;
}

.woocommerce-cart table.shop_table thead th.product-price,
.woocommerce-cart table.shop_table tbody td.product-price {
  width: 140px;
}

.woocommerce-cart table.shop_table thead th.product-quantity,
.woocommerce-cart table.shop_table tbody td.product-quantity {
  width: 158px;
}

.woocommerce-cart table.shop_table thead th.product-subtotal,
.woocommerce-cart table.shop_table tbody td.product-subtotal {
  width: 160px;
}

.woocommerce-cart table.shop_table thead th.product-remove,
.woocommerce-cart table.shop_table tbody td.product-remove {
  width: 54px;
}

.woocommerce-cart table.shop_table tbody td {
  padding: 12px 14px;
  border-top: 1px solid #dbe6f0;
  vertical-align: middle;
  background: #fff;
}

.woocommerce-cart table.shop_table tbody tr:first-child td {
  border-top: 0;
}

.woocommerce-cart .product-name,
.woocommerce-cart .product-price,
.woocommerce-cart .product-quantity,
.woocommerce-cart .product-subtotal,
.woocommerce-cart .product-remove {
  text-align: center;
}

.woocommerce-cart .product-name {
  text-align: start;
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.woocommerce-cart .asc-cart__product {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  min-width: 0;
}

.woocommerce-cart .asc-cart__product-media {
  flex: 0 0 160px;
  width: 160px;
  margin-top: 2px;
}

.woocommerce-cart .asc-cart__product-media a {
  border-radius: 16px;
  overflow: hidden;
}

.woocommerce-cart .asc-cart__product-media a,
.woocommerce-cart .asc-cart__product-media img {
  display: block;
}

.woocommerce-cart .asc-cart__product-media img {
  width: 150px !important;
  height: 150px !important;
  max-width: none !important;
  margin: 0 auto !important;
  border-radius: 16px !important;
  border: 1px solid #ccdae7 !important;
  background: #fff !important;
  object-fit: cover !important;
  object-position: center !important;
  box-shadow: 0 10px 18px rgb(13 41 68 / 13%) !important;
}

.woocommerce-cart .asc-cart__product-content {
  min-width: 0;
  flex: 1;
}

.woocommerce-cart .product-name a {
  color: var(--asc-cart-text);
  display: inline-block;
  font-size: clamp(17px, 1.2vw, 27px);
  font-weight: 600;
  text-decoration: none;
}

.woocommerce-cart .product-name a:hover {
  color: var(--asc-cart-blue);
}

.woocommerce-cart .product-name .variation,
.woocommerce-cart .product-name .wc-item-meta,
.woocommerce-cart .product-name .backorder_notification {
  margin: 4px 0 0;
  color: var(--asc-cart-text-soft);
  font-size: 13px;
}

.woocommerce-cart .product-price .amount,
.woocommerce-cart .product-price .woocommerce-Price-amount {
  color: #0d141a;
  font-size: clamp(18px, 1.15vw, 25px);
  font-weight: 700;
  white-space: nowrap;
}

.woocommerce-cart .product-subtotal .amount,
.woocommerce-cart .product-subtotal .woocommerce-Price-amount {
  color: var(--asc-cart-green);
  font-size: clamp(18px, 1.2vw, 27px);
  font-weight: 700;
  white-space: nowrap;
}

.woocommerce-cart .quantity {
  direction: ltr;
  display: inline-flex;
  align-items: center;
  border: 1px solid #aabac8;
  border-radius: 12px;
  overflow: hidden;
  background: #eaf1f8;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 65%);
}

.woocommerce-cart .quantity .qty {
  width: 48px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-inline: 1px solid #bbc9d6;
  border-radius: 0;
  background: #fff;
  color: #141f29;
  font-size: clamp(15px, 1.02vw, 22px);
  font-weight: 700;
  text-align: center;
}

.woocommerce-cart .quantity .minus,
.woocommerce-cart .quantity .plus {
  min-width: 32px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #e7eff7;
  color: #102131;
  font-size: clamp(16px, 1.1vw, 24px);
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.woocommerce-cart .quantity .minus:hover,
.woocommerce-cart .quantity .plus:hover {
  background: #d8e7f5;
}

.woocommerce-cart a.remove {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px;
  line-height: 25px !important;
  margin: 0 auto;
  border-radius: 999px;
  border: 1px solid rgb(194 65 65 / 18%) !important;
  background: var(--asc-cart-danger-bg) !important;
  color: var(--asc-cart-danger) !important;
  font-size: clamp(14px, 1vw, 21px);
  font-weight: 700;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease;
}

.woocommerce-cart a.remove:hover {
  background: var(--asc-cart-danger) !important;
  color: #fff !important;
  transform: scale(1.05);
}

.woocommerce-cart .actions {
  padding: 18px 20px !important;
  border-top: 1px solid #d8e2ec;
  background: linear-gradient(180deg, #f8fbff 0%, #edf5fd 100%);
}

.woocommerce-cart .asc-cart__actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.woocommerce-cart .actions .coupon {
  display: flex;
  align-items: center;
  gap: 10px;
  float: none;
  flex-wrap: wrap;
}

.woocommerce-cart .coupon .asc-cart__coupon-label {
  margin: 0;
  color: #0b1f33;
  font-family: "Cairo", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(16px, 1.05vw, 20px);
  font-weight: 700;
  white-space: nowrap;
}

.woocommerce-cart .coupon .input-text {
  width: 160px;
  min-height: 44px;
  margin: 0;
  border: 1px solid #b8c9da !important;
  border-radius: 12px !important;
  background: #fff;
  color: #20364d;
  font-size: clamp(14px, 0.98vw, 19px);
  padding: 0 14px !important;
  box-shadow: inset 0 1px 1px rgb(15 50 83 / 5%);
}

.woocommerce-cart .actions .button,
.woocommerce-cart .coupon .button,
.woocommerce-cart button[name="apply_coupon"],
.woocommerce-cart button[name="update_cart"] {
  min-height: 44px;
  padding: 0 20px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: linear-gradient(
    180deg,
    #1565b0 0%,
    var(--asc-cart-blue) 100%
  ) !important;
  color: #fff !important;
  font-size: clamp(14px, 1vw, 18px);
  font-weight: 700;
  box-shadow: 0 10px 18px rgb(6 69 136 / 24%);
}

.woocommerce-cart button[name="update_cart"] {
  margin-inline-start: auto;
  float: none;
}

.woocommerce-cart .actions .button:hover,
.woocommerce-cart .coupon .button:hover,
.woocommerce-cart button[name="apply_coupon"]:hover,
.woocommerce-cart button[name="update_cart"]:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.woocommerce-cart .actions::before,
.woocommerce-cart .actions::after {
  content: none !important;
}

.woocommerce-cart .cart-collaterals,
.woocommerce-cart .cart_totals {
  width: 100% !important;
  float: none !important;
}

/* بعض الإضافات/السكريبتات قد تطبع cart_totals مرة ثانية خارج cart-collaterals */
.woocommerce-cart .cart-collaterals ~ .cart_totals {
  display: none !important;
}

.woocommerce-cart .cart_totals {
  position: sticky;
  top: 112px;
  z-index: 10;
  border: 1px solid var(--asc-cart-blue-line);
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow:
    0 18px 38px rgb(8 44 81 / 15%),
    inset 0 1px 0 rgb(255 255 255 / 88%);
}

.admin-bar .woocommerce-cart .cart_totals {
  top: 144px;
}

.woocommerce-cart .cart_totals h2 {
  margin: 0;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #d5e1ed;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9ff 100%);
  color: #091827;
  font-family: "Cairo", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(22px, 1.55vw, 33px);
  font-weight: 800;
  text-align: center;
}

.woocommerce-cart .cart_totals table {
  margin: 0;
  border: 0;
  width: 100%;
  table-layout: fixed;
}

.woocommerce-cart .cart_totals table.shop_table tr {
  display: table-row;
}

.woocommerce-cart .cart_totals table th,
.woocommerce-cart .cart_totals table td {
  padding: 16px 18px;
  border-top: 1px solid #d9e3ed;
  color: #102131;
  font-size: clamp(18px, 1.16vw, 26px);
  font-weight: 700;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

.woocommerce-cart .cart_totals table th {
  min-width: 0;
  text-align: center;
}

.woocommerce-cart .cart_totals table td {
  min-width: 0;
  text-align: center;
}

.woocommerce-cart .cart_totals table tr:first-child th,
.woocommerce-cart .cart_totals table tr:first-child td {
  border-top: 0;
}

.woocommerce-cart .cart_totals .shipping ul,
.woocommerce-cart .cart_totals .shipping p {
  margin: 0;
}

.woocommerce-cart .cart_totals .shipping td {
  text-align: center;
}

.woocommerce-cart .cart_totals .order-total th,
.woocommerce-cart .cart_totals .order-total td {
  color: #091827;
  font-size: clamp(22px, 1.35vw, 30px);
  font-weight: 800;
}

.woocommerce-cart .cart_totals .amount,
.woocommerce-cart .cart_totals .woocommerce-Price-amount {
  color: #091827;
  white-space: nowrap;
}

.woocommerce-cart .wc-proceed-to-checkout {
  margin: 0;
  padding: 14px 18px 18px;
  display: flex;
  justify-content: center;
}

.woocommerce-cart .wc-proceed-to-checkout .checkout-button {
  margin: 0 auto !important;
  min-height: 50px;
  width: 100%;
  max-width: 260px;
  border: 0;
  border-radius: 14px !important;
  background: linear-gradient(
    180deg,
    var(--asc-cart-green-2) 0%,
    var(--asc-cart-green) 100%
  ) !important;
  color: #fff !important;
  font-family: "Cairo", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(16px, 1.05vw, 20px) !important;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 14px 24px rgb(23 119 56 / 28%);
}

.woocommerce-cart .wc-proceed-to-checkout .checkout-button:hover {
  transform: translateY(-1px);
  opacity: 0.96;
}

.woocommerce-cart .woocommerce-message,
.woocommerce-cart .woocommerce-info,
.woocommerce-cart .woocommerce-error {
  border-radius: 12px;
  border: 1px solid #c7d6e5;
  background: #fff;
  color: var(--asc-cart-blue);
}

.woocommerce-cart .woocommerce-message {
  border-inline-start: 5px solid var(--asc-cart-green);
}

.woocommerce-cart .woocommerce-message.asc-cart-auto-dismiss {
  overflow: hidden;
  transition:
    opacity 0.35s ease,
    transform 0.35s ease,
    max-height 0.35s ease,
    margin 0.35s ease,
    padding 0.35s ease,
    border-width 0.35s ease;
}

.woocommerce-cart .woocommerce-message.asc-cart-auto-dismiss.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

.woocommerce-cart .woocommerce-error {
  border-inline-start: 5px solid var(--asc-cart-danger);
  border-color: rgb(194 65 65 / 28%);
  background: rgb(194 65 65 / 6%);
  color: var(--asc-cart-danger);
}

.woocommerce-cart .woocommerce-error .button,
.woocommerce-cart .woocommerce-error a.button {
  border: 0;
  border-radius: 999px;
  background: var(--asc-cart-danger);
  color: #fff;
}

@media (max-width: 1440px) {
  .woocommerce-cart .cart_totals table th,
  .woocommerce-cart .cart_totals table td {
    font-size: clamp(16px, 1.25vw, 22px);
  }

  .woocommerce-cart .cart_totals .order-total th,
  .woocommerce-cart .cart_totals .order-total td {
    font-size: clamp(22px, 2.4vw, 34px);
  }
}

@media (min-width: 1441px) {
  .woocommerce-cart .cart-collaterals {
    min-width: 340px;
  }

  .woocommerce-cart .cart_totals {
    margin-left: 16px;
    width: 100% !important;
  }

  .woocommerce-cart .cart_totals table th,
  .woocommerce-cart .cart_totals table td {
    font-size: clamp(15px, 0.9vw, 18px);
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  .woocommerce-cart .cart_totals table th {
    white-space: normal;
  }

  .woocommerce-cart .cart_totals .order-total th,
  .woocommerce-cart .cart_totals .order-total td {
    font-size: clamp(20px, 1.15vw, 26px);
  }

  .woocommerce-cart .wc-proceed-to-checkout .checkout-button {
    max-width: 220px;
    margin-inline-start: auto !important;
  }
}

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

  .woocommerce-cart .cart-collaterals {
    width: 100% !important;
    max-width: 100%;
  }

  .woocommerce-cart .cart_totals {
    position: relative;
    top: 0;
    width: 100% !important;
    max-width: 100%;
    margin-top: 0;
  }

  .woocommerce-cart .cart_totals table {
    width: 100%;
    table-layout: auto;
  }

  .woocommerce-cart .cart_totals table th,
  .woocommerce-cart .cart_totals table td {
    padding: 16px 20px;
  }

  .woocommerce-cart .cart_totals table th,
  .woocommerce-cart .cart_totals table td {
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  .woocommerce-cart .cart_totals table th {
    text-align: center;
    min-width: 0;
    white-space: normal;
  }

  .woocommerce-cart .cart_totals table td {
    text-align: center;
    min-width: 0;
  }

  .woocommerce-cart .cart_totals .shipping td {
    text-align: center;
  }

  .woocommerce-cart .cart_totals .shipping th,
  .woocommerce-cart .cart_totals .shipping td {
    align-self: center;
    white-space: normal;
  }

  .woocommerce-cart .cart_totals table th,
  .woocommerce-cart .cart_totals table td {
    font-size: clamp(16px, 1.25vw, 22px);
  }

  .woocommerce-cart .cart_totals .order-total th,
  .woocommerce-cart .cart_totals .order-total td {
    font-size: clamp(22px, 2.4vw, 34px);
  }

  .woocommerce-cart .cart_totals .order-total th {
    white-space: nowrap;
  }
}

@media (max-width: 900px) {
  .woocommerce-cart .asc-cart__product-media {
    flex: 0 0 120px;
    width: 120px;
  }

  .woocommerce-cart .asc-cart__product-media img {
    width: 110px !important;
    height: 110px !important;
  }
}

@media (max-width: 991px) {
  .woocommerce-cart .entry-title,
  .woocommerce-cart .woocommerce h1 {
    margin-top: 2px;
  }

  .woocommerce-cart table.shop_table thead {
    display: none;
  }

  /* --- Main Cart Items Table --- */
  .woocommerce-cart table.shop_table.cart,
  .woocommerce-cart table.shop_table.cart tbody,
  .woocommerce-cart table.shop_table.cart tr,
  .woocommerce-cart table.shop_table.cart td {
    display: block;
    width: 100% !important;
  }

  .woocommerce-cart table.shop_table.cart tbody tr.cart_item {
    position: relative;
    padding: 18px 18px 16px;
    border-bottom: 1px solid #dbe6f0;
  }

  .woocommerce-cart table.shop_table.cart tbody tr.cart_item td {
    padding: 12px 0 !important;
    border: 0;
    background: transparent;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
  }

  .woocommerce-cart table.shop_table.cart tbody tr.cart_item td.product-remove {
    position: absolute;
    top: 16px;
    inset-inline-end: 16px;
    width: auto !important;
    display: block !important;
    padding: 0 !important;
  }

  .woocommerce-cart table.shop_table.cart tbody tr.cart_item td.product-name {
    display: block !important;
    padding-inline-end: 42px;
    padding-top: 0 !important;
  }

  .woocommerce-cart .asc-cart__product {
    gap: 14px;
    display: flex;
    align-items: center;
    width: 100%;
  }

  .woocommerce-cart .asc-cart__product-media {
    flex: 0 0 64px;
    width: 64px;
  }

  .woocommerce-cart .asc-cart__product-media img {
    width: 56px !important;
    height: 56px !important;
    margin: 0 !important;
  }

  .woocommerce-cart .asc-cart__product-content {
    flex: 1;
    min-width: 0;
  }

  /* Labels for cart items - Only target the main cart table */
  .woocommerce-cart table.cart td.product-price::before,
  .woocommerce-cart table.cart td.product-quantity::before,
  .woocommerce-cart table.cart td.product-subtotal::before {
    content: attr(data-title);
    display: inline-block;
    color: #465c73;
    font-size: 14px;
    font-weight: 700;
  }

  /* --- Cart Totals Table --- */
  .woocommerce-cart .cart_totals table.shop_table {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    width: 100% !important;
  }

  /* Important: Hide any generated labels in totals table to avoid doubling */
  .woocommerce-cart .cart_totals td::before {
    display: none !important;
  }

  .woocommerce-cart .cart_totals table.shop_table tr {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    border-top: 1px solid #eef2f6;
  }

  .woocommerce-cart .cart_totals table.shop_table th,
  .woocommerce-cart .cart_totals table.shop_table td {
    display: block !important;
    width: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
  }

  .woocommerce-cart .cart_totals table.shop_table th {
    font-weight: 700;
    color: #0b1f33;
    font-size: 16px;
    flex: 0 0 auto;
    text-align: right !important;
  }

  .woocommerce-cart .cart_totals table.shop_table td {
    flex: 0 0 auto;
    text-align: left !important;
    color: #0b1f33;
    font-size: 16px;
    font-weight: 700;
  }

  /* Specific fix for shipping row in totals */
  .woocommerce-cart .cart_totals table.shop_table tr.shipping {
    flex-direction: column;
    align-items: stretch;
  }

  .woocommerce-cart .cart_totals table.shop_table tr.shipping th,
  .woocommerce-cart .cart_totals table.shop_table tr.shipping td {
    width: 100% !important;
    text-align: right !important;
  }

  .woocommerce-cart .cart_totals table.shop_table tr.shipping th {
    margin-bottom: 8px;
  }

  .woocommerce-cart .shipping-calculator-form {
    width: 100% !important;
    max-width: 100% !important;
    margin: 15px 0 0 !important;
  }

  .woocommerce-cart .shipping-calculator-form .input-text,
  .woocommerce-cart .shipping-calculator-form select,
  .woocommerce-cart .shipping-calculator-form .select2-container {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Bar adjustments */
  .woocommerce-cart .asc-cart__actions-bar,
  .woocommerce-cart .actions .coupon {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .woocommerce-cart .coupon .input-text,
  .woocommerce-cart .coupon .button,
  .woocommerce-cart button[name="apply_coupon"],
  .woocommerce-cart button[name="update_cart"] {
    width: 100%;
  }

  .woocommerce-cart button[name="update_cart"] {
    margin-inline-start: 0;
  }
}
