@import url('https://v1.fontapi.ir/css/Vazir');

:root {
  --bg-color: #ffffff;
  --text-color: #222;
  --card-bg: #fff;
  --accent: linear-gradient(90deg,#2ea44f,#ff7a00);
}

body.dark {
  --bg-color: #111;
  --text-color: #eee;
  --card-bg: #1e1e1e;
  --accent: linear-gradient(90deg,#217c3a,#ff6600);
}

body {
  font-family: 'Vazir', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
}
button, input, h2, p, .categories button {
  font-family: 'Vazir', sans-serif;
}

/* 🟢 اصلاح هدر برای چینش بهتر */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between; /* چینش از چپ به راست */
  align-items: center;
  background: var(--card-bg);
  padding: 10px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  flex-wrap: wrap; /* اجازه شکستن خطوط در موبایل */
}
.logo {
  font-size: 20px;
  font-weight: 700;
  background: var(--accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  order: 1; /* ترتیب لوگو */
}

/* 🟢 چینش جدید برای دکمه‌های عملیاتی (تم و سبد) */
.header-actions {
    display: flex;
    gap: 10px;
    order: 3; /* ترتیب در موبایل (می‌خواهیم در سمت چپ باشند) */
    align-items: center;
}

/* 🌙 آیکون تم */
#theme-toggle {
  /* position: absolute; را حذف کردیم */
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-color);
  padding: 0;
}

/* 🛒 استایل دکمه سبد خرید */
#cart-icon-btn {
    position: relative;
    border: none;
    background-color: transparent;
    color: var(--text-color);
    font-size: 22px;
    cursor: pointer;
    padding: 0;
}

/* 🔢 استایل شمارنده سبد خرید */
#cart-count {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: #f44336; /* 🔴 رنگ قرمز */
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    line-height: 1;
    min-width: 15px;
    text-align: center;
    pointer-events: none;
    transition: all 0.2s ease;
}

/* 🔍 تنظیم موقعیت جستجو */
.search-box {
    flex-grow: 1; 
    max-width: 400px; 
    margin: 0 15px; 
    order: 2; /* ترتیب در دسکتاپ (وسط) */
    display: flex;
    gap: 5px;
}
.search-box input {
    flex-grow: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: var(--card-bg);
    color: var(--text-color);
}
.search-box button {
    border: none;
    background: var(--accent);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

/* 📱 تنظیمات برای موبایل (صفحات کوچکتر) */
@media (max-width: 768px) {
  header {
    padding: 10px 12px;
  }
  .logo {
      font-size: 18px;
  }

  /* 🟢 چینش دکمه‌های سبد و تم در سمت راست هدر */
  .header-actions {
      order: 1; /* می‌خواهیم سمت راست باشند (در رایت تو لفت) */
  }

  /* 🔍 فیلد جستجو تمام عرض و در خط جدید */
  .search-box {
    order: 4; /* انتقال به خط جدید */
    width: 100%;
    margin: 10px 0 0 0;
    max-width: 100%;
  }
  /* در موبایل، لوگو سمت راست باشد */
  .logo {
      order: 2; 
      margin-left: auto; /* برای فاصله گرفتن از header-actions */
  }
}
/* ... بقیه استایل‌های قبلی ... */
.categories {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  background: var(--card-bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.categories button {
  border: none;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  background: #f2f2f2;
  color: #333;
  transition: all 0.2s ease;
}

.categories button:hover,
.categories button.active {
  background: linear-gradient(90deg,#2ea44f,#ff7a00);
  color: #fff;
}


/* 🌿 بقیه استایل‌ها بدون تغییر باقی می‌مانند */

.product-card {
  background: var(--card-bg);
  color: var(--text-color);
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 16px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.product-card img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  margin-bottom: 10px;
}
/* 🎯 برچسب انتخاب محصول */
.select-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 6px auto 8px auto;
  font-family: 'Vazir', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #ffb347; /* 🍊 رنگ طلایی-نارنجی ملایم برای تضاد با نام محصول */
  cursor: pointer;
  user-select: none;
}

/* ✅ چک‌باکس انتخاب محصول */
.product-select {
  transform: scale(1.5);
  accent-color: #2ea44f; /* سبز برند دنتوپلاست */
  cursor: pointer;
  margin: 0;
  vertical-align: middle;
}

/* 🌿 نام و قیمت محصول */
.product-card h2 {
  font-family: 'Vazir', sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin: 8px 0 4px;
  color: #ffffff; /* حالت تیره پیش‌فرض */
  text-align: center;
}

.price {
  color: #d1d5db; /* خاکستری روشن در تم تیره */
  font-size: 14px;
  text-align: center;
}

/* ☀️ حالت روشن */
body.light-mode .product-card h2 {
  color: #222222; /* مشکی تیره خوانا */
}

body.light-mode .price {
  color: #333333; /* خاکستری تیره */
}


.add-to-cart {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
}

.whatsapp-btn {
  position: fixed;
  left: 15px;
  bottom: 15px;
  background: #25d366;
  color: white;
  padding: 12px 16px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.modal.hidden {
  display: none;
}

.modal {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
}


/* 🌿 محتوای فرم سفارش */
.modal-content {
  background: var(--card-bg);
  color: var(--text-color);
  border-radius: 16px;
  padding: 20px;
  max-width: 95vw;       /* حداکثر ۹۵٪ عرض صفحه */
  width: 400px;           /* حداکثر برای دسکتاپ */
  max-height: 90vh;       /* حداکثر ۹۰٪ ارتفاع صفحه */
  overflow-y: auto;       /* اگر محتوا زیاد شد، اسکرول داخلی بده */
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  position: relative;
  margin: 20px auto;
}
/* 🖥️ برای موبایل */
@media (max-width: 600px) {
  .modal-content {
    width: 90vw;
    padding: 16px;
    font-size: 14px;
  }
}

/* ✳️ تنظیم ورودی‌های اصلی */
.modal-content input {
  width: 100%;
  max-width: 300px;
  padding: 12px;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid #ccc;
  text-align: center;
  outline: none;
  transition: border 0.2s;
}
.modal-content input:focus {
  border-color: #2ea44f;
}

/* ✳️ ورودی تعداد (کمی کوچکتر و منظم‌تر) */
#productQty {
  width: 120px;
  text-align: center;
  font-weight: bold;
  font-size: 16px;
}



.modal-content button {
  margin-top: 10px;
  padding: 12px;
  width: 100%;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.modal-content .close {
  background: #f44336;
  margin-top: 6px;
}
.qty-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.qty-box input {
  width: 60px;
  height: 40px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: var(--card-bg);
  color: var(--text-color);
}

.qty-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
  transition: transform 0.1s ease;
}
.qty-btn:active {
  transform: scale(0.9);
}
.qty-input {
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: 'Vazir', sans-serif;
  font-size: 14px;
  padding: 4px;
  background: var(--card-bg);
  color: var(--text-color);
  transition: border-color 0.2s ease;
}

.qty-input:focus {
  border-color: #2ea44f;
  outline: none;
}

/* 🟢 لی‌اوت محصولات */
main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 20px;
}

/* 🟦 در صفحه‌های بزرگ‌تر (تبلت و دسکتاپ): سه‌ستونه */
@media (min-width: 768px) {
  main {
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
  }
}

/* 🔼 دکمه برگشت به بالا */
#backToTop {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 99999;
  background: linear-gradient(90deg, #2ea44f, #ff7a00);
  color: white;
  font-family: 'Vazir', sans-serif;
  font-size: 22px;
  font-weight: bold;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  transition: opacity 0.3s, transform 0.2s;
  opacity: 0;
  pointer-events: none;
}

#backToTop.show {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

#backToTop:hover {
  transform: scale(1.1);
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

#orderProduct ul {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

#orderProduct li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,0.04);
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}
.form-fields {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.form-fields input {
  width: 80%;
  max-width: 320px;
  margin: 6px 0;
  text-align: center;
}
/* 🌿 دکمه بازگشت به بالا */
#scrollTopBtn {
  position: fixed;
  bottom: 90px; /* بالاتر از دکمه واتساپ */
  right: 16px;
  background: linear-gradient(135deg, #16a34a, #f97316);
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 10000;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#scrollTopBtn.show {
  display: flex;
  opacity: 1;
}

#scrollTopBtn:hover {
  transform: scale(1.1);
}

@media (max-width: 768px) {
  #scrollTopBtn {
    bottom: 60px; /* بالاتر از واتساپ در موبایل */
    right: 12px;
    width: 65px;
    height: 65px;
    font-size: 30px;
  }
}

body.dark #scrollTopBtn {
  background: linear-gradient(135deg, #22c55e, #fb923c);
}
/* ☀️ رنگ متن محصولات در حالت روشن (بدون کلاس dark) */
body:not(.dark) .product-card h2 {
  color: #222222; /* مشکی خوانا در حالت روشن */
}

body:not(.dark) .price {
  color: #333333; /* خاکستری تیره برای قیمت */
}

/* 🌙 رنگ در حالت تیره */
body.dark .product-card h2 {
  color: #ffffff; /* سفید در حالت تاریک */
}

body.dark .price {
  color: #d1d5db; /* خاکستری روشن */
}
/* 🌿 افکت تصویری وقتی محصول انتخاب شد */
.product-card.selected img {
  filter: brightness(1.2);
  transform: scale(1.03);
  box-shadow: 0 0 12px rgba(46, 164, 79, 0.5);
  transition: transform 0.25s ease, filter 0.25s ease, box-shadow 0.25s ease;
}
/* 🌿 پیام خوش‌آمد در صفحه اصلی */
/* ✅ نسخه نهایی وسط‌چین پیام خوش‌آمد */
#welcomeMessage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Vazir', sans-serif;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  min-height: 80vh; /* وسط عمودی کل صفحه */
}

/* حالت روشن */
#welcomeMessage h1 {
  color: #222;
  font-size: 30px;
  margin-bottom: 12px;
}

#welcomeMessage p {
  color: #444;
  font-size: 18px;
  line-height: 1.6;
}

/* حالت تاریک */
body.dark #welcomeMessage h1 {
  color: #fff;
}

body.dark #welcomeMessage p {
  color: #d1d5db;
}

/* 📱 موبایل */
@media (max-width: 768px) {
  #welcomeMessage {
    width: 90%;
    padding: 20px;
    font-size: 16px;
    min-height: 70vh;
  }
  #welcomeMessage h1 {
    font-size: 24px;
  }
  #welcomeMessage p {
    font-size: 16px;
  }
}
/* 🌿 وقتی فقط پیام خوش‌آمد در صفحه است، محتوا وسط صفحه بیاد */
main:has(#welcomeMessage) {
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 80vh;
  padding: 0;
}
/* 🌿 استایل فرم پیام موفقیت سفارش */
.order-success-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  font-size: 16px;
  line-height: 1.7;
}

.order-success-message h3 {
  color: #2ea44f; /* 🟢 سبز */
  margin-bottom: 15px;
}

/* حالت تاریک */
body.dark .order-success-message h3 {
  color: #22c55e; /* سبز روشن‌تر */
}

.order-success-message p {
  margin: 8px 0;
}

.order-success-message .card-number {
  font-weight: 700;
  font-size: 18px;
  color: #ff7a00; /* 🟠 نارنجی */
  letter-spacing: 1px;
  user-select: all; /* 🖱️ قابلیت کپی کردن شماره کارت */
  margin: 10px 0;
}

.order-success-message hr {
  width: 80%;
  border: none;
  border-top: 1px solid #eee;
  margin: 15px 0;
}
body.dark .order-success-message hr {
  border-top: 1px solid #333;
}

.order-success-message .close {
  width: 100%;
  margin-top: 15px;
  background: #f44336 !important; /* 🔴 قرمز */
}