:root {
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --cart-height: calc(100vh - 200px);
}
/* * {
  border: 1px solid red;
} */

.cart-page {
  padding: 2rem 1rem;
  font-family: var(--font-body);
  max-width: 1400px;
  margin: 0 auto;
}

.cart-page h1 {
  font-family: var(--font);
  font-size: clamp(2rem, 8vw, 4rem);
  text-align: center;
  font-weight: normal;
  margin-bottom: 2rem;
}

.cart-wrapper {
  position: relative;
  min-height: 60vh;
  margin-bottom: 4rem;
}

.cart-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: flex-start;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  max-height: 65vh;
  padding-right: 1rem;
}

.cart-item {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 1rem;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
  border: #333 solid 1px;
}

/* .cart-item:hover {
  transform: translateY(2px);
} */

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

.cart-item-details h3 {
  font-family: var(--font-heading);
  font-size: var(--fs-md);
  margin: 0 0 0.5rem 0;
}

.cart-item-details p {
  font-size: var(--fs-sm);
  color: #666;
}

.cart-item .remove-btn {
  background: none;
  border: none;
  color: crimson;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: color 0.2s ease;
  padding: 0.5rem;
}

.cart-item .remove-btn:hover {
  color: darkred;
}

.cart-summary {
  background: #fafafa;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  height: fit-content;
}

.cart-summary h2 {
  font-size: var(--fs-lg);
  margin-bottom: 1rem;
}

.cart-summary p {
  font-size: var(--fs-md);
  margin: 0.75rem 0;
  display: flex;
  justify-content: space-between;
}

.checkout-btn {
  width: 100%;
  padding: 1rem;
  margin-top: 1rem;
  border: none;
  border-radius: 12px;
  background: black;
  color: white;
  font-family: var(--font-heading);
  font-size: var(--fs-md);
  cursor: pointer;
  transition: background 0.3s ease;
}

.checkout-btn:hover {
  background: #333;
}

/* Custom Scrollbar */
.cart-items::-webkit-scrollbar {
  width: 8px;
}

.cart-items::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.cart-items::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.quantity-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quantity-btn:hover {
  background: #f5f5f5;
}

.quantity {
  font-size: var(--fs-md);
  min-width: 2rem;
  text-align: center;
}

.empty-cart {
  text-align: center;
  padding: 2rem;
}

.empty-cart p {
  font-size: var(--fs-lg);
  margin-bottom: 1rem;
  color: #666;
}

.empty-cart .btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: black;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.empty-cart .btn:hover {
  background: #333;
}

.checkout-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  padding: 0;
  box-sizing: border-box;
}

.checkout-modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 1rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  position: relative;
  z-index: 1010;
}

/* Custom Scrollbar */
.checkout-modal-content::-webkit-scrollbar {
  width: 6px;
}
.checkout-modal-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}
.checkout-modal-content::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}
.checkout-modal-content::-webkit-scrollbar-thumb:hover {
  background: #555;
}

@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  font-weight: bold;
  color: #222;
  cursor: pointer;
  z-index: 1010;
  background: transparent;
  border: none;
}

#checkoutForm {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#checkoutForm input,
#checkoutForm textarea {
  padding: 0.8rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
  font-family: "DM Sans", sans-serif;
  width: 100%;
}

#checkoutForm textarea {
  resize: vertical;
  min-height: 80px;
  max-height: 150px;
}

.confirm-checkout {
  background: #222;
  color: white;
  padding: 0.8rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}

.confirm-checkout:hover {
  background: #444;
}

@media (max-width: 768px) {
  .checkout-modal-content {
    padding: 1.5rem;
    width: 95%;
    max-width: 420px;
  }
}

@media (max-width: 480px) {
  .checkout-modal-content {
    padding: 4rem;
    border-radius: 0.75rem;
    max-height: 70vh;
    overflow-y: auto;
  }

  #checkoutForm input,
  #checkoutForm textarea {
    font-size: 0.9rem;
  }

  #checkoutForm textarea {
    min-height: 60px;
    max-height: 120px;
  }

  .confirm-checkout {
    padding: 0.6rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  .cart-container {
    grid-template-columns: 1fr;
  }

  .cart-items {
    max-height: none;
    overflow-y: visible;
    margin-bottom: 2rem;
  }

  .cart-summary {
    position: relative;
    bottom: auto;
    background: #fafafa;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  }
}

@media (max-width: 480px) {
  .cart-page {
    padding: 1rem;
  }

  .cart-page h1 {
    font-size: clamp(1.5rem, 6vw, 2rem);
    margin-bottom: 1rem;
  }

  .cart-item {
    grid-template-columns: 80px 1fr;
    grid-template-areas:
      "image details"
      "image remove";
    padding: 0.75rem;
  }

  .cart-items {
    height: 60vh;
  }

  .cart-summary {
    padding: 1rem;
  }
}
