/* Monarch Frame — main stylesheet
   Theme color: #0476D0 | Font: Vazirmatn | Mobile-first, lightweight, no framework */

/* Vazirmatn is loaded as a variable font from jsDelivr in includes/header.php
   (official CDN recommended by the font's maintainer, rastikerdar/vazirmatn).
   To self-host instead: download the webfont files from
   https://github.com/rastikerdar/vazirmatn/releases into assets/fonts/
   and add local @font-face rules here — see README for details. */

:root {
  --brand: #0476D0;
  --brand-dark: #035ea3;
  --brand-light: #e8f3fc;
  --ink: #1b2430;
  --muted: #64748b;
  --bg: #ffffff;
  --bg-soft: #f6f9fc;
  --border: #e6ebf1;
  --danger: #d92d20;
  --success: #12805c;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(4, 118, 208, 0.08);
  --max-width: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.75;
  direction: rtl;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

html, body { overflow-x: hidden; }

/* ---------------- Fixed header (announcement bar + navbar) ---------------- */
.site-header-fixed {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
}
.announcement-bar {
  background: var(--brand);
  color: #fff;
  text-align: center;
  font-size: .82rem;
  font-weight: 500;
  padding: 8px 16px;
  transition: opacity .25s ease, transform .25s ease;
}
.navbar {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background .3s ease, backdrop-filter .3s ease, border-color .3s ease;
}
/* Per spec: solid background only at the very top; frosted/blurred (not fully invisible)
   once scrolled. Blur stays a blur() the whole time so the transition never has to
   interpolate to/from "none", which is what caused the abrupt jump before. */
.site-header-fixed.scrolled .navbar {
  background: rgba(255,255,255,.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: rgba(230,235,241,.5);
}
.site-header-fixed.scrolled .announcement-bar {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.nav-admin-link { color: var(--brand) !important; font-weight: 700 !important; }
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--brand);
}
.brand img { height: 36px; width: auto; }
.brand img.brand-logo-solo { height: 48px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}
.nav-links a {
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 500;
  font-size: .84rem;
  color: var(--ink);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { background: var(--brand-light); color: var(--brand); }

.nav-cart { position: relative; }
.nav-cart .badge {
  position: absolute;
  top: -2px; left: -6px;
  background: var(--brand);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--brand);
  padding: 4px 8px;
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed;
    inset: var(--header-height, 68px) 0 0 0;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    transform: translateY(-110%);
    transition: transform .25s ease;
    overflow-y: auto;
    gap: 2px;
    z-index: 199;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 14px 16px; border-bottom: 1px solid var(--border); border-radius: 8px; }
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: .95rem;
  transition: transform .1s, box-shadow .15s, background .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-outline:hover { background: var(--brand-light); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: .85rem; border-radius: 9px; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- Hero / 3D viewer ---------------- */
.hero {
  background: linear-gradient(180deg, var(--brand-light) 0%, #fff 100%);
  padding: 40px 0 20px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 30px;
  align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
}
.hero h1 { font-size: 2rem; margin: 0 0 12px; line-height: 1.4; }
.hero p.lead { color: var(--muted); font-size: 1.05rem; margin-bottom: 22px; }

.brand-dictionary {
  border-top: 1px solid rgba(4,118,208,.18);
  border-bottom: 1px solid rgba(4,118,208,.18);
  padding: 16px 0;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}
.dict-entry { display: flex; flex-direction: column; gap: 2px; }
.dict-word-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dict-word {
  font-family: "Times New Roman", Times, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  font-style: italic;
}
.dict-phonetic {
  font-family: "Times New Roman", Times, serif;
  font-size: 1.02rem;
  color: var(--brand);
  letter-spacing: .3px;
}
.dict-pos {
  font-family: "Times New Roman", Times, serif;
  font-size: .82rem;
  color: var(--muted);
  font-style: italic;
}
.dict-meaning { font-size: .88rem; color: var(--muted); margin-top: 2px; }
@media (max-width: 480px) {
  .brand-dictionary { gap: 16px; }
  .dict-word { font-size: 1.15rem; }
}
.hero-viewer {
  height: 380px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.hero-viewer canvas { width: 100% !important; height: 100% !important; touch-action: pan-y; }
.hero-viewer .viewer-hint {
  position: absolute;
  bottom: 10px; inset-inline: 0;
  text-align: center;
  font-size: .78rem;
  color: var(--muted);
  pointer-events: none;
}
.hero-viewer .viewer-fallback {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------- Section headers ---------------- */
.section { padding: 46px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.section-head h2 { font-size: 1.4rem; margin: 0; }
.section-head a { color: var(--brand); font-weight: 600; font-size: .9rem; }

/* ---------------- Product grid & cards ---------------- */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card .thumb { aspect-ratio: 4/5; background: var(--bg-soft); overflow: hidden; position: relative; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .name { font-weight: 600; font-size: .95rem; }
.card .price { color: var(--brand); font-weight: 700; margin-top: auto; }
.card .price small { color: var(--muted); font-weight: 400; font-size: .75rem; }

.badge-off { background: var(--brand-light); color: var(--brand); font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; display: inline-block; }

/* ---------------- Category chips ---------------- */
.cat-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.cat-chip {
  padding: 10px 18px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-weight: 500;
  font-size: .9rem;
}
.cat-chip:hover, .cat-chip.active { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }

/* ---------------- Product detail page ---------------- */
.product-page { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
@media (max-width: 900px) { .product-page { grid-template-columns: 1fr; gap: 22px; } }
.product-gallery-main {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 540px;
  min-height: 280px;
}
.product-gallery-main img { width: 100%; height: 100%; max-height: 540px; object-fit: contain; }
.product-thumbs { display: flex; gap: 10px; margin-top: 10px; overflow-x: auto; }
.product-thumbs img { width: 70px; height: 70px; object-fit: contain; background: var(--bg-soft); border-radius: 8px; border: 1.5px solid var(--border); cursor: pointer; }
.product-thumbs img.active { border-color: var(--brand); }

.product-title { font-size: 1.5rem; margin: 0 0 8px; }
.product-price { font-size: 1.6rem; color: var(--brand); font-weight: 700; margin: 12px 0; }

.size-options { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 20px; }
.size-option {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: .88rem;
  font-weight: 500;
  text-align: center;
}
.size-option small { display: block; color: var(--muted); font-weight: 400; }
.size-option.selected { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }
.size-option.disabled { opacity: .4; text-decoration: line-through; }

.qty-stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; }
.qty-stepper button { width: 40px; height: 40px; border: none; background: #fff; font-size: 1.1rem; }
.qty-stepper input { width: 50px; text-align: center; border: none; font-size: 1rem; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: .9rem; }
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: .95rem;
  background: #fff;
  color: var(--ink);
}
.form-control:focus { outline: none; border-color: var(--brand); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.form-card { max-width: 480px; margin: 0 auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.error-text { color: var(--danger); font-size: .82rem; margin-top: 4px; }
.alert { padding: 12px 16px; border-radius: 10px; font-size: .9rem; margin-bottom: 16px; }
.alert-error { background: #fdecea; color: var(--danger); }
.alert-success { background: #eafbf3; color: var(--success); }

/* ---------------- Cart / checkout tables ---------------- */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table td, .cart-table th { padding: 14px 10px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: middle; }
.cart-row-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.cart-summary { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; background: var(--bg-soft); }
.cart-summary .row { display: flex; justify-content: space-between; padding: 8px 0; font-size: .92rem; }
.cart-summary .row.total { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 14px; color: var(--brand); }
.checkout-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 30px; align-items: start; }
@media (max-width: 900px) { .checkout-grid { grid-template-columns: 1fr; } }

/* ---------------- Footer ---------------- */
.footer { background: #0d1b2a; color: #cfd8e3; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 30px; padding: 50px 0 20px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer h4 { color: #fff; font-size: 1rem; margin-bottom: 14px; }
.footer a { color: #a9b7c6; font-size: .88rem; display: block; margin-bottom: 10px; }
.footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 18px 0; font-size: .82rem; text-align: center; color: #8595a6; }
.instagram-badge { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: rgba(255,255,255,.06); color: #fff !important; font-weight: 600; }
.instagram-badge svg { width: 18px; height: 18px; }

/* ---------------- Instagram section ---------------- */
.instagram-section {
  position: relative;
  background: linear-gradient(135deg, #7a3ea1 0%, #d62976 42%, #f77737 78%, #fcaf45 100%);
  color: #fff;
  border-radius: 20px;
  padding: 36px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  overflow: hidden;
  isolation: isolate;
}
.instagram-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 15% 20%, rgba(255,255,255,.22), transparent 45%),
              radial-gradient(circle at 90% 85%, rgba(255,255,255,.16), transparent 40%);
  z-index: -1;
}
.instagram-section .insta-icon {
  width: 54px; height: 54px; flex-shrink: 0;
  background: rgba(255,255,255,.18);
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
}
.instagram-section .insta-icon svg { width: 28px; height: 28px; }
.instagram-section .insta-text { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 220px; }
.instagram-section h3 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 700; }
.instagram-section p { margin: 0; opacity: .95; font-size: .92rem; }
.instagram-section .btn-outline {
  background: #fff; color: #d62976; border-color: #fff; font-weight: 700;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
}
.instagram-section .btn-outline:hover { background: #fff; opacity: .92; transform: translateY(-1px); }
@media (max-width: 640px) {
  .instagram-section { padding: 22px 20px; border-radius: 16px; }
  .instagram-section .insta-icon { width: 40px; height: 40px; border-radius: 12px; }
  .instagram-section .insta-icon svg { width: 20px; height: 20px; }
  .instagram-section .insta-text { gap: 10px; }
  .instagram-section h3 { font-size: 1.05rem; }
  .instagram-section p { font-size: .85rem; }
  .instagram-section .btn-outline { width: 100%; }
}

/* ---------------- Misc ---------------- */
.text-center { text-align: center; }
.muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.skeleton { background: linear-gradient(90deg,#eee 25%,#f5f5f5 37%,#eee 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: .88rem; opacity: 0; transition: all .25s; pointer-events: none; z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
