/* ============================================================
   CART & CHECKOUT PAGE STYLES
   ============================================================ */

/* ---- Cart Layout ---- */
.cart-page  { padding: var(--space-10) 0 var(--space-16); }
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-8);
  align-items: start;
}

/* ---- Cart Table ---- */
.cart-table {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cart-table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-section);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  gap: var(--space-4);
}

.cart-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: var(--space-4);
  transition: var(--transition-fast);
}

.cart-item:last-child { border-bottom: none; }
.cart-item:hover { background: var(--bg-section); }

.cart-item-product {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.cart-item-img {
  width: 80px; height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.cart-item-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.cart-item-name {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-unit {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.cart-item-price {
  font-weight: 600;
  color: var(--text-body);
  font-size: var(--text-base);
}

.cart-item-total {
  font-weight: 700;
  color: var(--primary);
  font-size: var(--text-lg);
}

.cart-item-remove {
  width: 32px; height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  transition: var(--transition-fast);
}

.cart-item-remove:hover { background: #fee2e2; color: var(--danger); }

/* ---- Cart Summary Card ---- */
.cart-summary {
  position: sticky;
  top: 90px;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cart-summary-header {
  padding: var(--space-5);
  background: var(--bg-section);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--secondary);
}

.cart-summary-body { padding: var(--space-5); }

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border);
}

.summary-row:last-child { border-bottom: none; }

.summary-label { color: var(--text-muted); }

.summary-value { font-weight: 600; color: var(--text-dark); }

.summary-row.total {
  padding-top: var(--space-4);
  border-top: 2px solid var(--border);
}

.summary-row.total .summary-label {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--secondary);
}

.summary-row.total .summary-value {
  font-size: var(--text-2xl);
  color: var(--primary);
  font-weight: 700;
  font-family: var(--font-heading);
}

.free-shipping-bar {
  background: var(--bg-section);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.free-shipping-text {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--success);
  margin-bottom: var(--space-2);
}

.shipping-progress {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.shipping-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.coupon-section {
  display: flex;
  gap: var(--space-2);
  margin: var(--space-4) 0;
}

.coupon-section .form-control {
  font-size: var(--text-sm);
  padding: 10px 14px;
}

/* ---- Checkout Page ---- */
.checkout-page { padding: var(--space-10) 0 var(--space-16); }

.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: var(--space-8);
  align-items: start;
}

.checkout-form-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.checkout-section {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.checkout-section:last-child { border-bottom: none; }

.checkout-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: var(--space-5);
}

.checkout-section-num {
  width: 28px; height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

/* Payment methods */
.payment-methods {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.payment-method {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
}

.payment-method:hover { border-color: var(--primary-light); }
.payment-method.selected { border-color: var(--primary); background: rgba(200,134,10,0.04); }

.payment-method input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.payment-method-icon {
  font-size: var(--text-2xl);
  flex-shrink: 0;
}

.payment-method-info { flex: 1; }
.payment-method-name {
  font-weight: 700;
  color: var(--secondary);
  font-size: var(--text-base);
}

.payment-method-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Order Success ---- */
.success-page {
  padding: var(--space-20) 0;
  text-align: center;
}

.success-icon {
  width: 100px; height: 100px;
  background: linear-gradient(135deg,#dcfce7, #86efac);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin: 0 auto var(--space-6);
  animation: successPop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes successPop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.success-title { color: var(--success); margin-bottom: var(--space-2); }
.success-subtitle { color: var(--text-muted); margin-bottom: var(--space-8); }

.success-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 600px;
  margin: 0 auto var(--space-8);
  text-align: left;
  box-shadow: var(--shadow-md);
}

.success-order-id {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: var(--space-6);
  padding: var(--space-3);
  background: rgba(200,134,10,0.06);
  border-radius: var(--radius-md);
}

/* Shipping timeline */
.timeline {
  display: flex;
  justify-content: space-between;
  position: relative;
  padding: var(--space-4) 0;
  margin-top: var(--space-8);
}

.timeline::before {
  content: '';
  position: absolute;
  top: 24px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--border);
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  position: relative;
  flex: 1;
}

.timeline-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-section);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  z-index: 1;
  transition: var(--transition);
}

.timeline-step.done .timeline-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.timeline-label {
  font-size: var(--text-xs);
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
}

.timeline-step.done .timeline-label { color: var(--primary); }

@media (max-width: 1024px) {
  .cart-layout     { grid-template-columns: 1fr; }
  .checkout-layout { grid-template-columns: 1fr; }
  .cart-summary    { position: static; }
}

@media (max-width: 640px) {
  .cart-table-header { display: none; }
  .cart-item { grid-template-columns: 1fr auto; grid-template-rows: auto auto auto; }
  .cart-item-product { grid-column: 1; }
  .cart-item-remove  { grid-column: 2; grid-row: 1; }
  .cart-item-price   { display: none; }
  .cart-item-qty     { grid-column: 1; }
  .cart-item-total   { grid-column: 2; }
  .form-row { grid-template-columns: 1fr; }
}
