/* Reset and base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  margin: 0;
  padding: 0;
  background: #f4f7fb;
  min-height: 100vh;
  color: #003a5d;
}

h2 {
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  margin: 0;
  text-transform: uppercase;
}

button {
  cursor: pointer;
  font-family: inherit;
}

.cart-popup-wrapper[hidden] {
  display: none;
}

/* Cart button top right */
.header {
  width: 100%;
  background: #004f7c;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 1rem;
  height: 48px;
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header .user-login,
.header .cart-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 1.25rem;
  border-left: 1px solid #1066b1;
  font-weight: 600;
  font-size: 0.875rem;
  user-select: none;
}

.header .cart-button {
  position: relative;
  cursor: pointer;
}

.header .material-icons {
  font-size: 20px;
}

.cart-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #e51d32;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  border-radius: 9999px;
  padding: 2px 6px;
  line-height: 1;
  user-select: none;
}

/* Cart popup container */
.cart-popup-wrapper {
  position: fixed;
  top: 72px;
  right: 35rem;
  width: auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 100;
  font-size: 0.875rem;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

/* Arrow Tip top right */
.cart-popup-wrapper::before {
  content: "";
  position: absolute;
  top: -11px;
  right: 16px;
  width: 20px;
  height: 20px;
  background: white;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  transform: rotate(45deg);
  box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
  z-index: -1;
}

/* Popup header */
.cart-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 14px 20px;
  border-bottom: 1px solid #ddd;
  font-weight: 700;
  font-size: 1rem;
}

.cart-popup-header h2 {
  letter-spacing: 0.07em;
  color: #004f7c;
}

.cart-popup-header button.close-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 2px solid #4a90e2;
  border-radius: 6px;
  color: #4a90e2;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  user-select: none;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.cart-popup-header button.close-btn:hover,
.cart-popup-header button.close-btn:focus {
  background-color: #4a90e2;
  color: white;
  outline: none;
}

/* Cart list container with scroll if overflow */
.cart-list {
  overflow-y: auto;
  max-height: 60vh;
}

/* Each item container */
.cart-item {
  display: flex;
  padding: 12px 20px;
  border-bottom: 1px solid #eee;
  gap: 20px;
  align-items: flex-start;
}

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

/* Image container */
.item-image {
  flex-shrink: 0;
  width: 80px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.1);
  background: #fff;

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

/* Item textual details container */
.item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.item-title-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.item-title-main {
  font-weight: 700;
  color: #004f7c;
  font-size: 0.9rem;
  flex: 1 1 55%;
  line-height: 1.2;
}

.item-title-alt {
  font-weight: 600;
  color: #0072bb;
  font-size: 0.85rem;
  flex: 1 1 40%;
  text-align: right;
}

/* Amount label and link row */
.item-ingredients-row {
  margin-top: 6px;
  font-size: 0.75rem;
  color: #004f7c;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ingredient-link {
  cursor: pointer;
  color: #0072bb;
  user-select: none;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.ingredient-link:hover,
.ingredient-link:focus {
  color: #004f7c;
  outline: none;
}

/* Controls row for amount select + buttons */
.item-controls {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* Label + select combo */
.amount-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #004f7c;
  white-space: nowrap;
}

select.amount-select {
  appearance: none;
  border: 1.5px solid #0072bb;
  border-radius: 6px;
  background: #f7faff;
  padding: 6px 8px;
  font-weight: 600;
  font-size: 0.85rem;
  color: #004f7c;
  cursor: pointer;
  min-width: 54px;
  transition: border-color 0.2s ease;
}

select.amount-select:focus {
  outline: none;
  border-color: #005a8a;
}

.control-button {
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  padding: 6px 14px;
  border: 1.5px solid #004f7c;
  color: #004f7c;
  background: #f0f7ff;
  user-select: none;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.control-button:hover,
.control-button:focus {
  background-color: #004f7c;
  border-color: #002f4a;
  color: white;
  outline: none;
}

/* Price container on right side aligned center */
.item-price {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.9rem;
  color: #0072bb;
  white-space: nowrap;
  min-width: 70px;
  text-align: right;
  align-self: center;
}

/* Footer with summary and continue button */
.cart-popup-footer {
  border-top: 2px solid #ddd;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1rem;
  color: #004f7c;
}

.cart-total {
  flex: 1;
}

.btn-continue {
  background-color: #e51d32;
  border: none;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  user-select: none;
  min-width: 140px;
  text-align: center;
  transition: background-color 0.3s ease;
}

.btn-continue:hover,
.btn-continue:focus {
  background-color: #b11323;
  outline: none;
}
.ingredient-link {
  color: #007bff;
  cursor: pointer;
  display: inline-block;
  margin-top: 5px;
}
.ingredients-list ul {
  display: flex;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
}
.ingredients-list li {
  list-style-type: none;
}


/* Responsive breakpoints */
@media (max-width: 1800px) {
  .cart-popup-wrapper {
    right: 1rem;
    top: 72px;
    width: 95vw;
    max-height: 75vh;
    border-radius: 8px;
  }
}
@media (max-width: 767px) {
  .cart-popup-wrapper {
    right: 1rem;
    top: 72px;
    width: 95vw;
    max-height: 75vh;
    border-radius: 8px;
  }

  .cart-popup-wrapper::before {
    right: 22px;
  }

  .cart-popup-footer {
    flex-direction: column;
    gap: 12px;
  }

  .cart-total {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 6px;
  }

  .btn-continue {
    width: 100%;
    min-width: unset;
    font-size: 1rem;
  }
}
