/* =====================================================
   RESET & BASE
===================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f2f3f5;
  color: #1c1c1c;
  direction: rtl;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

/* =====================================================
   COLOR SYSTEM
===================================================== */
:root {
  --bg-main: #f2f3f5;
  --bg-card: #ffffff;
  --bg-soft: #eeeeee;

  --text-main: #1c1c1c;
  --text-muted: #6b6b6b;

  --gold-main: #c9a24d;
  --gold-dark: #b08c3c;

  --border-light: #e0e0e0;

  --shadow-soft: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-hover: 0 10px 30px rgba(0,0,0,0.15);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
}

/* =====================================================
   HEADER
===================================================== */
header {
  background: var(--bg-card);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 999;
}

.header-inner {
  display: flex;
  justify-content: space-between; /* دکمه چپ، لوگو وسط، بقیه راست */
  align-items: center;
  padding: 14px 16px;
}

.logo {
  font-size: 20px;
  font-weight: 800;
  flex: 1; /* اجازه می‌ده لوگو وسط بمونه */
  text-align: center;
}

.logo span {
  color: var(--gold-main);
}

/* دکمه کتگوری */
#divcategory {
  flex: 0;
}

#categoryBtn {
  font-size: 16px;
  font-weight: 600;
  background: var(--gold-main);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: background 0.3s ease;
}

#categoryBtn:hover {
  background: var(--gold-dark);
}

/* حالت موبایل */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column; /* همه زیر هم */
  }

  #divcategory {
    order: 1; /* اول دکمه */
    margin-bottom: 10px;
  }

  .logo {
    order: 2; /* بعد لوگو */
    text-align: center;
  }
}


/* =====================================================
   CATEGORY BUTTON (INDEX – FIXED)
===================================================== */

#divcategory {
  position: relative;

}

.buttoncategory {
  background: #f0f0f0;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  border: 1px solid var(--border-light);
}

.divtwocategory {
  position: absolute;
  top: 46px;
  right: 0;
  background: var(--bg-card);
  width: 210px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  display: none;
  overflow: hidden;
}

.divtwocategory a {
  display: block;
  padding: 12px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
}

.divtwocategory a:last-child {
  border-bottom: none;
}

.show {
  display: block;
}

/* =====================================================
   HERO
===================================================== */
.hero-curve {
  background: linear-gradient(135deg, #3a3a3a, #5a5a5a);
  color: #fff;
  padding: 28px 16px 34px;
  border-radius: 0 0 32px 32px;
  text-align: center;
}

.hero-curve h1 {
  font-size: 20px;
  margin-bottom: 6px;
}

.hero-curve p {
  font-size: 14px;
  opacity: 0.85;
}

/* =====================================================
   CATEGORY GRID (INDEX)
===================================================== */
.categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
}

.cat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 18px 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}

/* =====================================================
   SECTION TITLE
===================================================== */
.section-title {
  padding: 0 16px;
  margin: 22px 0 12px;
  font-size: 18px;
  font-weight: 700;
}

/* =====================================================
   PRODUCT SLIDER (INDEX)
===================================================== */
.swiper-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.swiper-wrapper {
  display: flex;
  gap: 12px;
  padding: 0 12px 16px;
}

/* =====================================================
   PRODUCT CARD (GLOBAL – FIXED)
===================================================== */
.item-card {
  flex: 0 0 calc(50% - 6px); /* موبایل فقط ۲ کارت */
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}

.item-card a {
  display: block;
}

/* IMAGE */
.image-container {
  background: var(--bg-soft);
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* DETAILS */
.item-details {
  padding: 12px 12px 46px;
}

.item-details h3 {
  font-size: 15px;
  line-height: 1.4;
  margin: 0 0 6px;
}

.item-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-main);
}

/* ADD BUTTON */
.cart-btn {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-main);
  color: #fff;
  font-size: 20px;
}
/* =====================================================
   CATEGORY PAGE – ORIGINAL STYLE FIXED
===================================================== */
.products {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* موبایل: ۲ کارت بزرگ */
  gap: 6px;                                /* فاصله کارت‌ها */
  padding: 8px;
}

.product-card {
  background: var(--bg-card);             /* همان کارت طلایی */
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

/* IMAGE */
.product-card img {
  width: 100%;
  height: 300px;          /* ارتفاع مشابه قبل */
  object-fit: cover;
  border-bottom: 1px solid var(--border-light); /* همان خطوط قبلی */
}

/* TITLE & DESCRIPTION */
.product-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin: 8px;
}

.product-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 8px 8px;
}

/* BUTTON */
.product-card a {
  display: inline-block;
  margin: 8px;
  background: var(--gold-main); /* طلایی */
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: center;
}

/* =====================================================
   PRODUCT PAGE
===================================================== */
.product-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.product-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  padding: 16px;
}

.image-box {
  width: 100%;
  height: 280px;
  background: var(--bg-soft);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-details h2 {
  font-size: 20px;
  margin: 12px 0;
  font-weight: 700;
}

.product-details p {
  font-size: 14px;
  color: var(--text-main);
  margin: 6px 0;
  line-height: 1.5;
}

.btn-add {
  display: block;
  width: 100%;
  padding: 12px 0;
  background: var(--gold-main);
  color: #fff;
  font-size: 16px;
  border-radius: var(--radius-md);
  margin-top: 16px;
  transition: 0.3s;
}

.btn-add:hover {
  background: var(--gold-dark);
}

.back-btn {
  display: inline-block;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

/* =====================================================
   CART PAGE
===================================================== */
.cart-container {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

.cart-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.cart-img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-right: 1px solid var(--border-light);
}

.cart-details {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cart-details h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
}

.cart-details p {
  font-size: 14px;
  color: var(--gold-main);
  font-weight: 700;
}

.cart-total {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
}

.empty-cart {
  text-align: center;
  margin-top: 40px;
  font-size: 16px;
  color: var(--text-muted);
}

/* =====================================================
   FOOTER
===================================================== */
footer {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-card);
  margin-top: 24px;
}

/* =====================================================
   RESPONSIVE – CLEAN & SAFE
===================================================== */

/* TABLET */
@media (min-width: 768px) {

  /* دسته‌بندی‌های صفحه اصلی */
  .categories {
    grid-template-columns: repeat(3, 1fr);
  }

  /* اسلایدر محصولات (index) */
  .item-card {
    flex: 0 0 calc(33.33% - 8px);
  }

  /* گرید محصولات کتگوری */
  .products {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px;
  }
}

/* DESKTOP */
@media (min-width: 1024px) {

  .categories {
    grid-template-columns: repeat(4, 1fr);
  }

  .item-card {
    flex: 0 0 calc(25% - 12px);
  }

  .products {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* =====================================================
   TAP ZONE FIXES (MOBILE FRIENDLY)
===================================================== */
.item-card a,
.product-card a {
  display: block;
  width: 100%;
  height: 100%;
  z-index: 2;
  position: relative;
}

.item-card .cart-btn {
  z-index: 3;
}

/* =====================================================
   SCROLLBAR SOFT (IOS + ANDROID)
===================================================== */
.swiper-container {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--gold-main);
  border-radius: 3px;
}

::-webkit-scrollbar-track {
  background: var(--bg-soft);
  border-radius: 3px;
}
