/* Cart page (reference: build/prototype/cart.html). Elementor page with the native cart widget (.safy-cart).
   Layout only: the shared pieces live in components.css (stepper, option values box, trash button, delivery box) and tokens.css.
   `!important` appears only where Elementor's cart widget / WooCommerce print their own value with !important
   or load after this file (see project-notes/DESIGN-DIRECTION.md, section 5). */

/* hero, frame and glow divider: components.css (shared with the checkout page) */

/* one font for everything in the cart (the widget prints Roboto) */
.safy-cart, .safy-cart * { font-family: Tajawal, sans-serif !important; }

/* ===== two columns: lines card + summary card ===== */
.safy-cart .woocommerce { width: 100%; }
.safy-cart .e-cart__container { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.safy-cart .e-cart__column-start, .safy-cart .e-cart__column-end { width: auto; min-width: 0; float: none; }
.safy-cart .e-cart__column-inner.e-sticky-right-column { position: sticky; top: 20px; }
.safy-cart .e-cart__column-start { background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--radius-l); box-shadow: var(--shadow-card); overflow: hidden; }
.safy-cart .e-cart-section { margin: 0; padding: 0; background: transparent; border: 0; box-shadow: none; }

/* ===== lines table as grid rows: product | price | quantity | total | remove ===== */
.safy-cart table.shop_table.cart { display: block; width: 100%; margin: 0; border: 0; border-collapse: separate; }
.safy-cart table.shop_table.cart thead, .safy-cart table.shop_table.cart tbody { display: block; }
.safy-cart table.shop_table.cart tr { display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr) 44px; align-items: center; gap: 12px; padding: 16px 20px; border: 0; }
.safy-cart table.shop_table.cart thead tr { background: linear-gradient(to right, var(--c-tint-purple), var(--c-tint-pink)); font-size: 14px; font-weight: 700; color: var(--c-ink); }
.safy-cart table.shop_table.cart thead th { padding: 0; border: 0; background: none; font-weight: 700; text-align: start; }
.safy-cart table.shop_table.cart thead th.product-thumbnail { display: none; }
.safy-cart table.shop_table.cart thead th.product-remove { visibility: hidden; }
.safy-cart table.shop_table.cart tbody tr.cart_item { position: static; border-top: 1px solid var(--c-line); }
.safy-cart table.shop_table.cart tbody tr.cart_item td { padding: 0; border: 0; background: none; text-align: start; min-width: 0; }
/* the widget's responsive "label:" pseudo-elements are never shown */
.safy-cart table.shop_table.cart td::before, .safy-cart table.shop_table.cart td::after { content: none !important; display: none !important; }

.safy-cart td.product-thumbnail { grid-column: 1; grid-row: 1; justify-self: start; align-self: center; }
.safy-cart td.product-name { grid-column: 1; grid-row: 1; align-self: center; padding-inline-start: 98px !important; }
.safy-cart td.product-price { grid-column: 2; grid-row: 1; }
.safy-cart td.product-quantity { grid-column: 3; grid-row: 1; justify-self: start; }
.safy-cart td.product-subtotal { grid-column: 4; grid-row: 1; }
.safy-cart td.product-remove { grid-column: 5; grid-row: 1; justify-self: end; position: static; }
.safy-cart thead th.product-name { grid-column: 1; grid-row: 1; }
.safy-cart thead th.product-price { grid-column: 2; grid-row: 1; }
.safy-cart thead th.product-quantity { grid-column: 3; grid-row: 1; }
.safy-cart thead th.product-subtotal { grid-column: 4; grid-row: 1; }
.safy-cart thead th.product-remove { grid-column: 5; grid-row: 1; }
/* header of the total column: the table prints "المجموع الفرعي"; the drawn label "الإجمالي" replaces it */
.safy-cart thead th.product-subtotal { position: relative; font-size: 14px !important; color: transparent !important; user-select: none; }
.safy-cart thead th.product-subtotal::before { content: "الإجمالي"; position: absolute; inset-inline-start: 0; top: 50%; transform: translateY(-50%); font-size: 14px !important; font-weight: 700; line-height: 1.5; white-space: nowrap; color: var(--c-ink); }

.safy-cart .product-thumbnail a { display: block; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; background: var(--c-bg-soft); }
.safy-cart .product-thumbnail img { display: block; width: 84px !important; height: 84px !important; object-fit: cover; border-radius: 0; }
.safy-cart td.product-name a { font-size: 16px; font-weight: 700; line-height: 1.5; color: var(--c-ink) !important; }
.safy-cart td.product-name a:hover { color: var(--c-primary) !important; }
/* prices: plain unit price, pink bold line total, both on the left of their cell */
.safy-cart td.product-price, .safy-cart td.product-subtotal { text-align: left !important; }
.safy-cart td.product-price { color: var(--c-ink) !important; font-weight: 400 !important; }
.safy-cart td.product-subtotal, .safy-cart td.product-subtotal * { color: var(--c-primary) !important; font-weight: 700 !important; }
/* delete = the shared trash button (components.css), placed in its cell */
.safy-cart .woocommerce-cart-form a.remove { position: relative; inset: auto; width: 40px; height: 40px; margin: 0; }
/* quantity stepper = components.css; here only what the cart widget needs beaten */
.safy-cart .quantity input.qty { width: 40px !important; padding: 0 !important; text-align: center !important; border: 0 !important; box-shadow: none !important; outline: 0 !important; background: transparent !important; line-height: 1; }
.safy-cart .quantity input.qty:focus { background: var(--c-tint-pink) !important; }

/* ===== coupon row inside the lines card ===== */
.safy-cart .coupon { display: block; }
.safy-cart .coupon .form-row.coupon-col { display: flex !important; align-items: center !important; justify-content: flex-start !important; flex-wrap: nowrap; gap: 8px !important; margin: 0; padding: 16px 20px !important; border-top: 1px solid var(--c-line); }
.safy-cart .coupon-col-start, .safy-cart .coupon-col-end { flex: none !important; width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important; }
.safy-cart .coupon-col-start input.input-text { box-sizing: border-box !important; width: 220px !important; height: 44px !important; min-height: 44px !important; margin: 0 !important; padding: 0 14px; border: 1px solid var(--c-line); border-radius: var(--radius-s); background: var(--c-white); font: inherit; font-size: 14px; box-shadow: none; }
.safy-cart .coupon-col-start input.input-text:focus { border-color: var(--c-primary) !important; outline: 0 !important; box-shadow: none !important; }
.safy-cart .coupon-col-end .e-apply-coupon { box-sizing: border-box !important; width: auto !important; height: 44px !important; min-height: 44px !important; margin: 0 !important; padding: 0 24px !important; border: 1.5px solid var(--c-primary) !important; border-radius: 8px !important; background: var(--c-white) !important; color: var(--c-primary) !important; font: inherit; font-size: 15px !important; font-weight: 700; line-height: 1; cursor: pointer; }
.safy-cart .coupon-col-end .e-apply-coupon:hover { background: var(--c-tint-pink) !important; color: var(--c-primary) !important; }
.safy-cart .safy-cart-continue { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto !important; color: var(--c-primary) !important; font-size: 15px; font-weight: 700; text-decoration: none; }
.safy-cart .safy-cart-continue::before { content: ""; width: 16px; height: 16px; flex: none; background: currentColor; -webkit-mask: var(--ico-arrow-l) center/contain no-repeat; mask: var(--ico-arrow-l) center/contain no-repeat; }
.safy-cart .safy-cart-continue:hover { text-decoration: underline; }

/* ===== summary card ===== */
.safy-cart .e-cart-totals { box-sizing: border-box !important; max-width: 100%; padding: 24px; background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--radius-l); box-shadow: var(--shadow-card); }
.safy-cart .cart_totals { width: 100%; }
.safy-cart .e-cart-totals .cart_totals h2 { margin: 0 0 16px; font-size: 20px !important; font-weight: 700 !important; color: var(--c-ink) !important; }
/* the totals table is a real table (the widget's responsive rules turn it into blocks) */
.safy-cart .cart_totals table.shop_table { display: table !important; table-layout: auto; width: 100%; margin: 0; border: 0; }
.safy-cart .cart_totals table.shop_table > tbody { display: table-row-group !important; }
.safy-cart .cart_totals table.shop_table tr { display: table-row !important; }
.safy-cart .cart_totals table.shop_table th, .safy-cart .cart_totals table.shop_table td { display: table-cell !important; padding: 12px 0; border: 0; border-bottom: 1px dashed var(--c-line); background: none; font-size: 15px; }
.safy-cart .cart_totals table.shop_table th { font-weight: 400; color: var(--c-text-muted); text-align: start; }
.safy-cart .cart_totals table.shop_table td { font-weight: 500; text-align: end; }
.safy-cart .cart_totals td::before, .safy-cart .cart_totals td::after { content: none !important; display: none !important; }
.safy-cart .cart_totals table.shop_table tr.order-total th, .safy-cart .cart_totals table.shop_table tr.order-total td { padding-top: 16px; border-bottom: 0; }
.safy-cart tr.order-total th { font-size: 17px !important; font-weight: 700 !important; color: var(--c-ink) !important; }
.safy-cart tr.order-total td, .safy-cart tr.order-total td * { color: var(--c-primary) !important; background: none !important; font-size: 22px !important; font-weight: 700 !important; }

/* checkout button: gradient, 10px corners, arrow after the text */
.safy-cart .wc-proceed-to-checkout { box-sizing: border-box !important; display: block; width: 100%; max-width: 100%; padding: 8px 0 0; }
.safy-cart .wc-proceed-to-checkout .checkout-button { box-sizing: border-box !important; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 100%; min-height: 52px; margin: 0; padding: 0 20px; border: 0 !important; border-radius: 10px !important; background: var(--grad-brand) !important; background-origin: border-box; color: var(--c-white) !important; font: inherit; font-size: 17px; font-weight: 700; text-decoration: none; box-shadow: none; }
.safy-cart .wc-proceed-to-checkout .checkout-button:hover { filter: brightness(.93); color: var(--c-white) !important; }
.safy-cart .wc-proceed-to-checkout .checkout-button::after { content: ""; display: inline-block; flex: none; width: 18px; height: 18px; margin-inline-start: 8px; vertical-align: middle; background: var(--c-white) !important; -webkit-mask: var(--ico-arrow-l) center/contain no-repeat; mask: var(--ico-arrow-l) center/contain no-repeat; }

/* delivery sentence (shared box: components.css) */
.safy-cart .safy-delivery { margin-top: 14px; }

/* a quantity edit is being saved in the background: dim only, nothing moves */
.safy-cart.is-updating .woocommerce-cart-form, .safy-cart.is-updating .e-cart-totals { opacity: .55; pointer-events: none; transition: opacity .15s; }

/* ===== empty cart: the same card as the side cart's empty state ===== */
.safy-cart-empty { align-items: center; text-align: center; }
.elementor-element.safy-cart-empty { width: min(100%, 420px); margin: 48px auto; padding: 24px 16px !important; gap: 16px; border-radius: 14px; background: linear-gradient(135deg, var(--c-tint-purple), var(--c-tint-pink)); }
.safy-cart-empty__icon { width: 44px; height: 44px; min-height: 44px; background: var(--c-purple); opacity: .6; -webkit-mask: var(--ico-cart-empty) center/contain no-repeat; mask: var(--ico-cart-empty) center/contain no-repeat; }
.safy-cart-empty__title h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--c-ink); }
.safy-cart-empty__text { display: none; }
.safy-cart-empty__btn .elementor-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 24px; border-radius: 8px; background: var(--grad-brand); background-origin: border-box; color: var(--c-white); font-size: 16px; font-weight: 700; }
.safy-cart-empty__btn .elementor-button:hover { filter: brightness(.93); color: var(--c-white); }


/* ===== tablet and phone ===== */
@media (max-width: 1024px) {
  .safy-cart .e-cart__container { grid-template-columns: minmax(0, 1fr); }
  .safy-cart .e-cart__column-inner.e-sticky-right-column { position: static; }
}
@media (max-width: 767px) {
  .safy-cart .e-cart__container, .safy-cart .woocommerce, .safy-cart .e-cart__column-start, .safy-cart .e-cart__column-end { box-sizing: border-box; width: 100% !important; max-width: 100% !important; margin: 0 !important; }
  .safy-cart .e-cart-totals { padding: 20px; }
  .safy-cart .safy-delivery { white-space: normal; }
  .elementor-element.safy-cart-empty { width: calc(100% - 32px); margin: 32px 16px; }

  /* a line: [image] name on row 1 (the name wraps beside the image) · options · price + quantity · delete + total */
  .safy-cart table.shop_table.cart thead { display: none; }
  .safy-cart table.shop_table.cart tr.cart_item { grid-template-columns: 56px minmax(0, 1fr) auto !important; column-gap: 12px; row-gap: 12px; padding: 16px; }
  .safy-cart .product-thumbnail a { width: 56px !important; height: 56px !important; border-radius: 10px; }
  .safy-cart .product-thumbnail img { width: 56px !important; height: 56px !important; }
  .safy-cart td.product-thumbnail { display: block !important; grid-column: 1; grid-row: 1; }
  .safy-cart table.shop_table.cart td.product-name { display: contents !important; }
  .safy-cart td.product-name > a { grid-column: 2 / -1; grid-row: 1; align-self: center; text-align: start; }
  .safy-cart td.product-name > dl.variation { grid-column: 1 / -1; grid-row: 2; }
  .safy-cart td.product-quantity { grid-column: 1 / 3; grid-row: 3; justify-self: start; }
  .safy-cart td.product-price { grid-column: 3; grid-row: 3; justify-self: end; align-self: center; }
  .safy-cart td.product-remove { grid-column: 1 / 3; grid-row: 4; justify-self: start; }
  .safy-cart td.product-subtotal { grid-column: 3; grid-row: 4; justify-self: end; align-self: center; }

  /* coupon: field, button and link in a column, full width */
  .safy-cart .coupon .form-row.coupon-col { flex-direction: column !important; align-items: stretch !important; padding: 16px !important; }
  .safy-cart .coupon-col-start, .safy-cart .coupon-col-end { flex: 1 1 100% !important; }
  .safy-cart .coupon-col-start input.input-text, .safy-cart .coupon-col-end .e-apply-coupon { width: 100% !important; }
  .safy-cart .safy-cart-continue { flex: 1 1 100%; justify-content: center; margin-inline-start: 0 !important; }
}
