/* =============================================================
   CART.CSS
   Used by: cart.html only.
   cart.html does NOT load Home.css, so this file loads base.css
   itself (variables, reset, .hidden and .toast).

   Contains: order details table, confirm button, order
   confirmation popup form.
   ============================================================= */


/* -------------------------------------------------------------
   ORDER DETAILS SECTION
   ------------------------------------------------------------- */
.Order.Detail {
  width: calc(100% - (var(--space-md) * 2));
  max-width: 1200px;
  margin: var(--space-md) auto;
  padding: var(--space-md);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow-x: auto;      /* wide table scrolls inside the card */
}

/* "Click to confirm order" button (the only button in this section) */
.Order.Detail button {
  margin: 0 0 var(--space-lg);
  font-size: var(--fs-base);
  font-weight: 700;
}

.confirm-btn-tabel {
  padding: 10px var(--space-lg);
  color: var(--color-surface);
  background-color: var(--color-primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition);
}

.confirm-btn-tabel:hover {
  background-color: var(--color-primary-hover);
}

.confirm-btn-tabel:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}


/* -------------------------------------------------------------
   CART TABLE
   ------------------------------------------------------------- */
.Order.Detail table {
  width: 100%;
  min-width: 750px;
  border-collapse: collapse;
  text-align: left;
}

/* Table header */
.Order.Detail thead {
  background-color: var(--color-header-bg);
  color: var(--color-on-dark);
}

.Order.Detail th {
  padding: var(--space-sm) 10px;
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}

/* Table body */
.Order.Detail td {
  padding: var(--space-sm) 10px;
  color: var(--color-text-soft);
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.Order.Detail tbody tr {
  transition: background-color var(--transition);
}

.Order.Detail tbody tr:hover {
  background-color: var(--color-bg);
}

/* Product picture */
.Order.Detail td img {
  display: block;
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background-color: var(--color-surface-alt);
}

/* Quantity minus and plus */
.Order.Detail td span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 30px;
  margin: 0 5px;
  padding: var(--space-2xs);
  color: var(--color-text);
  background-color: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition), color var(--transition);
}

.Order.Detail td span:hover {
  color: var(--color-surface);
  background-color: var(--color-primary);
}

/* Delete icon */
.Order.Detail td svg {
  width: 17px;
  height: 17px;
  margin: 0 5px;
  fill: var(--color-text-muted);
  vertical-align: middle;
  cursor: pointer;
  transition: fill var(--transition), transform var(--transition);
}

.Order.Detail td svg:hover {
  fill: var(--color-danger);
  transform: scale(1.12);
}

/* Clicks must reach the svg (JS reads the svg, not the path) */
path {
  pointer-events: none;
}

/* Sub total, discount and total */
.Order.Detail tfoot {
  background-color: var(--color-bg);
}

.Order.Detail tfoot td {
  padding: var(--space-sm) 10px;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}

.Order.Detail tfoot tr:last-child {
  background-color: var(--color-primary-soft);
}

.Order.Detail tfoot tr:last-child td {
  color: var(--color-primary-hover);
  font-size: var(--fs-md);
  font-weight: 700;
  border-bottom: none;
}


/* -------------------------------------------------------------
   ORDER CONFIRMATION POPUP (shown / hidden with .hidden)
   ------------------------------------------------------------- */
.order-popup {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);

  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  background-color: var(--color-overlay);
}

.order-popup.hidden {
  display: none;
}

.order-popup form {
  width: 100%;
  max-width: 430px;
  max-height: 100%;
  overflow-y: auto;      /* scroll inside the form on short screens */
  padding: 22px var(--space-md);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card-hover);
}

/* Form fields */
.order-popup form div {
  margin-bottom: 20px;
}

.order-popup label {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.order-popup input {
  width: 100%;
  padding: var(--space-sm);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: var(--fs-base);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.order-popup input::placeholder {
  color: var(--color-text-muted);
}

.order-popup input:hover {
  border-color: var(--color-primary);
}

.order-popup input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

/* Buttons row (last div in the form) */
.order-popup form div:last-child {
  display: flex;
  gap: var(--space-sm);
  margin-top: 26px;
  margin-bottom: 0;
}

.order-popup button {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition);
}

.order-popup button:hover {
  transform: translateY(-1px);
}

.order-popup button:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

/* Confirm order (primary) */
.order-popup button[type="submit"] {
  color: var(--color-surface);
  background-color: var(--color-primary);
}

.order-popup button[type="submit"]:hover {
  background-color: var(--color-primary-hover);
}

/* Cancel (secondary) */
.order-popup button[type="button"] {
  color: var(--color-text-soft);
  background-color: var(--color-surface-alt);
  border-color: var(--color-border);
}

.order-popup button[type="button"]:hover {
  background-color: var(--color-border);
}


/* -------------------------------------------------------------
   RESPONSIVE
   Mobile first. Uses the same 640px breakpoint as the other files.
   (".Order.Detail h4" is kept for safety; the current HTML has no h4.)
   ------------------------------------------------------------- */
.Order.Detail h4 {
  margin-bottom: var(--space-md);
  font-size: 1.125rem;
}

/* Tablet and larger: 640px and up */
@media (min-width: 640px) {
  .Order.Detail {
    margin: var(--space-xl) auto;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
  }

  .Order.Detail h4 {
    margin-bottom: 22px;
    font-size: 1.375rem;
  }

  .Order.Detail th {
    padding: 15px var(--space-sm);
    font-size: var(--fs-base);
  }

  .Order.Detail td {
    padding: 14px var(--space-sm);
    font-size: var(--fs-base);
  }

  .Order.Detail tfoot td {
    padding: 13px var(--space-sm);
  }

  .Order.Detail td img {
    width: 65px;
    height: 65px;
  }

  .Order.Detail td svg {
    width: 19px;
    height: 19px;
  }

  .order-popup {
    padding: var(--space-lg);
  }

  .order-popup form {
    padding: 28px;
    border-radius: var(--radius-lg);
  }

  .order-popup label {
    font-size: var(--fs-base);
  }

  .order-popup button {
    font-size: var(--fs-base);
  }
}
