:root {
  --primary: #be185d;
  --primary-dark: #9d174d;
  --primary-light: #fce7f3;
  --accent: #f9a8d4;
  --bg: #fdf2f8;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  --radius: 16px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.7;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

a { color: inherit; }

/* ---------- Header ---------- */
header {
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  gap: 16px;
}
.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
nav a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all 0.2s;
  font-size: 0.95rem;
}
nav a:hover { background: var(--primary-light); color: var(--primary); }
nav a.btn { background: var(--primary); color: white; }
nav a.btn:hover { background: var(--primary-dark); color: white; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary-light) 0%, #fff 100%);
  padding: 60px 0;
  text-align: center;
}
.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--primary);
}
.hero p { font-size: 1.15rem; color: var(--text-muted); }

/* ---------- Products ---------- */
.section { padding: 60px 0; }
.section-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::before {
  content: '';
  width: 6px;
  height: 30px;
  background: var(--primary);
  border-radius: 3px;
}
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
}
.product-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: all 0.3s;
  display: block;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.product-card img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  background: var(--primary-light);
  display: block;
}
.product-card-body { padding: 16px; }
.product-card-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; }
.product-card-price { color: var(--primary); font-weight: 700; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 4rem; margin-bottom: 16px; opacity: 0.4; }

/* ---------- Footer ---------- */
footer {
  background: #1f2937;
  color: #d1d5db;
  padding: 40px 0 24px;
  margin-top: auto;
  text-align: center;
}
footer .socials {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
footer .socials a {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: white;
  text-decoration: none;
  font-size: 1.15rem;
  transition: all 0.2s;
}
footer .socials a:hover { background: var(--primary); transform: translateY(-3px); }
footer p { font-size: 0.9rem; opacity: 0.75; }

/* ---------- Product detail ---------- */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  padding: 40px 0;
}
.gallery-main {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.gallery-main img { width: 100%; height: 500px; object-fit: cover; display: block; }
.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.gallery-thumbs img {
  width: 100%; height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.55;
  transition: all 0.2s;
  border: 2px solid transparent;
}
.gallery-thumbs img.active,
.gallery-thumbs img:hover { opacity: 1; border-color: var(--primary); }

.product-info h1 { font-size: 2rem; font-weight: 800; margin-bottom: 16px; }

.price-box {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.price-box .price { font-size: 1.7rem; font-weight: 800; color: var(--primary); }

.info-block {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.info-block h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--primary);
}

.specs-list { display: grid; gap: 4px; }
.spec-row {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.spec-row:last-child { border-bottom: none; }
.spec-row .key { color: var(--text-muted); }

.colors-list { display: flex; flex-wrap: wrap; gap: 10px; }
.color-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  padding: 6px 14px 6px 6px;
  border-radius: 100px;
  font-size: 0.9rem;
}
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--border);
}

.buy-cta {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-top: 8px;
}
.buy-cta p { font-size: 1.05rem; margin-bottom: 16px; font-weight: 600; }
.buy-cta .socials {
  display: flex; justify-content: center; gap: 12px; flex-wrap: wrap;
}
.buy-cta .socials a {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  text-decoration: none;
  transition: all 0.2s;
}
.buy-cta .socials a:hover { background: white; color: var(--primary); transform: scale(1.08); }

/* ---------- Admin ---------- */
.admin-shell { max-width: 1000px; margin: 40px auto; }
.card {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--primary);
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  background: white;
  color: var(--text);
}
.form-group input:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 90px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--text-muted); }
.btn-secondary:hover { background: #4b5563; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; justify-content: center; }

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}
.tab {
  padding: 12px 20px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.dynamic-row {
  display: flex; gap: 8px; margin-bottom: 8px; align-items: center;
}
.dynamic-row input { flex: 1; }
.dynamic-row input[type="color"] { width: 48px; padding: 2px; height: 42px; cursor: pointer; }

.image-preview {
  position: relative;
  display: inline-block;
  margin: 6px;
}
.image-preview img {
  width: 110px; height: 110px; object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
}
.image-preview .remove {
  position: absolute;
  top: -8px; left: -8px;
  background: #dc2626;
  color: white;
  border: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}

.upload-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}
.upload-box:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-box input { display: none; }
.upload-box .icon { font-size: 1.8rem; color: var(--primary); margin-bottom: 6px; }
.upload-box small { color: var(--text-muted); }

.product-row {
  display: flex; gap: 14px; align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: white;
}
.product-row img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
}
.product-row .info { flex: 1; min-width: 0; }
.product-row .info h4 { font-weight: 700; margin-bottom: 2px; font-size: 0.95rem; }
.product-row .info span { color: var(--primary); font-weight: 600; font-size: 0.9rem; }

.login-box {
  max-width: 400px;
  margin: 80px auto;
  background: white;
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }

/* ---------- About ---------- */
.about-content {
  max-width: 800px;
  margin: 40px auto;
  background: white;
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
  line-height: 2;
  font-size: 1.05rem;
}
.about-content h1 { color: var(--primary); margin-bottom: 20px; font-size: 2rem; }
.about-content p { margin-bottom: 16px; color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.7rem; }
  .hero { padding: 40px 0; }
  .header-inner { flex-direction: column; gap: 10px; padding: 12px 0; }
  .product-detail { grid-template-columns: 1fr; gap: 24px; padding: 24px 0; }
  .gallery-main img { height: 320px; }
  .gallery-thumbs img { height: 70px; }
  .section { padding: 40px 0; }
  .section-title { font-size: 1.4rem; }
  .product-info h1 { font-size: 1.5rem; }
  .price-box .price { font-size: 1.4rem; }
  .about-content { padding: 24px; }
  .card { padding: 20px; }
  .buy-cta .socials a { width: 48px; height: 48px; font-size: 1.2rem; }
}
/* ---------- Blog grid ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.blog-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.blog-card-img { overflow: hidden; height: 200px; background: var(--primary-light); }
.blog-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.blog-card:hover .blog-card-img img { transform: scale(1.05); }
.blog-card-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.blog-card-body h3 { font-size: 1.15rem; font-weight: 700; line-height: 1.5; }
.blog-card-body p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.8; flex: 1; }
.read-more { color: var(--primary); font-size: 0.88rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }

/* ---------- Article view ---------- */
.article-view { max-width: 780px; margin: 30px auto; }
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--primary); text-decoration: none;
  font-weight: 600; font-size: 0.92rem; margin-bottom: 20px;
}
.article-cover {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
  background: var(--primary-light);
}
.article-cover img { width: 100%; max-height: 480px; object-fit: cover; display: block; }
.article-title { font-size: 2rem; font-weight: 800; margin-bottom: 16px; line-height: 1.5; }
.article-lead {
  font-size: 1.1rem; color: var(--text-muted);
  padding: 16px 20px; border-right: 4px solid var(--primary);
  background: var(--primary-light); border-radius: var(--radius-sm);
  margin-bottom: 24px; line-height: 1.9;
}
.article-content { font-size: 1.05rem; line-height: 2.1; color: var(--text); }
.article-content h1, .article-content h2, .article-content h3 { margin: 24px 0 12px; color: var(--primary); }
.article-content p { margin-bottom: 16px; }
.article-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 16px 0; }
.article-content a { color: var(--primary); }
.article-content ul, .article-content ol { padding-right: 24px; margin-bottom: 16px; }
.article-content blockquote {
  border-right: 4px solid var(--primary);
  background: var(--bg);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  color: var(--text-muted);
}
.article-content code {
  background: #f3f4f6; padding: 2px 8px;
  border-radius: 6px; font-size: 0.9em;
  font-family: monospace; direction: ltr;
}

.about-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 2;
  font-size: 1.05rem;
}

/* ============ ناوبری فعال ============ */
nav a.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

/* ============ اسلایدر — استفاده از --per-view ============ */
.slider-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}
.slider-viewport {
  overflow: hidden;
  flex: 1;
  min-width: 0; 
  border-radius: var(--radius);
  padding: 6px 2px;
}
.slider-track {
  display: flex;
  gap: 20px;
  direction: ltr;
  transition: transform .5s ease;
  will-change: transform;
}

/* هر کارت به اندازه ۱/N عرض — N از --per-view خونده می‌شه */
.slider-card {
  flex: 0 0 calc((100% - (var(--per-view, 3) - 1) * 20px) / var(--per-view, 3));
  min-width: 0;
}

.slider-btn {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--border);
  color: var(--primary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  box-shadow: var(--shadow);
  z-index: 2;
}
.slider-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.08);
}
.slider-btn:active { transform: scale(0.96); }

/* ============ ریسپانسیو اسلایدر ============ */
@media (max-width: 1024px) {
  .slider-card { flex: 0 0 calc((100% - 20px) / 2); }
}
@media (max-width: 640px) {
  .slider-card { flex: 0 0 100%; }
  .slider-btn { width: 38px; height: 38px; font-size: 0.85rem; }
  .slider-track { gap: 14px; }
}

/* ============ about با حفظ خطوط جدید ============ */
.about-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 2;
  font-size: 1.05rem;
}

/* ============ آیکون‌های سفارشی ایرانی ============ */
.icon-rubika, .icon-bale {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.icon-rubika {
  background-image: url("/images/rubika.png");
}

/* بله — دایره آبی با حباب چت سفید */
.icon-bale {
  background-image: url("/images/bale.png");
}


/* ادیتور Quill */
.editor-box {
  background: white;
  border-radius: var(--radius-sm);
  min-height: 200px;
}
.ql-toolbar.ql-snow {
  border: 2px solid var(--border) !important;
  border-bottom: none !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-family: inherit;
  direction: ltr;
}
.ql-container.ql-snow {
  border: 2px solid var(--border) !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
}
.ql-editor {
  direction: rtl;
  text-align: right;
  min-height: 200px;
  line-height: 2;
}
.ql-editor.ql-blank::before {
  right: 15px;
  left: auto;
  color: var(--text-muted);
  font-style: normal;
}

/* ---------- Buy CTA روی موبایل — چسبیده به پایین ---------- */
@media (max-width: 768px) {
  .buy-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    margin: 0;
    border-radius: 0;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  }
  .buy-cta p {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: right;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
  }
  .buy-cta .socials {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: nowrap;
  }
  .buy-cta .socials a {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }
  /* فاصله پایین صفحه تا محتوا زیر نوار نره */
  body {
    padding-bottom: 60px;
  }
}

/* ============ بنر اصلی ============ */
.hero.has-banners {
  padding: 0;
  height: 60vh;
  min-height: 320px;
  max-height: 600px;
  overflow: hidden;
  display: block;
}
.hero.has-banners .container { display: none; }

.banner-slider {
  position: relative;
  width: 100%;
  height: 100%;
  direction: ltr;
  overflow: hidden;
}
.banner-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform .7s ease;
  will-change: transform;
}
.banner-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
}
.banner-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.banner-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  z-index: 3;
  backdrop-filter: blur(4px);
}
.banner-btn:hover { background: rgba(0, 0, 0, 0.65); transform: translateY(-50%) scale(1.08); }
.banner-prev { right: 20px; }
.banner-next { left: 20px; }

.banner-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 3;
}
.banner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  border: none;
  cursor: pointer;
  transition: all .3s;
  padding: 0;
}
.banner-dot.active {
  background: white;
  width: 28px;
  border-radius: 5px;
}

/* پیش‌نمایش بنر توی پنل ادمین */
.banner-preview img {
  width: 220px !important;
  height: 90px !important;
  object-fit: cover;
}

@media (max-width: 768px) {
  .hero.has-banners { height: 45vh; min-height: 240px; max-height: 400px; }
  .banner-btn { width: 38px; height: 38px; font-size: 1rem; }
  .banner-prev { right: 10px; }
  .banner-next { left: 10px; }
  .banner-preview img { width: 160px !important; height: 70px !important; }
}
