/* ═══════════════════════════════════════════════════════
   کافه‌تک — style.css
   نسخه: 2.0
   ═══════════════════════════════════════════════════════ */

/* ── فونت ── */
@font-face {
  font-family: 'Abar';
  src: url('asset/fonts/Abar-VF.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ── متغیرها ── */
:root {
  --dk:     #1c0f08;
  --mid:    #3b1f0f;
  --warm:   #5c2e10;
  --amber:  #c8873a;
  --amber2: #e8a84a;
  --cream:  #f5ede3;
  --cream2: #e8d9c8;
  --cream3: #f9f4ee;
  --text:   #2a1506;
  --muted:  #7a5c46;
  --white:  #ffffff;
  --sh:     rgba(60,30,10,.11);
  --radius-card: 14px;
  --radius-modal: 20px;
}

/* ── ریست ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Abar', Tahoma, sans-serif;
  background: var(--cream);
  color: var(--text);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════
   هدر
═══════════════════════════════════════ */
header {
  background: var(--dk);
  position: relative;
  overflow: hidden;
  padding: 52px 20px 42px;
  text-align: center;
}
header::before {
  content: '';
  position: absolute;
  top: -40%; left: -15%;
  width: 55%; height: 190%;
  background: radial-gradient(ellipse, rgba(200,135,58,.13) 0%, transparent 65%);
  pointer-events: none;
}
header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
}
.h-tag {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  color: var(--amber);
  letter-spacing: 3px;
  border: 1px solid rgba(200,135,58,.4);
  padding: 5px 15px;
  border-radius: 20px;
  margin-bottom: 14px;
}
header h1 {
  font-size: 34px; font-weight: 900;
  color: var(--cream);
  line-height: 1.2;
  margin-bottom: 8px;
}
header p {
  color: rgba(245,237,227,.55);
  font-size: 15px; font-weight: 300;
}

/* ═══════════════════════════════════════
   لایه‌بندی اصلی
═══════════════════════════════════════ */
.container {
  max-width: 1260px;
  margin: 28px auto;
  padding: 0 18px;
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

/* ═══════════════════════════════════════
   سایدبار دسته‌بندی
═══════════════════════════════════════ */
.sidebar {
  flex: 0 0 210px;
  background: var(--white);
  border-radius: var(--radius-card);
  box-shadow: 0 4px 18px var(--sh);
  overflow: hidden;
  position: sticky;
  top: 18px;
}
.s-hdr {
  background: var(--mid);
  padding: 14px 18px;
  font-size: 11px; font-weight: 800;
  color: var(--amber);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.c-list { list-style: none; padding: 9px; }
.c-list li { margin-bottom: 2px; }
.c-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600; font-size: 13px;
  padding: 9px 11px;
  border-radius: 9px;
  transition: all .2s;
  cursor: pointer;
}
.c-list a:hover,
.c-list a.active { background: var(--cream3); color: var(--warm); }
.c-list a.active {
  color: var(--amber);
  background: rgba(200,135,58,.08);
  font-weight: 800;
}
.cc {
  font-size: 10px;
  background: var(--cream2);
  padding: 2px 6px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 700;
}
.c-list a.active .cc {
  background: rgba(200,135,58,.15);
  color: var(--amber);
}

/* ═══════════════════════════════════════
   محتوای اصلی
═══════════════════════════════════════ */
.main { flex: 1; min-width: 0; }
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.toolbar h2 { font-size: 19px; font-weight: 800; color: var(--dk); }
.cbadge {
  background: var(--white);
  border: 1px solid var(--cream2);
  color: var(--muted);
  font-size: 11px; font-weight: 700;
  padding: 4px 11px;
  border-radius: 20px;
}

/* ═══════════════════════════════════════
   گرید محصولات
═══════════════════════════════════════ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 20px;
}

/* ═══════════════════════════════════════
   کارت محصول
═══════════════════════════════════════ */
.card {
  background: var(--white);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 2px 10px var(--sh);
  cursor: pointer;
  transition: transform .25s, box-shadow .25s, border-color .25s;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  position: relative;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 36px rgba(60,30,10,.14);
  border-color: var(--amber);
}

/* badge */
.card-badge {
  position: absolute;
  top: 11px; right: 11px;
  background: var(--amber);
  color: var(--dk);
  font-size: 11px; font-weight: 800;
  padding: 3px 9px;
  border-radius: 20px;
  z-index: 2;
}

/* تصویر کارت — فقط تصویر شاخص، بدون استریپ گالری */
.card-img-wrap {
  background: var(--cream3);
  overflow: hidden;
  position: relative;
}
.card-img {
  padding: 16px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-img img {
  max-width: 100%;
  max-height: 188px;
  object-fit: contain;
  transition: transform .3s;
  width: 100%;
}
.card:hover .card-img img { transform: scale(1.04); }

/* برند چیپ */
.brand-chip {
  position: absolute;
  top: 11px; left: 11px;
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--cream2);
  border-radius: 20px;
  padding: 3px 8px 3px 4px;
  opacity: 0;
  transition: opacity .2s;
  z-index: 1;
}
.card:hover .brand-chip { opacity: 1; }
.brand-chip img {
  width: 18px; height: 18px;
  object-fit: contain;
  border-radius: 50%;
}
.brand-chip span { font-size: 10px; font-weight: 700; color: var(--muted); }

/* بدنه کارت */
.card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-cat {
  font-size: 10px;
  color: var(--amber);
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.card-title {
  font-size: 15px; font-weight: 700;
  color: var(--dk);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-price {
  font-size: 17px; font-weight: 900;
  color: var(--warm);
  margin: 12px 0;
  min-height: 24px;
}
.btn-view {
  background: var(--dk);
  color: var(--cream);
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background .2s;
}
.btn-view:hover { background: var(--warm); }

/* ═══════════════════════════════════════
   حالت‌های خالی و لودینگ
═══════════════════════════════════════ */
.empty {
  text-align: center;
  padding: 72px 20px;
  color: var(--muted);
  grid-column: 1 / -1;
}
.empty .ico { font-size: 50px; margin-bottom: 12px; }
.empty h3  { font-size: 17px; font-weight: 700; }
.empty p   { font-size: 13px; margin-top: 4px; }

.loading {
  text-align: center;
  padding: 72px;
  color: var(--muted);
  grid-column: 1 / -1;
}
.sp {
  width: 38px; height: 38px;
  border: 3px solid var(--cream2);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 14px;
}

/* ═══════════════════════════════════════
   انیمیشن‌ها
═══════════════════════════════════════ */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes cardIn  { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
@keyframes mopen   { from { opacity:0; transform:scale(.9) translateY(18px); } to { opacity:1; transform:scale(1) translateY(0); } }

/* ═══════════════════════════════════════
   مودال محصول
═══════════════════════════════════════ */
.modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(28,15,8,.88);
  backdrop-filter: blur(9px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 18px;
}
.modal.open { display: flex; }

.mbox {
  background: var(--white);
  border-radius: var(--radius-modal);
  max-width: 1000px;
  width: 100%;
  display: flex;
  overflow: hidden;
  max-height: 92vh;
  box-shadow: 0 28px 80px rgba(0,0,0,.28);
  animation: mopen .32s cubic-bezier(.34,1.56,.64,1);
  position: relative;
}

/* بخش چپ مودال — تصاویر */
.m-left {
  flex: 0 0 420px;
  background: var(--cream3);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.m-mainimg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 300px;
}
.m-mainimg img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  transition: opacity .22s;
}
.m-mainimg img.fade { opacity: 0; }

/* تامبنیل‌های مودال */
.m-thumbs {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--cream2);
  overflow-x: auto;
  flex-shrink: 0;
}
.m-thumbs::-webkit-scrollbar { height: 4px; }
.m-thumbs::-webkit-scrollbar-thumb { background: var(--amber); border-radius: 2px; }
.mthumb {
  width: 58px; height: 58px;
  border-radius: 8px;
  border: 2px solid var(--cream2);
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  transition: border-color .2s;
  padding: 3px;
  background: var(--white);
}
.mthumb img { width: 100%; height: 100%; object-fit: contain; }
.mthumb:hover, .mthumb.active { border-color: var(--amber); }

.m-badge {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--amber);
  color: var(--dk);
  font-size: 11px; font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
}

/* بخش راست مودال — اطلاعات */
.m-right {
  flex: 1;
  padding: 32px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.m-right::-webkit-scrollbar { width: 4px; }
.m-right::-webkit-scrollbar-thumb { background: var(--amber); border-radius: 2px; }

.close-btn {
  position: absolute;
  top: 14px; left: 14px;
  width: 34px; height: 34px;
  background: rgba(255,255,255,.9);
  border: none; border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: all .2s;
  z-index: 10;
}
.close-btn:hover { background: var(--white); color: var(--warm); transform: scale(1.1); }

/* اطلاعات برند در مودال */
.m-brand {
  display: flex; align-items: center; gap: 10px;
  background: var(--cream3);
  border: 1px solid var(--cream2);
  border-radius: 10px;
  padding: 10px 13px;
  margin-bottom: 14px;
}
.m-brand-logo {
  width: 44px; height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--white);
  padding: 4px;
  border: 1px solid var(--cream2);
  flex-shrink: 0;
}
.m-brand-name    { font-weight: 800; font-size: 14px; color: var(--dk); }
.m-brand-country { font-size: 12px; color: var(--muted); margin-top: 1px; }

.m-cat   { font-size: 11px; color: var(--amber); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.m-name  { font-size: 24px; font-weight: 900; color: var(--dk); margin: 6px 0 4px; line-height: 1.3; }
.m-price { font-size: 21px; font-weight: 900; color: var(--warm); margin: 10px 0; min-height: 28px; }
.m-desc  {
  font-size: 13px; color: var(--muted);
  line-height: 1.95;
  background: var(--cream3);
  padding: 13px 15px;
  border-radius: 10px;
  border-right: 3px solid var(--amber);
  margin-bottom: 18px;
}

/* جدول مشخصات */
.specs-hdr {
  font-size: 13px; font-weight: 800; color: var(--dk);
  margin-bottom: 9px;
  display: flex; align-items: center; gap: 8px;
}
.specs-hdr::after { content: ''; flex: 1; height: 1px; background: var(--cream2); }
.specs-tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 22px; }
.specs-tbl tr { border-bottom: 1px solid var(--cream2); }
.specs-tbl tr:last-child { border-bottom: none; }
.specs-tbl th { text-align: right; padding: 9px 7px; color: var(--muted); font-weight: 700; width: 38%; }
.specs-tbl td { padding: 9px 7px; color: var(--text); font-weight: 500; text-align: right; }

/* دکمه‌های تماس */
.contact-btns { display: flex; gap: 10px; margin-top: auto; padding-top: 4px; }
.btn-contact {
  flex: 1;
  border: none;
  padding: 13px 10px;
  border-radius: 11px;
  font-family: inherit;
  font-size: 14px; font-weight: 800;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .2s;
}
.btn-contact:hover { transform: translateY(-2px); }
.btn-contact svg  { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.btn-call      { background: #1a4a6b; color: #fff; }
.btn-call:hover { background: #1e5c87; box-shadow: 0 6px 18px rgba(26,74,107,.35); }
.btn-whatsapp      { background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1ebe5a; box-shadow: 0 6px 18px rgba(37,211,102,.35); }

/* ═══════════════════════════════════════
   فوتر
═══════════════════════════════════════ */
footer {
  text-align: center;
  padding: 28px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--cream2);
  margin-top: 36px;
}

/* ═══════════════════════════════════════
   ریسپانسیو — تبلت (960px)
═══════════════════════════════════════ */
@media (max-width: 960px) {
  .mbox {
    flex-direction: column;
    max-height: 95vh;
    border-radius: 16px;
  }
  .m-left {
    flex: none;
    /* در موبایل ارتفاع تصویر را محدود می‌کنیم */
    max-height: 300px;
  }
  .m-mainimg { min-height: 200px; padding: 16px; }
  .m-mainimg img { max-height: 220px; }
  .m-right { padding: 20px 18px; }
  .m-name  { font-size: 20px; }
  .m-price { font-size: 18px; }
}

/* ═══════════════════════════════════════
   ریسپانسیو — موبایل (680px)
═══════════════════════════════════════ */
@media (max-width: 680px) {
  header { padding: 36px 16px 30px; }
  header h1 { font-size: 22px; }
  header p  { font-size: 13px; }
  .h-tag    { font-size: 10px; letter-spacing: 2px; }

  .container {
    flex-direction: column;
    padding: 0 12px;
    margin-top: 16px;
    gap: 14px;
  }
  .sidebar {
    position: static;
    flex: none;
    width: 100%;
  }
  /* در موبایل دسته‌بندی‌ها به صورت افقی اسکرول می‌شن */
  .c-list {
    display: flex;
    overflow-x: auto;
    padding: 8px;
    gap: 6px;
    scrollbar-width: none;
  }
  .c-list::-webkit-scrollbar { display: none; }
  .c-list li { margin-bottom: 0; flex-shrink: 0; }
  .c-list a  { white-space: nowrap; }

  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .card-img { height: 160px; padding: 10px; }
  .card-img img { max-height: 140px; }
  .card-body { padding: 10px 12px 14px; }
  .card-title  { font-size: 13px; }
  .card-price  { font-size: 14px; margin: 8px 0; }
  .btn-view    { font-size: 11px; padding: 8px; }

  /* مودال تمام‌صفحه در موبایل */
  .modal { padding: 0; align-items: flex-end; }
  .mbox  {
    border-radius: 18px 18px 0 0;
    max-height: 96vh;
    width: 100%;
    flex-direction: column;
  }
  .m-left { max-height: 260px; }
  .m-mainimg { min-height: 160px; padding: 12px; }
  .m-mainimg img { max-height: 190px; }
  .m-right { padding: 16px 16px 24px; }
  .m-name  { font-size: 18px; }
  .m-price { font-size: 16px; }
  .m-desc  { font-size: 12px; padding: 10px 12px; }
  .specs-tbl { font-size: 12px; }
  .specs-tbl th, .specs-tbl td { padding: 7px 5px; }
  .contact-btns { flex-direction: column; gap: 8px; }
  .btn-contact  { font-size: 13px; padding: 12px; }

  /* تامبنیل در موبایل */
  .mthumb { width: 46px; height: 46px; }
  .m-thumbs { gap: 6px; padding: 8px 12px; }
}

/* ═══════════════════════════════════════
   ریسپانسیو — خیلی کوچک (400px)
═══════════════════════════════════════ */
@media (max-width: 400px) {
  .grid { grid-template-columns: 1fr; }
  .card-img { height: 200px; }
  .card-img img { max-height: 170px; }
}
