/* Madar3d WhatsApp Catalog — pastel purple/cream theme (palette.md direction, chosen by Yousef 2026-07-03) */
:root {
  --base: #453366;          /* deep purple — header, cart bar */
  --accent: #7c63aa;        /* medium purple — buttons, prices (white text passes contrast) */
  --accent-hover: #6b539a;
  --gold: #cdb8e8;          /* lilac accent on dark surfaces */
  --surface: #fdf9f0;       /* cream page background */
  --surface-warm: #f5eefb;  /* pale lavender sections/placeholders */
  --card: #ffffff;
  --text: #332650;
  --text-light: #f3edfc;
  --text-muted: #6f5f96;
  --border: #e9dff5;
  --whatsapp: #25d366;
  --radius: 18px; /* concentric: inner button 8px + 10px card padding */
}

* { box-sizing: border-box; }
button, select, input, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, system-ui, sans-serif;
  background: var(--surface);
  color: var(--text);
  padding-bottom: 84px; /* room for cart bar */
  -webkit-font-smoothing: antialiased;
}
h1, h2 { text-wrap: balance; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--base);
  color: var(--text-light);
  position: sticky;
  top: 0;
  z-index: 20;
}
.logo { height: 44px; width: auto; background: var(--card); border-radius: 10px; padding: 4px; }
.header-text { flex: 1; min-width: 0; }
.header-text h1 { margin: 0; font-size: 1.15rem; }
.header-text p { margin: 2px 0 0; font-size: 0.78rem; color: var(--gold); }
.lang-toggle {
  background: transparent;
  color: var(--text-light);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 6px 12px;
  min-height: 40px;
  min-width: 44px;
  font-size: 0.9rem;
  cursor: pointer;
}

.how-strip {
  max-width: 1080px;
  margin: 12px auto 0;
  padding: 10px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
  background: var(--surface-warm);
  border-radius: 0 0 12px 12px;
}
.lang-toggle:hover { background: rgba(255, 255, 255, 0.12); }

/* Catalog */
main { max-width: 1080px; margin: 0 auto; padding: 8px 14px 24px; }
.loading { text-align: center; color: var(--text-muted); padding: 3rem 0; }
.collection-title {
  font-size: 1.05rem;
  color: var(--text-muted);
  border-bottom: 2px solid var(--gold);
  padding-bottom: 4px;
  margin: 26px 2px 12px;
  scroll-margin-top: 84px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(69, 51, 102, 0.04), 0 4px 12px rgba(69, 51, 102, 0.05);
}
.card-photo {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  display: block;
  background: var(--surface-warm);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.card-photo.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-photo.placeholder img { height: 34%; opacity: 0.35; }
.card-body { padding: 10px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card-name { font-size: 0.92rem; font-weight: 600; margin: 0; line-height: 1.3; text-wrap: pretty; }
.card-price { color: var(--accent); font-weight: 700; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.card select, .card input[type="text"] {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.86rem;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}
.field-hint { color: #c0392b; font-size: 0.75rem; display: none; margin: 0; }
.card.needs-name .field-hint { display: block; }
.add-btn {
  margin-top: auto;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px; /* concentric with 18px card, 10px padding */
  padding: 9px;
  min-height: 40px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition-property: background-color, transform;
  transition-duration: 150ms;
}
.add-btn:hover { background: var(--accent-hover); }
.add-btn:active { transform: scale(0.96); }
.add-btn.added { background: var(--base); }

/* Cart bar */
.cart-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--base);
  z-index: 30;
}
.cart-bar-btn {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  transition-property: background-color, transform;
  transition-duration: 150ms;
}
.cart-bar-btn:hover { background: var(--accent-hover); }
.cart-bar-btn:active { transform: scale(0.96); }
#cartCount {
  background: #fff;
  color: var(--accent);
  border-radius: 999px;
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

/* Cart sheet */
.cart-sheet[hidden] { display: none; }
.cart-sheet {
  position: fixed;
  inset: 0;
  background: rgba(51, 38, 80, 0.55);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: sheet-fade 200ms cubic-bezier(0.2, 0, 0, 1);
}
.cart-sheet .cart-sheet-inner {
  animation: sheet-rise 240ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes sheet-fade { from { opacity: 0; } }
@keyframes sheet-rise { from { transform: translateY(24px); } }
@media (prefers-reduced-motion: reduce) {
  .cart-sheet, .cart-sheet .cart-sheet-inner { animation: none; }
  .add-btn, .cart-bar-btn, .whatsapp-btn { transition-duration: 0ms; }
}
.cart-sheet-inner {
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.cart-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.cart-sheet-head h2 { margin: 0; font-size: 1.1rem; }
.close-btn { background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); min-width: 40px; min-height: 40px; }
.close-btn:hover { color: var(--text); }
.cart-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.cart-line-info { flex: 1; min-width: 0; }
.cart-line-name { font-size: 0.9rem; font-weight: 600; }
.cart-line-meta { font-size: 0.78rem; color: var(--text-muted); }
.cart-line-price { font-size: 0.85rem; color: var(--accent); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button {
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text);
}
.qty button:hover { background: var(--surface-warm); }
.qty span { font-variant-numeric: tabular-nums; }
.cart-sheet-total {
  display: flex;
  justify-content: space-between;
  padding: 14px 2px;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.whatsapp-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--whatsapp);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 13px;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition-property: background-color, transform;
  transition-duration: 150ms;
}
.whatsapp-btn:hover:not(:disabled) { background: #1fb858; }
.whatsapp-btn:active:not(:disabled) { transform: scale(0.96); }
.trust-note {
  margin: 10px 2px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-wrap: pretty;
}
.whatsapp-btn:disabled { background: #b9b3c6; cursor: not-allowed; }
.clear-link {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
}

.site-footer { text-align: center; color: var(--text-muted); font-size: 0.8rem; padding: 18px 14px 26px; }
.error-card {
  background: var(--surface-warm);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-top: 2rem;
}

/* LTR (English) adjustments — layout is direction-agnostic via flex/grid */
[dir="ltr"] body, [dir="ltr"] { font-family: "Segoe UI", system-ui, sans-serif; }

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .header-text h1 { font-size: 1.3rem; }
}
