/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors */
  --color-red: hsl(14, 86%, 42%);
  --color-red-hover: hsl(14, 86%, 35%);
  --color-green: hsl(159, 69%, 38%);
  --color-rose-50: hsl(20, 50%, 98%);
  --color-rose-100: hsl(13, 31%, 94%);
  --color-rose-300: hsl(14, 25%, 72%);
  --color-rose-400: hsl(7, 20%, 60%);
  --color-rose-500: hsl(12, 20%, 44%);
  --color-rose-900: hsl(14, 65%, 9%);

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Fonts */
  --font-family: 'Red Hat Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-rose-50);
  color: var(--color-rose-900);
  line-height: 1.6;
  min-height: 100vh;
  padding: var(--spacing-lg);
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: var(--spacing-xl);
}

/* Main Content */
.main-content {
  min-width: 0;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--spacing-xl);
  color: var(--color-rose-900);
}

/* Desserts Grid */
.desserts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--spacing-lg);
}

/* Dessert Card */
.dessert-card {
  position: relative;
}

.dessert-image-container {
  position: relative;
  margin-bottom: var(--spacing-md);
}

.dessert-image {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.dessert-card.in-cart .dessert-image {
  border-color: var(--color-red);
}

/* Add to Cart Button */
.add-to-cart-btn {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background-color: white;
  border: 1px solid var(--color-rose-300);
  border-radius: var(--radius-xl);
  padding: 12px 28px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.add-to-cart-btn:hover {
  border-color: var(--color-red);
  color: var(--color-red);
}

.add-to-cart-btn svg {
  width: 20px;
  height: 20px;
}

/* Quantity Controls */
.quantity-controls {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  background-color: var(--color-red);
  border-radius: var(--radius-xl);
  padding: 12px 16px;
  color: white;
  font-weight: 600;
  min-width: 128px;
  justify-content: space-between;
}

.quantity-controls.hidden {
  display: none;
}

.quantity-btn {
  background: none;
  border: 1px solid white;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background-color 0.3s ease;
  padding: 0;
}

.quantity-btn:hover {
  background-color: white;
  color: var(--color-red);
}

.quantity-display {
  font-size: 0.875rem;
  min-width: 20px;
  text-align: center;
}

/* Dessert Info */
.dessert-info {
  margin-top: var(--spacing-lg);
}

.dessert-category {
  font-size: 0.875rem;
  color: var(--color-rose-400);
  margin-bottom: var(--spacing-xs);
}

.dessert-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-rose-900);
  margin-bottom: var(--spacing-xs);
}

.dessert-price {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-red);
}

/* Cart Sidebar */
.cart-sidebar {
  background-color: white;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  height: fit-content;
  position: sticky;
  top: var(--spacing-lg);
}

.cart-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-red);
  margin-bottom: var(--spacing-lg);
}

/* Empty Cart */
.empty-cart {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-md);
}

.empty-cart-icon {
  width: 128px;
  height: 128px;
  margin-bottom: var(--spacing-md);
}

.empty-cart-text {
  color: var(--color-rose-400);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Cart Items */
.cart-items {
  margin-bottom: var(--spacing-lg);
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) 0;
  border-bottom: 1px solid var(--color-rose-100);
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-rose-900);
  margin-bottom: var(--spacing-xs);
}

.cart-item-details {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 0.875rem;
}

.cart-item-quantity {
  color: var(--color-red);
  font-weight: 600;
}

.cart-item-price {
  color: var(--color-rose-400);
}

.cart-item-total {
  color: var(--color-rose-500);
  font-weight: 600;
}

.cart-item-remove {
  background: none;
  border: 1px solid var(--color-rose-300);
  color: var(--color-rose-300);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  margin-left: var(--spacing-md);
}

.cart-item-remove:hover {
  border-color: var(--color-rose-900);
  color: var(--color-rose-900);
}

/* Order Total */
.order-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md) 0;
}

.order-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.order-total-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-rose-900);
}

/* Carbon Neutral Badge */
.carbon-neutral {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  background-color: var(--color-rose-50);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-lg);
  font-size: 0.875rem;
}

.carbon-neutral svg {
  flex-shrink: 0;
}

/* Confirm Order Button */
.confirm-order-btn {
  width: 100%;
  background-color: var(--color-red);
  color: white;
  border: none;
  border-radius: var(--radius-xl);
  padding: var(--spacing-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.confirm-order-btn:hover {
  background-color: var(--color-red-hover);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background-color: white;
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1001;
}

.modal-header {
  margin-bottom: var(--spacing-lg);
}

.modal-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--spacing-md);
}

.modal-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-rose-900);
  margin-bottom: var(--spacing-sm);
}

.modal-subtitle {
  color: var(--color-rose-400);
  font-size: 0.875rem;
}

/* Modal Body */
.modal-body {
  background-color: var(--color-rose-50);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.modal-items {
  margin-bottom: var(--spacing-lg);
}

.modal-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) 0;
  border-bottom: 1px solid var(--color-rose-100);
}

.modal-item:last-child {
  border-bottom: none;
}

.modal-item-image {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.modal-item-info {
  flex: 1;
}

.modal-item-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-rose-900);
  margin-bottom: var(--spacing-xs);
}

.modal-item-details {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 0.875rem;
}

.modal-item-quantity {
  color: var(--color-red);
  font-weight: 600;
}

.modal-item-price {
  color: var(--color-rose-400);
}

.modal-item-total {
  color: var(--color-rose-500);
  font-weight: 600;
  margin-left: auto;
}

/* Modal Total */
.modal-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--spacing-md);
}

.modal-total-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-rose-900);
}

/* Start New Order Button */
.start-new-order-btn {
  width: 100%;
  background-color: var(--color-red);
  color: white;
  border: none;
  border-radius: var(--radius-xl);
  padding: var(--spacing-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.start-new-order-btn:hover {
  background-color: var(--color-red-hover);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Tablet Styles */
@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  .cart-sidebar {
    position: static;
  }

  .desserts-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

/* Mobile Styles */
@media (max-width: 768px) {
  body {
    padding: var(--spacing-md);
  }

  .page-title {
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
  }

  .desserts-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .dessert-image {
    height: 200px;
  }

  .cart-sidebar {
    padding: var(--spacing-md);
  }

  .modal-content {
    padding: var(--spacing-lg);
  }

  .modal-title {
    font-size: 1.5rem;
  }

  .container {
    gap: var(--spacing-md);
  }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
  .page-title {
    font-size: 1.75rem;
  }

  .dessert-image {
    height: 180px;
  }

  .add-to-cart-btn {
    padding: 10px 20px;
    font-size: 0.8125rem;
  }

  .quantity-controls {
    min-width: 110px;
    padding: 10px 14px;
  }

  .modal-content {
    max-height: 85vh;
  }
}
