@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@400;600;700&family=Manrope:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-strong: #f5f3ff;
  --surface: #ffffff;
  --text: #5b21b6;
  --muted: #2e1065;
  --accent: #c4b5fd;
  --accent-strong: #2e1065;
  --shadow: 0 24px 60px rgba(91, 33, 182, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.filters-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 140px;
  animation: fadeIn 0.8s ease both;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.brand {
  display: flex;
  gap: 20px;
  align-items: center;
}

.brand-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 8px;
}

.brand-title h1 {
  font-family: "Fraunces", serif;
  font-size: 32px;
  margin: 0 0 8px;
}

.brand-title p {
  margin: 0;
  color: var(--muted);
}


.filters {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  display: grid;
  gap: 20px;
}

.filter-group h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.filter-group h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkboxes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-strong);
  color: var(--text);
  font-size: 14px;
}

.checkbox input {
  accent-color: var(--accent);
}

.chip {
  border-radius: 999px;
  border: 1px solid rgba(31, 31, 31, 0.12);
  padding: 8px 14px;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: all 0.2s ease;
}

.chip.active {
  background: var(--text);
  color: #fff;
}

.price-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

#resetFilters {
  align-self: flex-end;
}

.price-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.price-row input,
.price-row select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 31, 31, 0.12);
  background: var(--surface);
  min-width: 140px;
}

.catalog {
  margin-top: 24px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

@media (min-width: 396px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 396px) and (max-width: 467px) {
  .card img {
    height: 180px;
  }

  .card-body {
    padding: 14px;
    gap: 8px;
  }

  .card h3 {
    font-size: 16px;
  }

  .card p {
    font-size: 13px;
    min-height: 36px;
  }

  .card .price {
    font-size: 16px;
  }

  .primary,
  .ghost {
    font-size: 13px;
    padding: 8px 12px;
  }
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  animation: floatIn 0.5s ease both;
  animation-delay: var(--delay, 0ms);
}

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

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.card h3 {
  margin: 0;
  font-size: 18px;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  min-height: 40px;
}

.card .price {
  font-weight: 600;
  font-size: 18px;
}

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

@media (min-width: 396px) and (max-width: 568px) {
  .card .actions {
    flex-direction: column;
  }

  .card .actions .primary {
    order: 2;
  }

  .card .actions .ghost {
    order: 1;
  }
}

.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.primary:hover {
  background: var(--accent-strong);
}

.primary.is-added {
  background: rgba(46, 16, 101, 0.12);
  color: var(--accent-strong);
}

.primary.is-added:hover {
  background: rgba(46, 16, 101, 0.2);
}

.ghost {
  background: #fff;
  border: 1px solid rgba(31, 31, 31, 0.12);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.empty {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow);
}

.load-more {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.hidden {
  display: none;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 31, 31, 0.4);
  backdrop-filter: blur(6px);
  z-index: 54;
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(
    180deg,
    rgba(250, 247, 242, 0) 0%,
    rgba(250, 247, 242, 0.9) 45%,
    rgba(196, 181, 253, 0.188) 100%
  );
  z-index: 50;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.bottom-bar button {
  width: 100%;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 80vh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 55;
  display: grid;
  grid-template-rows: auto 1fr;
  overscroll-behavior: contain;
}

.sheet.open {
  transform: translateY(0);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(31, 31, 31, 0.08);
}

.sheet-body {
  padding: 16px 20px calc(120px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: grid;
  gap: 20px;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 60;
  display: grid;
  grid-template-rows: auto 1fr;
}

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

.drawer-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-body {
  position: relative;
  overflow: hidden;
}

.cart-view,
.checkout-view {
  position: absolute;
  inset: 0;
  padding: 0 20px 20px;
  overflow-y: auto;
  display: grid;
  gap: 16px;
  opacity: 1;
  transform: translateX(0);
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: auto;
}

.checkout-view {
  opacity: 0;
  transform: translateX(8%);
  pointer-events: none;
}

.drawer.is-checkout .cart-view {
  opacity: 0;
  transform: translateX(-8%);
  pointer-events: none;
}

.drawer.is-checkout .checkout-view {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.cart-items {
  padding: 0;
  display: grid;
  gap: 12px;
}

.cart-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: flex-start;
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--bg-strong);
}

.cart-item img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

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

.qty-controls button {
  border: 1px solid rgba(31, 31, 31, 0.12);
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}

.cart-empty {
  padding: 20px;
  color: var(--muted);
}

.cart-footer {
  position: sticky;
  bottom: 0;
  padding: 16px 0 20px;
  background: var(--surface);
  border-top: 1px solid rgba(31, 31, 31, 0.08);
  display: grid;
  gap: 12px;
  align-items: flex-end;
}

.cart-footer button {
  width: 100%;
  height: 60px;
  justify-self: start;
}

.totals {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(31, 31, 31, 0.45);
  backdrop-filter: blur(6px);
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(520px, 92vw);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.details-card {
  width: min(640px, 92vw);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.checkout-form {
  display: grid;
  gap: 18px;
}

.payment-row {
  display: grid;
  gap: 10px;
}

.payment-row h3 {
  margin: 0;
  font-size: 16px;
}

.payment-options {
  display: grid;
  gap: 10px;
}

.payment-options .radio {
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.03);
  padding: 10px 12px;
}

.payment-final {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-strong);
}

.payment-final span {
  color: var(--muted);
}

.payment-final strong {
  color: var(--text);
}

.delivery-options {
  display: grid;
  gap: 8px;
}

.contact-status {
  font-size: 13px;
  color: var(--muted);
}

.contact-status.loading {
  color: var(--muted);
}

.contact-status.filled {
  color: var(--text);
}

.form-section {
  display: grid;
  gap: 10px;
}

.form-section label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.form-section input,
.form-section textarea {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 31, 31, 0.12);
}

.radio {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
}

.checkout-totals {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-strong);
}

.checkout-totals .line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.checkout-totals .line.total {
  border-top: 1px solid rgba(31, 31, 31, 0.08);
  padding-top: 8px;
}

.checkout-success {
  display: grid;
  gap: 12px;
  text-align: center;
}

.details-body {
  display: grid;
  gap: 16px;
}

.details-gallery {
  position: relative;
  width: 100%;
}

.details-viewport {
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-strong);
  position: relative;
}

.details-track {
  display: flex;
  transition: transform 0.35s ease;
  will-change: transform;
}

.details-track img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  flex: 0 0 100%;
}

#detailsPrev,
#detailsNext {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

#detailsPrev {
  left: 8px;
}

#detailsNext {
  right: 8px;
}

.details-description {
  margin: 0;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 8px);
  background: var(--surface);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 80;
}

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

.success-badge {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e7f6ee;
  color: #2f8a4b;
  font-size: 32px;
  margin: 0 auto;
}

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

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

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .search input {
    min-width: 180px;
  }

  .price-row {
    flex-direction: column;
    align-items: stretch;
  }
}
