:root {
  --bg: #f7f7f7;
  --card: #ffffff;
  --accent: #0d6efd;
  --muted: #666666;
  --border: #e9e9ee;
  --radius: 12px;
  --gap: 16px;
  --shadow: 0 8px 24px rgba(10, 10, 10, 0.06);
  font-family:
    "Tajawal",
    "Cairo",
    system-ui,
    -apple-system,
    sans-serif;
}

body {
  background: var(--bg);
  color: #111;
  margin: 0;
  font-family: var(--font, "Tajawal", "Cairo", sans-serif);
  -webkit-font-smoothing: antialiased;
}

.checkout.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

.checkout {
  display: block;
  gap: var(--gap);
}

/* Stronger, container-specific rules to override main style.css on desktop */
.checkout.container {
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}
.checkout.container > .cart-items {
  background: transparent;
  padding: 0;
  border: 0;
  box-shadow: none;
}
.checkout.container > .order-summary {
  background: transparent;
  padding: 0;
  border: 0;
  box-shadow: none;
}

}
.checkout > div:first-child {
  .checkout.container form[data-cart-update] .table {
  gap: 18px;
}
.inline-field {
  .checkout.container form[data-cart-update] .table th,
  .checkout.container form[data-cart-update] .table td {
}
.checkout-phone-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
  .checkout.container form[data-cart-update] .table thead th {
  /* keep desktop single-column form fields for consistent layout */
  .checkout-phone-row {
    grid-template-columns: 1fr;
  }
}
  .checkout.container form[data-cart-update] .table th:nth-child(1),
  .checkout.container form[data-cart-update] .table td:nth-child(1) {
}
.select-search input {
  .checkout.container form[data-cart-update] .table th:nth-child(2),
  .checkout.container form[data-cart-update] .table td:nth-child(2) {
}
.input-list {
  .checkout.container form[data-cart-update] .table th:nth-child(3),
  .checkout.container form[data-cart-update] .table td:nth-child(3) {
  z-index: 20;
  max-height: 280px;
  .checkout.container form[data-cart-update] .table th:nth-child(4),
  .checkout.container form[data-cart-update] .table td:nth-child(4) {
  border: 1px solid var(--border);
  border-radius: 12px;
  .checkout.container form[data-cart-update] .table th:nth-child(5),
  .checkout.container form[data-cart-update] .table td:nth-child(5) {
  display: none;
}
  .checkout.container .cart-product { align-items: center; }
  .checkout.container .cart-thumb { width: 56px; height:56px; }
}
.input-list button {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.input-list button:hover {
  background: rgba(13, 110, 253, 0.04);
}

.payment-options {
  display: grid;
  gap: 12px;
}
.payment-option {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
}
.payment-option input {
  margin-top: 4px;
  flex-shrink: 0;
}
.payment-option .payment-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.summary-box {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
}
.summary-box h3 {
  margin: 0 0 18px;
  font-size: 1.1rem;
}
.summary-box .table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}
.summary-box .table th,
.summary-box .table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
}
.checkout-product-image {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
}
.summary-box .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
}
.summary-box .row.total {
  margin-top: 20px;
  font-size: 1.05rem;
  font-weight: 700;
}
.summary-box button {
  width: 100%;
  margin-top: 18px;
}

.cart-area {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.cart-items,
.order-summary,
.summary-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.cart-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f1f1f4;
}
.cart-item:last-child {
  border-bottom: 0;
}
.cart-product {
  display: flex;
  gap: 12px;
  align-items: center;
}
.cart-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}
.cart-name {
  font-weight: 600;
}
.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.qty-btn {
  background: transparent;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.qty-value {
  min-width: 36px;
  text-align: center;
  display: inline-block;
}

.order-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.order-summary .total {
  font-weight: 700;
  font-size: 1.2rem;
}

.btn {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 10px;
  text-decoration: none;
  color: #fff;
  background: #666;
  border: none;
  cursor: pointer;
}
.btn.primary {
  background: var(--accent);
}
.btn.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(13, 110, 253, 0.12);
}

.empty-cart {
  padding: 36px 18px;
  text-align: center;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #fbfbff);
  box-shadow: var(--shadow);
}
.empty-cart h2 {
  margin: 8px 0;
  font-size: 1.35rem;
}
.empty-cart p {
  color: var(--muted);
  margin: 0 0 12px;
}
.empty-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto 12px;
  opacity: 0.9;
}

/* Checkout layout (desktop) */
@media (min-width: 768px) {
  .checkout.container {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 28px;
    align-items: start;
  }
  .checkout.container .cart-items {
    grid-column: 1/2;
    padding: 0;
  }
  .checkout.container .order-summary {
    grid-column: 2/3;
    position: sticky;
    top: 24px;
    height: max-content;
    padding-left: 16px;
    z-index: 2;
  }
  .checkout.container .cart-items .table {
    background: var(--card);
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
  }
  /* ensure header stays above sticky summary */
  .site-header {
    z-index: 1200;
  }
}

/* Override table layout coming from style.css for desktop: make it flexible and visually clearer */
@media (min-width: 900px) {
  form[data-cart-update] .table {
    table-layout: auto !important;
    width: 100% !important;
  }
  form[data-cart-update] .table th,
  form[data-cart-update] .table td {
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--border) !important;
    vertical-align: middle !important;
    text-align: right !important;
    white-space: nowrap;
  }
  form[data-cart-update] .table thead th {
    background: transparent !important;
    color: var(--muted) !important;
    font-weight: 700 !important;
  }
  /* let the image and name share the first column but don't force large fixed widths */
  form[data-cart-update] .table th:nth-child(1),
  form[data-cart-update] .table td:nth-child(1) {
    width: auto !important;
  }
  form[data-cart-update] .table th:nth-child(2),
  form[data-cart-update] .table td:nth-child(2) {
    width: 12% !important;
  }
  form[data-cart-update] .table th:nth-child(3),
  form[data-cart-update] .table td:nth-child(3) {
    width: 12% !important;
  }
  form[data-cart-update] .table th:nth-child(4),
  form[data-cart-update] .table td:nth-child(4) {
    width: 12% !important;
  }
  form[data-cart-update] .table th:nth-child(5),
  form[data-cart-update] .table td:nth-child(5) {
    width: 10% !important;
  }
  .cart-product {
    align-items: center;
  }
  .cart-thumb {
    width: 56px;
    height: 56px;
  }
}

/* For very large screens keep columns readable */
@media (min-width: 1400px) {
  form[data-cart-update] .table th:nth-child(2),
  form[data-cart-update] .table td:nth-child(2) {
    width: 10% !important;
  }
  form[data-cart-update] .table th:nth-child(3),
  form[data-cart-update] .table td:nth-child(3) {
    width: 10% !important;
  }
  form[data-cart-update] .table th:nth-child(4),
  form[data-cart-update] .table td:nth-child(4) {
    width: 10% !important;
  }
}

/* Accessibility tweaks */
input,
textarea,
select {
  font-family: inherit;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
/* Make form controls full width inside checkout container for consistent vertical flow */
.checkout.container input,
.checkout.container textarea,
.checkout.container select,
.checkout.container .inline-field input,
.checkout.container .inline-field textarea,
.checkout.container .inline-field select {
  width: 100% !important;
  box-sizing: border-box;
}

/* Ensure labels sit above inputs with consistent spacing */
.checkout.container label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}
label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

/* Checkout summary table tweaks */
.summary-box .table {
  width: 100%;
  border-collapse: collapse;
}
.summary-box .table th,
.summary-box .table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.summary-box .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.summary-box .row.total {
  font-size: 1.05rem;
  font-weight: 700;
}

/* Small screens */
@media (max-width: 767px) {
  .cart-thumb {
    width: 64px;
    height: 64px;
  }
  .qty-btn {
    padding: 8px 10px;
  }
  .btn {
    padding: 12px 14px;
  }
}
