/*
  Front-end Style Guide
  - Red: hsl(14, 86%, 42%)
  - Green: hsl(159, 69%, 38%)
  - Rose 50: hsl(20, 50%, 98%)
  - Rose 100: hsl(13, 31%, 94%)
  - Rose 300: hsl(14, 25%, 72%)
  - Rose 400: hsl(7, 20%, 60%)
  - Rose 500: hsl(12, 20%, 44%)
  - Rose 900: hsl(14, 65%, 9%)
  - Font Family: 'Red Hat Text'
  - Weights: 400, 600, 700
  - Body Copy (product names): 16px
*/

:root {
    --color-red: hsl(14, 86%, 42%);
    --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%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Red Hat Text', sans-serif;
    font-size: 16px;
    background-color: var(--color-rose-50);
    color: var(--color-rose-900);
    width: 100%;
    justify-content: baseline;
}

.page-wrapper {
    display: flex;
    /* flex-direction: column; Default for mobile */
    gap: 32px;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 16px;
}


.container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 16px;
}

/* Product List */
.product-list-container {
    flex-grow: 1;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 24px;
}

.dessert-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.dessert-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    padding: 10px;
    width: 100%;
}

.dessert-image-container {
    position: relative;
    margin-bottom: 16px;
}

.dessert-image {
    width: 100%;
    border-radius: 8px;
    height: 150px;
    object-fit: cover;
}

.add-to-cart-btn {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 50%);
    background-color: #fff;
    border: 1px solid var(--color-rose-300);
    color: var(--color-rose-500);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-to-cart-btn:hover {
    background-color: var(--color-rose-900);
    color: #fff;
    border-color: var(--color-rose-900);
}

.dessert-category {
    font-weight: 400;
    color: var(--color-rose-400);
    margin-top: 24px;
}

.dessert-name {
    font-weight: 600;
    font-size: 16px;
    margin: 4px 0;
}

.dessert-price {
    font-weight: 700;
    color: var(--color-red);
}

/* Cart */
.cart-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 7px;
    height: fit-content;
    width: 25%;
}

.cart-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.cart-title span {
    color: var(--color-red);
}

.empty-cart-message {
    color: var(--color-rose-400);
    text-align: center;
}

.attribution {
    font-size: 11px;
    text-align: center;
    margin-top: 20px;
    color: var(--color-rose-400);
}

.attribution a {
    color: var(--color-rose-500);
}

.remove-icon {
  width: 14px;
  height: 14px;
  margin-left: 10px;
  cursor: pointer;
  vertical-align: middle;
}


.cart-items li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e5e5;
  padding: 12px 0;
  font-size: 16px;
}

.order-total-section {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 18px;
}

.carbon-neutral-box {
  display: flex;
  align-items: center;
  background-color: #f4f4f4;
  border-radius: 10px;
  padding: 10px;
  margin-top: 16px;
  gap: 10px;
}

.carbon-neutral-box img {
  width: 24px;
  height: 24px;
}

.confirm-btn {
  display: block;
  width: 100%;
  background-color: #d14900;
  color: white;
  border: none;
  padding: 14px;
  font-size: 16px;
  border-radius: 999px;
  margin-top: 20px;
  cursor: pointer;
}

.confirm-btn:hover {
  background-color: #b63c00;
}


/*modal styling */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: white;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 480px;
  position: relative;
}

.order-confirmed-icon {
  width: 40px;
  height: 40px;
  display: block;
  margin: 0 auto 1rem auto; /* center the icon horizontally */
}

.modal-header-text {
  text-align: left;
  margin-bottom: 1.5rem;
}

.modal-header-text h2 {
  margin: 0;
  font-size: 1.5rem;
}

.modal-header-text p {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  color: #555;
}



#confirmed-items-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

#confirmed-items-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.95rem;
}

.modal-total {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  margin-top: 1rem;
  font-size: 1.1rem;
}

#new-order-btn {
  display: block;
  margin: 2rem auto 0;
  padding: 0.75rem 2rem;
  background-color: #e05a00;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

.order-confirmed-icon {
  width: 64px;
  height: 64px;
  display: block;
  margin: 0 auto 16px auto;
}



/* Desktop Styles */
@media (min-width: 1440px) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    }

    .container {
        flex-direction: row;
        max-width: 1110px;
        margin: auto;
        gap: 32px;
        padding: 0;
    }

    .dessert-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 32px;
    }

    .cart-container {
        width: 380px;
    }
}

/* Tablet Styles */
@media (min-width: 768px) and (max-width: 1439px) {
    .dessert-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}


/* Order Confirmation Items with Images */

#confirmed-items-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.confirmed-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
}

.confirmed-item-image {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.confirmed-item-details {
  flex-grow: 1;
}

.confirmed-item-details p {
  margin: 0;
}

.confirmed-item-details .item-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-rose-900);
}

.confirmed-item-details .item-qty-price {
  font-size: 0.85rem;
  color: var(--color-rose-400);
  margin-top: 4px;
}

.item-total {
  font-weight: bold;
  font-size: 1rem;
  white-space: nowrap;
}
