/* Mazel storefront. Colours taken from the logo: cream background, gold accent. */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Regular.cdc140628f11.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Bold.7958481fe611.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --cream: #f0e4d8;
  --cream-light: #f8f2ec;
  --gold: #a8773d;
  --gold-dark: #8a5f2c;
  --gold-light: #d8b07a;
  --ink: #3a2e24;
  --muted: #8a7a6b;
  --line: #e6d8c9;
  --white: #fffdfb;
  --danger: #b3261e;
  --ok: #2e7d32;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif; background: var(--cream-light); color: var(--ink); line-height: 1.8; }
a { color: var(--gold-dark); text-decoration: none; }
a:hover { color: var(--gold); }
img { max-width: 100%; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-size: 14px; }

/* Header */
.topbar { background: var(--gold); color: #fff; text-align: center; font-size: 14px; padding: 6px 12px; }
.site-header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
/* Logo (right) | search in the middle | user icon (left) */
.site-header .bar { display: grid; grid-template-columns: 1fr minmax(0, 460px) 1fr; align-items: center; gap: 16px; padding: 10px 16px; max-width: 1200px; margin: 0 auto; }
.brand { justify-self: start; display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; letter-spacing: 3px; font-size: 20px; }
.brand img { width: 52px; height: 52px; }
.search { display: flex; width: 100%; }
.search input { flex: 1; border: 1px solid var(--line); border-left: 0; border-radius: 0 999px 999px 0; padding: 8px 16px; font: inherit; background: var(--cream-light); min-width: 0; }
.search button { border-radius: 999px 0 0 999px; padding: 8px 14px; display: flex; align-items: center; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* Dropdown menus (open on hover, and on tap/click for phones) */
.menu { position: relative; }
.user-menu { justify-self: end; }
.user-trigger { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; color: var(--ink); font: inherit; cursor: pointer; }
.user-trigger:hover { background: none; color: var(--gold-dark); }
.user-trigger:hover .icon-btn { background: var(--gold); color: #fff; }
.user-label { font-size: 15px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { background: var(--cream); color: var(--gold-dark); border-radius: 50%; width: 44px; height: 44px; padding: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.icon-btn:hover { background: var(--gold); color: #fff; }
.icon-btn .icon { width: 24px; height: 24px; }
.dot-badge { position: absolute; top: -4px; left: -4px; margin: 0; }
.menu-panel { display: none; position: absolute; top: 100%; z-index: 40; min-width: 200px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(58, 46, 36, .12); padding: 6px; }
.user-menu .menu-panel { left: 0; }
.cat-menu .menu-panel { right: 0; max-height: 70vh; overflow-y: auto; }
.menu:hover > .menu-panel, .menu:focus-within > .menu-panel, .menu.open > .menu-panel { display: block; }
.menu-panel::before { content: ""; position: absolute; top: -10px; left: 0; right: 0; height: 10px; } /* keeps hover while moving the mouse down */
.menu-panel a, .menu-logout { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--ink); font-size: 15px; white-space: nowrap; width: 100%; background: none; border: 0; font: inherit; cursor: pointer; text-align: right; }
.menu-panel a:hover, .menu-logout:hover { background: var(--cream); color: var(--ink); }
/* Categories mega menu: one column per main category; long lists continue in a new column (height stays the same) */
.menu-panel.mega { padding: 14px 16px; width: max-content; max-width: min(960px, 94vw); overflow-x: auto; }
.menu:hover > .menu-panel.mega, .menu:focus-within > .menu-panel.mega, .menu.open > .menu-panel.mega { display: flex; gap: 28px; align-items: flex-start; }
.mega-col { display: flex; flex-direction: column; gap: 2px; }
.menu-panel .mega-title { font-weight: 700; color: var(--gold-dark); border-bottom: 1px solid var(--line); border-radius: 0; padding: 6px 8px 8px; margin-bottom: 4px; }
.mega-items { display: grid; grid-auto-flow: column; grid-template-rows: repeat(6, auto); column-gap: 14px; }
.menu-panel .mega-items a { padding: 7px 8px; font-size: 14px; }
.menu-panel form { margin: 0; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }

/* Second row: categories, contact, about */
.cats { display: flex; gap: 26px; align-items: center; padding: 2px 16px 10px; max-width: 1200px; margin: 0 auto; flex-wrap: wrap; }
.cats > a, .cats .menu-trigger { display: flex; align-items: center; gap: 6px; color: var(--ink); white-space: nowrap; font-size: 15px; }
.cats > a:hover, .cats .menu-trigger:hover { color: var(--gold); }
.cats .icon { color: var(--gold); }
.cats .caret { width: 16px; height: 16px; }

/* Buttons and forms */
button, .btn { background: var(--gold); color: #fff; border: 0; border-radius: 999px; padding: 9px 20px; font: inherit; cursor: pointer; display: inline-block; text-align: center; }
button:hover, .btn:hover { background: var(--gold-dark); color: #fff; }
button:disabled, .btn.disabled { background: #cbbfb3; cursor: not-allowed; }
.btn-light { background: var(--cream); color: var(--ink); }
.btn-light:hover { background: var(--line); color: var(--ink); }
label { display: block; margin-bottom: 4px; font-size: 14px; }
input[type=text], input[type=email], input[type=number], input:not([type]), textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--white);
}
form p { margin: 0 0 14px; }
/* Drop-downs: our own arrow with room around it (the browser arrow touched the border in RTL) */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding: 9px 14px 9px 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a5f2c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 14px center; background-size: 16px;
}
.toolbar select { padding: 5px 10px 5px 30px; font-size: 13px; background-position: left 10px center; background-size: 13px; border-radius: 8px; width: auto; }
.filter-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.filter-actions button, .filter-actions .btn { padding: 7px 16px; font-size: 14px; flex: 1; }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: 4px 0; font-size: 14px; }

/* Layout pieces */
main { min-height: 60vh; padding: 24px 0 48px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 480px; margin: 0 auto; }
.msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; }
.msg.success { background: #e8f3e9; } .msg.error { background: #fbe9e7; } .msg.info { background: var(--cream); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
h1, h2, h3 { line-height: 1.5; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 0 12px; }
.section-title h2 { margin: 0; font-size: 20px; }

/* Hero */
.hero { background: var(--cream); border-radius: var(--radius); padding: 28px; display: flex; align-items: center; gap: 24px; }
.hero img { width: 140px; height: 140px; }
.hero h1 { margin: 0 0 6px; font-size: 24px; }

/* Category chips */
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: 6px 16px; color: var(--ink); font-size: 14px; }
.chip.active, .chip:hover { border-color: var(--gold); color: var(--gold-dark); }

/* Product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.product-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); display: flex; flex-direction: column; transition: box-shadow .2s; }
.product-card:hover { box-shadow: 0 6px 18px rgba(138, 95, 44, .12); color: var(--ink); }
.product-card .thumb { aspect-ratio: 1 / 1; background: var(--cream); position: relative; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .info { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-card .title { font-size: 15px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 700; color: var(--gold-dark); }
.price small { font-weight: 400; color: var(--muted); }
.labels { display: flex; gap: 4px; flex-wrap: wrap; }
.label { font-size: 12px; color: #fff; border-radius: 999px; padding: 0 10px; }
.badge-out { position: absolute; top: 8px; right: 8px; background: rgba(58, 46, 36, .8); color: #fff; font-size: 12px; border-radius: 999px; padding: 2px 10px; }
.no-image { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }

/* Listing with filters */
.listing { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.filters { position: sticky; top: 130px; }
.filters h3 { font-size: 15px; margin: 14px 0 6px; }
.filters .check { display: flex; gap: 6px; align-items: center; font-size: 14px; margin: 2px 0; }
.filters .check input { width: auto; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar select { width: auto; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span { padding: 4px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--white); }
.pagination .current { background: var(--gold); color: #fff; border-color: var(--gold); }
details.mobile-filters > summary { display: none; }

/* Product page */
.product { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.gallery .main { aspect-ratio: 1 / 1; background: var(--cream); border-radius: var(--radius); overflow: hidden; }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.gallery .main { position: relative; }
.gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; padding: 0; border-radius: 50%;
  background: rgba(255, 253, 251, .85); color: var(--gold-dark); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.gallery-nav:hover { background: var(--gold); color: #fff; }
.gallery-nav.next { left: 10px; }   /* RTL: «next» is to the left */
.gallery-nav.prev { right: 10px; }
.gallery .thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.gallery .thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 2px solid transparent; cursor: pointer; }
.gallery .thumbs img.active { border-color: var(--gold); }
.option-group { margin: 14px 0; }
.option-group .name { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.options { display: flex; gap: 8px; flex-wrap: wrap; }
.opt { background: var(--white); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; display: flex; gap: 6px; align-items: center; }
.opt:hover { background: var(--cream); color: var(--ink); }
.opt.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); background: var(--cream-light); }
.opt.unavailable { opacity: .4; }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); display: inline-block; }
.buybox { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 16px; }
.buybox .option-group:first-of-type { margin-top: 12px; }
.buy-row { font-size: 15px; }
.buy-label { color: var(--muted); }
.buy-sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.buybox .big-price { font-size: 26px; font-weight: 700; color: var(--gold-dark); }
.note-final { font-size: 13px; color: var(--ok); }
.description { white-space: pre-line; }

/* Footer */
.site-footer { background: var(--cream); border-top: 1px solid var(--line); padding: 28px 0; font-size: 14px; }
.site-footer .cols { display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }

/* Floating contact button */
.contact-fab { position: fixed; bottom: 18px; left: 18px; z-index: 30; }
.contact-fab > summary { list-style: none; width: 54px; height: 54px; border-radius: 50%; background: var(--gold); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); font-size: 24px; }
.contact-fab > summary::-webkit-details-marker { display: none; }
.contact-fab .menu { position: absolute; bottom: 64px; left: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; min-width: 160px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.contact-fab .menu a { padding: 8px 12px; border-radius: 8px; color: var(--ink); }
.contact-fab .menu a:hover { background: var(--cream); }

/* Mobile */
@media (max-width: 800px) {
  .site-header .bar { grid-template-columns: 1fr auto; }
  .search { grid-column: 1 / -1; grid-row: 2; }
  .user-label { font-size: 13px; max-width: 110px; }
  .icon-btn { width: 38px; height: 38px; }
  .cats { gap: 14px; flex-wrap: nowrap; justify-content: space-between; padding: 2px 12px 10px; }
  .cats > a, .cats .menu-trigger { font-size: 13px; gap: 4px; }
  .cats .icon { width: 17px; height: 17px; }
  .cat-menu .menu-panel { right: 0; }
  .menu:hover > .menu-panel.mega, .menu:focus-within > .menu-panel.mega, .menu.open > .menu-panel.mega { gap: 18px; }
  .brand img { width: 42px; height: 42px; }
  .listing { grid-template-columns: 1fr; }
  .filters { position: static; }
  details.mobile-filters > summary { display: block; cursor: pointer; padding: 10px 0; color: var(--gold-dark); }
  .product { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .hero { flex-direction: column; text-align: center; }
}

/* Product page: brand chip, quantity + add to cart, related products */
.brand-chip { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; color: var(--gold-dark); background: var(--cream-light); }
.brand-chip:hover { border-color: var(--gold); background: var(--cream); }
.add-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.add-row button { flex: 1; }
.qty-label { margin: 0; font-size: 14px; color: var(--muted); }
.qty-select { width: auto; padding: 8px 12px 8px 32px; background-position: left 10px center; }
.related { margin-top: 28px; }
.related-title { margin: 0 0 14px; font-size: 18px; }
.related-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 800px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
