/* ============================================================================
   هرکجا | MTheme — Homepage specific (روشن)
   Hero + Search + FeatureBox + CategoryCard + BusinessCard + AppBanner + Steps
   ============================================================================ */

/* ---------- Hero ---------- */
.hero { position:relative; padding-block: clamp(48px, 7vw, 84px) clamp(60px, 9vw, 110px);  background:var(--grad-hero); }
.hero-bg { position:absolute; inset:0; z-index:0; overflow:hidden; }
.hero-layer { position:absolute; inset:0; background-size:cover; background-position:center; background-repeat:no-repeat; opacity:0; transition:opacity 1.4s ease-in-out; }
.hero-layer.active { opacity:1; }
.hero-bg::after { content:''; position:absolute; inset:0; background:linear-gradient(to bottom, rgba(255,255,255,0.78), rgba(248,250,252,0.92)); }
.hero-inner { position:relative; z-index:1; text-align:center; max-width:780px; margin-inline:auto; }
.hero h1 { font-size: clamp(1.9rem, 5.4vw, 3.2rem); font-weight:800; margin-bottom:14px; }
.hero h1 .accent { color:var(--accent); }
/* دکمه‌های Hero — جانشین .hero-search که به Header منتقل شد */
.hero-actions { display:flex; align-items:center; justify-content:center; gap:12px; flex-wrap:wrap; margin-top:6px; }
.hero-sub { color:var(--ink-soft); font-size: clamp(1rem, 2.4vw, 1.2rem); max-width:560px; margin-inline:auto; margin-bottom:30px; }

/* ---------- Search Box (پروازنال) ---------- */
.hero-search { max-width:760px; margin:0 auto; position:relative; z-index:2; }
.search-bar { display:flex; align-items:center; background:#fff; border:1px solid var(--border); border-radius:60px; padding:7px; box-shadow:0 12px 40px rgba(20,33,61,0.10); gap:4px; }
.search-field {
  display:flex; align-items:center; gap:10px; flex:1 1 40%;
  padding:6px 14px; border-radius:50px; transition:background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  border:1.5px solid transparent; background:transparent;
}
.search-field + .search-field { border-inline-start:1px solid rgba(228,233,241,0.8); border-radius:50px; }
.search-field i { color:var(--muted); font-size:1.05rem; transition:color 0.25s ease; }
.search-field input { flex:1; border:none; outline:none; font-size:0.98rem; background:transparent; color:var(--ink); min-width:0; }
.search-field input::placeholder { color:var(--muted); }
.search-field:focus-within { background:var(--brand-soft); border-color:var(--brand); box-shadow:0 0 0 4px rgba(45,108,223,0.12); }
.search-field:focus-within i { color:var(--brand); }
.search-field:hover { background:var(--bg-soft); }
.search-select { display:flex; align-items:center; gap:8px; padding:6px 14px; border-inline-start:1px solid rgba(228,233,241,0.8); }
.search-select i { color:var(--brand); }
.search-select select { border:none; outline:none; background:transparent; color:var(--ink); font-size:0.9rem; font-weight:600; cursor:pointer; appearance:none; }
.search-submit { background:var(--brand); color:#fff; border:none; height:50px; padding:0 30px; border-radius:50px; display:inline-flex; align-items:center; gap:8px; font-weight:700; font-size:0.95rem; flex-shrink:0; transition:all 0.25s ease; }
.search-submit:hover { background:var(--brand-dark); box-shadow:0 8px 20px rgba(45,108,223,0.3); transform:translateY(-1px); }
.search-submit:active { transform:translateY(0); }

/* ---------- Custom Category Selector (App-like) §8 ----------
   ⚠️ این بلوک عمومی فقط مخصوص انتخابگر دسته‌بندی صفحه Search است (Prefix
   «searchPage»). کادر جستجوی هدر نسخهٔ اسکوپ‌شدهٔ خودش را در style.css دارد
   (`#headerSearch .cat-select*`) چون این فایل در همهٔ صفحات لود نمی‌شود و
   همچنین بعد از style.css لود می‌شود. */
.search-cat { position: relative; }
.cat-select { position: relative; flex: 1; min-width: 0; }
.cat-select-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cat-select-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 6px 2px; border: none; background: transparent;
  color: var(--ink); font-weight: 600; font-size: 0.9rem; cursor: pointer;
  white-space: nowrap;
}
.cat-select-btn i { font-size: 0.7rem; color: var(--muted); transition: transform var(--transition); }
.cat-select.open .cat-select-btn i { transform: rotate(180deg); }
.cat-select-menu {
  position: absolute; top: calc(100% + 12px); right: 0; min-width: 220px; z-index: 60;
  border-radius: 16px; padding: 8px; max-height: 320px; overflow-y: auto;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  /* ⚠️ پنهانِ کاملِ منو لازم است، نه فقط opacity/visibility: عنصرِ بسته
     همچنان در محاسبهٔ scrollWidth شرکت می‌کند و چون right آن منفی محاسبه
     می‌شود (تقریباً -103px در /Search/Index)، ۱۲۰px سرریز افقی روی کل صفحه
     می‌سازد → کاربر: «/Search/Index ظاهرش بهم ریخته … حتی تو نمای کامپیوتر».
     display:none در حالت بسته آن را کامل از flow بیرون می‌آورد و انیمیشن
     باز شدن در .open دست‌نخورده می‌ماند. */
  display: none;
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}
.cat-select.open .cat-select-menu {
  display: block;
  opacity: 1; visibility: visible; transform: translateY(0);
}
.cat-opt {
  display: block; width: 100%; text-align: right; padding: 11px 14px; border: none;
  background: transparent; border-radius: 11px; color: var(--ink-soft);
  font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: all var(--transition);
}
.cat-opt:hover { background: var(--brand-soft); color: var(--brand); }
.cat-opt.selected { background: var(--brand); color: #fff; }

/* لحظه جستجو (live) — استایل مشترک در style.css تعریف شده (بدون تکرار) */

/* ---------- 4 Feature Boxes ---------- */
.feature-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:18px; }
.feature-card { position:relative; display:flex; flex-direction:column; align-items:flex-start; gap:10px; padding:26px 22px; background:var(--card); border:1px solid var(--border); border-radius:20px; box-shadow:var(--shadow-sm); transition:all var(--transition); overflow:hidden; }
.feature-card::before { content:''; position:absolute; top:0; left:0; right:0; height:4px; background:var(--grad-hero); opacity:0; transition:opacity var(--transition); }
.feature-card:hover { transform:translateY(-5px); box-shadow:var(--shadow); border-color:transparent; }
.feature-card:hover::before { opacity:1; }
.feature-icon { width:56px; height:56px; border-radius:16px; display:flex; align-items:center; justify-content:center; font-size:1.4rem; }
.feature-card strong { font-size:1.05rem; color:var(--ink); }
.feature-card span { color:var(--muted); font-size:0.85rem; }
.feature-card .fa-arrow-left { position:absolute; bottom:24px; left:22px; color:var(--brand); opacity:0; transition:opacity var(--transition); }
.feature-card:hover .fa-arrow-left { opacity:1; }

/* رنج رنگ پاستلی feature boxها */
.feature-card:nth-child(1) .feature-icon { background:#e8f5ea; color:#006a0d; }
.feature-card:nth-child(2) .feature-icon { background:#fdf1e2; color:#ee8d1a; }
.feature-card:nth-child(3) .feature-icon { background:#EAF8F0; color:#16A34A; }
.feature-card:nth-child(4) .feature-icon { background:#F3EAFD; color:#8B5CF6; }

/* ---------- Category cards ---------- */
.category-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(170px,1fr)); gap:14px; }
.category-card { display:flex; align-items:center; gap:12px; padding:16px 18px; background:var(--card); border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow-sm); transition:all var(--transition); font-weight:600; font-size:0.9rem; color:var(--ink); }
.category-card:hover { transform:translateY(-3px); box-shadow:var(--shadow); border-color:transparent; color:var(--ink); }
.category-card .c-icon { width:44px; height:44px; border-radius:13px; display:flex; align-items:center; justify-content:center; font-size:1.15rem; flex-shrink:0; }
/* پاستل متفاوت برای هر دسته */
.cat-1 .c-icon{background:#e8f5ea;color:#006a0d;} .cat-2 .c-icon{background:#F6EAFD;color:#8B5CF6;}
.cat-3 .c-icon{background:#FDE6EE;color:#E11D6F;} .cat-4 .c-icon{background:#fdf1e2;color:#ee8d1a;}
.cat-5 .c-icon{background:#EAF8F0;color:#16A34A;} .cat-6 .c-icon{background:#E6F7F7;color:#0E9AA7;}
.cat-7 .c-icon{background:#EEF1FE;color:#4756C9;} .cat-8 .c-icon{background:#FDF0E7;color:#EA7C2C;}
.cat-9 .c-icon{background:#EDF5EC;color:#5B8C35;}

/* ---------- Business cards ---------- */
.business-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:22px; }
.business-card { display:block; background:var(--card); border:1px solid var(--border); border-radius:20px; overflow:hidden; box-shadow:var(--shadow-sm); transition:all var(--transition); }
.business-card:hover { transform:translateY(-6px); box-shadow:var(--shadow); border-color:transparent; }
.business-card .thumb { position:relative; aspect-ratio:4/3; overflow:hidden; }
.business-card .thumb img { width:100%; height:100%; object-fit:cover; transition:transform 0.5s; }
.business-card:hover .thumb img { transform:scale(1.05); }
.business-card .b-badge { position:absolute; top:12px; right:12px; background:#fff; color:var(--ink); padding:4px 12px; border-radius:30px; font-size:0.72rem; font-weight:700; box-shadow:var(--shadow-sm); }
.business-card .b-body { padding:16px 16px 18px; }
.business-card .b-body h4 { font-size:1rem; margin:0 0 6px; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.business-card .b-loc { color:var(--muted); font-size:0.82rem; display:flex; align-items:center; gap:6px; }
.business-card .b-loc i { color:var(--brand); }

/* موبایل: کارت افقی اسکرولدار */
.business-hscroll { display:none; }
.see-more { display:inline-flex; align-items:center; gap:8px; color:var(--brand); font-weight:700; font-size:0.92rem; }
.see-more:hover { color:var(--brand-dark); }

/* ---------- App Banner (compact) ---------- */
.app-banner {
  position: relative; border-radius: 24px; overflow: hidden;
  background: linear-gradient(120deg, var(--brand), #3B82F6); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 32px 40px; box-shadow: var(--shadow);
  min-height: 0;
}
.app-banner::after { content:''; position:absolute; top:-60px; left:-60px; width:220px; height:220px; border-radius:50%; background:rgba(255,255,255,0.08); }
.app-banner::before { content:''; position:absolute; bottom:-80px; right:-40px; width:180px; height:180px; border-radius:50%; background:rgba(255,255,255,0.06); }
.app-banner .ab-text { position:relative; z-index:2; }
.app-banner .ab-text h3 { color:#fff; font-size: clamp(1.25rem, 2.6vw, 1.7rem); margin-bottom:6px; }
.app-banner .ab-text p { color:rgba(255,255,255,0.92); font-size:0.95rem; margin:0; }
.app-banner .ab-cta { position:relative; z-index:2; }
.app-banner .ab-cta .btn { background:#fff; color:var(--brand); }
.app-banner .ab-cta .btn:hover { transform:translateY(-2px); box-shadow:0 12px 28px rgba(20,33,61,0.25); }

/* ---------- Steps ---------- */
.steps-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:20px; }
.step-card { position:relative; padding:28px 22px; background:var(--card); border:1px solid var(--border); border-radius:20px; box-shadow:var(--shadow-sm); transition:all var(--transition); }
.step-card:hover { transform:translateY(-4px); box-shadow:var(--shadow); }
.step-num { width:46px; height:46px; border-radius:14px; background:var(--brand-soft); color:var(--brand); font-weight:800; font-size:1.2rem; display:flex; align-items:center; justify-content:center; margin-bottom:16px; }
.step-card:nth-child(2) .step-num{background:var(--accent-soft);color:var(--accent);}
.step-card:nth-child(3) .step-num{background:#EAF8F0;color:#16A34A;}
.step-card:nth-child(4) .step-num{background:#F3EAFD;color:#8B5CF6;}
.step-card h4 { font-size:1.1rem; margin-bottom:8px; }
.step-card p { color:var(--muted); font-size:0.9rem; margin:0; }

/* ---------- Industry (معرفی) cards ---------- */
.industry-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:20px; }
.industry-card { padding:24px; background:var(--card); border:1px solid var(--border); border-radius:20px; box-shadow:var(--shadow-sm); display:flex; flex-direction:column; gap:10px; transition:all var(--transition); }
.industry-card:hover { transform:translateY(-4px); box-shadow:var(--shadow); }
.industry-card .ico { width:54px; height:54px; border-radius:16px; background:var(--brand-soft); color:var(--brand); display:flex; align-items:center; justify-content:center; font-size:1.3rem; }
.industry-card span { color:var(--muted); font-size:0.8rem; }
.industry-card h4 { font-size:1.08rem; margin:0; }
.industry-card p { color:var(--ink-soft); font-size:0.88rem; margin:0; flex:1; }
.industry-card .more { color:var(--brand); font-weight:700; font-size:0.82rem; }

/* ---------- Blog cards ---------- */
.blog-head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:40px; }
.blog-head h2 { font-size: clamp(1.5rem,3.4vw,2.2rem); margin:0; }
.blog-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:22px; }
.blog-card { display:flex; flex-direction:column; background:var(--card); border:1px solid var(--border); border-radius:18px; overflow:hidden; box-shadow:var(--shadow-sm); transition:all var(--transition); }
.blog-card:hover { border-color:transparent; box-shadow:var(--shadow); transform:translateY(-4px); }
.blog-thumb { display:block; aspect-ratio:16/10; overflow:hidden; }
.blog-thumb img { width:100%; height:100%; object-fit:cover; transition:transform 0.45s; }
.blog-card:hover .blog-thumb img { transform:scale(1.06); }
.blog-body { padding:18px 18px 20px; display:flex; flex-direction:column; gap:10px; flex:1; }
.blog-card h4 { font-size:1rem; line-height:1.6; margin:0; }
.blog-card h4 a { color:var(--ink); }
.blog-card h4 a:hover { color:var(--brand); }
.blog-more { color:var(--brand); font-weight:700; font-size:0.82rem; margin-top:auto; display:inline-flex; align-items:center; gap:6px; }
.blog-more:hover { color:var(--brand-dark); }

/* ---------- Stats ---------- */
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:18px; text-align:center; }
.stat-item { padding:22px; background:var(--card); border:1px solid var(--border); border-radius:18px; box-shadow:var(--shadow-sm); }
.stat-item strong { font-size:clamp(1.6rem,4vw,2.1rem); color:var(--brand); display:block; line-height:1.2; }
.stat-item strong .nu { color:var(--ink); }
.stat-item span { color:var(--muted); font-size:0.9rem; }

/* ---------- Responsive (Mobile-first) ---------- */
@media (max-width: 1024px) {
  .feature-grid { grid-template-columns:repeat(2,1fr); }
  .business-grid { grid-template-columns:repeat(3,1fr); }
  .steps-grid { grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 760px) {
  /* Searching عمودی در موبایل */
  .search-bar { flex-direction:column; border-radius:24px; padding:12px; gap:8px; }
  .search-field { flex:1 1 auto; width:100%; padding:12px 14px; order:1; }
  .search-select { width:100%; border:1px solid var(--bg-soft); border-radius:14px; padding:12px; order:2; border-inline-start:1px solid var(--border); background:var(--bg-soft); }
  .search-submit { width:100%; justify-content:center; order:3; }
  .feature-grid { grid-template-columns:1fr 1fr; }
  /* کارت کسبوکار: افقی اسکرولدار */
  .business-grid.desktop-grid { display:none; }
  .business-hscroll { display:flex; gap:14px; overflow-x:auto; scroll-snap-type:x mandatory; padding-bottom:10px; -webkit-overflow-scrolling:touch; }
  .business-hscroll .business-card { flex:0 0 74%; scroll-snap-align:start; }
  .business-hscroll .business-card .thumb { aspect-ratio:4/3; }
  .steps-grid { grid-template-columns:1fr; }
  /* App Banner موبایل: همچنان جمعوجور و پخش در عرض */
  .app-banner { flex-direction:column; text-align:center; gap:16px; padding:26px 22px; }
  .app-banner .ab-text p { margin-inline:auto; max-width:90%; }
  /* دستهبندی موبایل: فقط ۷ دسته + «سایر» (#8) — موارد ۸ تا ۱۱ مخفی (بدون overflow) */
  #mainCategoryGrid > .cat-8,
  #mainCategoryGrid > .cat-9,
  #mainCategoryGrid > .cat-10,
  #mainCategoryGrid > .cat-11 { display:none; }
  .blog-head { flex-direction:column; align-items:flex-start; gap:10px; }
}
@media (max-width: 480px) {
  .feature-grid { grid-template-columns:1fr 1fr; }
  .category-grid { grid-template-columns:repeat(2,1fr); }
  .search-field input { font-size:0.9rem; }
}
