:root {
  --pink: #f4a6c0;
  --pink-light: #fdeef1;
  --brown: #4a2c2a;
  --brown-light: #7a5450;
  --white: #fffaf9;
  --shadow: 0 4px 14px rgba(74, 44, 42, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--pink-light);
  color: var(--brown);
  padding-bottom: 40px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--pink);
}

.header-text h1 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--brown);
}

.header-text p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--brown-light);
}

/* Product grid */
.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  padding: 18px;
  max-width: 1100px;
  margin: 0 auto;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.card-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(160deg, var(--pink-light), #ffe3ec);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  position: relative;
}

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

.carousel-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.carousel-img.active {
  opacity: 1;
}

.carousel-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  z-index: 2;
}

.carousel-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transition: background 0.3s ease;
}

.carousel-dots span.active {
  background: #fff;
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  color: #fff;
  letter-spacing: 0.02em;
  z-index: 2;
}

.badge-out-of-stock {
  background: #8c8c8c;
}

.badge-low-stock {
  background: #e0729a;
}

.card.out-of-stock .card-image {
  filter: grayscale(0.6);
  opacity: 0.6;
}

.card-info {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.card-name {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  min-height: 2.2em;
}

.card-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: #c2477a;
}

.card-stock {
  font-size: 0.72rem;
  color: var(--brown-light);
}

.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-add {
  flex: 1;
  background: var(--pink-light);
  color: var(--brown);
  border: 1px solid var(--pink);
}

.btn-order {
  flex: 1;
  background: var(--brown);
  color: #fff;
}

.btn-primary {
  background: var(--brown);
  color: #fff;
  width: 100%;
  padding: 13px;
  font-size: 0.95rem;
}

.btn-outline {
  background: #fff;
  color: var(--brown);
  border: 1.5px solid var(--pink);
  padding: 13px;
  font-size: 0.95rem;
  flex: 1;
}

a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-link {
  background: none;
  border: none;
  color: var(--brown-light);
  text-decoration: underline;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 10px;
  width: 100%;
}

/* Floating cart button */
.cart-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brown);
  color: #fff;
  border: none;
  font-size: 1.4rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #c2477a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.cart-badge.hidden {
  display: none;
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* Cart drawer */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(380px, 90vw);
  background: var(--white);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  box-shadow: -6px 0 20px rgba(0, 0, 0, 0.15);
}

.cart-drawer.open {
  transform: translateX(0);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--pink-light);
}

.cart-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--brown);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px;
}

.cart-empty {
  text-align: center;
  color: var(--brown-light);
  margin-top: 40px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--pink-light);
}

.cart-item-emoji {
  font-size: 1.6rem;
  width: 38px;
  text-align: center;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 0.78rem;
  color: var(--brown-light);
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-control button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--pink);
  background: var(--pink-light);
  color: var(--brown);
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.qty-control span {
  min-width: 18px;
  text-align: center;
  font-size: 0.85rem;
}

.cart-footer {
  padding: 14px 18px 20px;
  border-top: 1px solid var(--pink-light);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 1rem;
}

/* Delivery/pickup modal */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  width: min(320px, 88vw);
  z-index: 60;
  display: none;
  box-shadow: var(--shadow);
}

.modal.open {
  display: block;
}

.modal h2 {
  margin: 0 0 16px;
  font-size: 1.05rem;
  text-align: center;
}

.modal-options {
  display: flex;
  gap: 10px;
}

/* Footer */
.footer {
  text-align: center;
  color: var(--brown-light);
  font-size: 0.8rem;
  margin-top: 30px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--brown);
  color: #fff;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 0.85rem;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive: larger screens */
@media (min-width: 600px) {
  .catalog {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 20px;
    padding: 24px;
  }

  .header {
    padding: 22px 32px;
  }
}
