/* ═════════ سفرجا — جستجوی هوشمند، جستجوی سریع خمیده، بنر دستیار ═════════ */
:root {
  --ss-brown: #6b4423;
  --ss-brown-soft: #a0693a;
  --ss-tile: #fffaf3;
  --ss-tile-b: rgba(160, 105, 58, .14);
  --ss-card: #ffffff;
  --ss-blue: #2563eb;
}
[data-theme="dark"], .dark {
  --ss-brown: #f1c79a;
  --ss-brown-soft: #e8a855;
  --ss-tile: #222c3b;
  --ss-tile-b: rgba(232, 168, 85, .18);
  --ss-card: #1a2230;
}

/* ---------- نوار جستجوی هوشمند ---------- */
html body .smart-bar {
  position: relative; z-index: 3;
  display: flex; align-items: center; gap: 6px;
  margin: 18px auto 0; width: 100%; max-width: 620px;
  padding: 6px;
  background: rgba(255,255,255,.96);
  border-radius: 999px;
  box-shadow: 0 18px 40px -12px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.6);
  backdrop-filter: blur(10px);
}
.smart-bar__input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: 500 .9rem/1.4 var(--font); color: #1a1f2e; padding: 10px 6px;
}
.smart-bar__input::placeholder { color: #8a8f99; }
.smart-bar__go {
  flex: none; width: 50px; height: 50px; border: 0; border-radius: 50%; cursor: pointer;
  color: #fff; background: linear-gradient(135deg, #22c55e, #15803d);
  display: grid; place-items: center;
  box-shadow: 0 8px 18px -6px rgba(22,163,74,.7);
  transition: transform .2s;
}
.smart-bar__go:hover { transform: scale(1.06); }
.smart-bar__mic, .smart-bar__map {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; text-decoration: none;
  background: #eef4ff; color: var(--ss-blue);
  transition: background .2s, transform .2s;
}
.smart-bar__map { background: #f3f4f6; color: #374151; }
.smart-bar__mic:hover, .smart-bar__map:hover { transform: translateY(-1px); }
.smart-bar__mic.is-listening { background: #ef4444; color: #fff; animation: ssPulse 1.2s infinite; }
@keyframes ssPulse {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); }
  100% { box-shadow: 0 0 0 16px rgba(239,68,68,0); }
}

/* ---------- جستجوی سریع (کارت خمیده) ---------- */
.qs-wrap { position: relative; z-index: 2; margin: -46px 12px 0; }
.qs-card {
  position: relative;
  background: var(--ss-card);
  border-radius: 50% 50% 34px 34px / 46px 46px 34px 34px;  /* لبهٔ بالایی قوسی */
  padding: 40px 14px 20px;
  box-shadow: 0 -10px 30px -18px rgba(0,0,0,.25), 0 20px 40px -24px rgba(61,107,79,.35);
}
.qs-head { text-align: center; margin-bottom: 18px; }
.qs-title {
  margin: 0; font-size: 1.15rem; font-weight: 900; color: var(--text);
  display: inline-flex; align-items: center; gap: 8px;
}
.qs-title::after, .qs-title::before {
  content: ""; width: 26px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--ss-brown-soft));
}
.qs-title::after { transform: scaleX(-1); }
.qs-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; }
.qs-tile {
  appearance: none; border: 0; background: none; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  font-family: var(--font);
  animation: qsIn .5s both; animation-delay: calc(var(--i) * 45ms);
}
.qs-tile__ico {
  position: relative;
  width: 64px; height: 64px; display: grid; place-items: center;
  color: var(--ss-brown);
  background: var(--ss-tile);
  border: 1.5px solid var(--ss-tile-b);
  border-radius: 42% 58% 55% 45% / 50% 45% 55% 50%;  /* شکل نرم و خمیده */
  transition: transform .35s var(--transition, ease), border-radius .5s, background .3s, color .3s;
}
.qs-tile__ico svg { width: 34px; height: 34px; }
.qs-tile__lbl { font-size: .82rem; font-weight: 700; color: var(--text); }
.qs-tile:hover .qs-tile__ico, .qs-tile:focus-visible .qs-tile__ico {
  transform: translateY(-4px) rotate(-4deg);
  border-radius: 50%;
  background: linear-gradient(145deg, #c07f3a, #8b5a2b);
  color: #fff;
  box-shadow: 0 12px 22px -10px rgba(139,90,43,.7);
}
.qs-tile:active .qs-tile__ico { transform: scale(.94); }
@keyframes qsIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (min-width: 900px) {
  .qs-grid { grid-template-columns: repeat(8, 1fr); }
  .qs-tile__ico { width: 76px; height: 76px; }
  .qs-tile__ico svg { width: 40px; height: 40px; }
}

/* ---------- نتایج جستجوی هوشمند ---------- */
.smart-results { scroll-margin-top: 80px; }
.smart-results__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.smart-results__close {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--bg-card); color: var(--text); box-shadow: var(--shadow-sm);
}
.smart-results__chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.ss-chip {
  font-size: .75rem; font-weight: 700; padding: 5px 12px; border-radius: 99px;
  background: linear-gradient(135deg, rgba(37,99,235,.1), rgba(34,197,94,.12));
  color: var(--text); border: 1px solid rgba(37,99,235,.18);
}
.smart-results__list {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr);
  gap: 14px; overflow-x: auto; padding: 4px 2px 14px; scroll-snap-type: x mandatory;
}
.ss-card {
  scroll-snap-align: start; text-decoration: none; color: var(--text);
  background: var(--bg-card); border-radius: 24px; overflow: hidden;
  box-shadow: var(--shadow-md); transition: transform .25s;
}
.ss-card:hover { transform: translateY(-4px); }
.ss-card__img { position: relative; aspect-ratio: 16/10; background: #e5e7eb; }
.ss-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ss-card__ph { display: grid; place-items: center; height: 100%; font-size: 2.6rem; }
.ss-card__rate {
  position: absolute; top: 10px; left: 10px; font-size: .75rem; font-weight: 800;
  background: rgba(0,0,0,.55); color: #fde68a; padding: 3px 9px; border-radius: 99px;
}
.ss-card__body { padding: 12px 14px 14px; }
.ss-card__title { font-weight: 800; font-size: .92rem; margin-bottom: 5px; }
.ss-card__loc { font-size: .76rem; color: var(--text-muted); margin-bottom: 8px; }
.ss-card__price { font-size: .8rem; color: var(--text-muted); }
.ss-card__price b { color: #16a34a; font-size: .92rem; }
.ss-empty { padding: 18px; color: var(--text-muted); }
.ss-skel {
  height: 230px; border-radius: 24px;
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(127,127,127,.12) 50%, var(--bg-card) 75%);
  background-size: 200% 100%; animation: ssShimmer 1.2s infinite;
}
@keyframes ssShimmer { to { background-position: -200% 0; } }

/* ---------- بنر دستیار هوشمند ---------- */
.ai-banner {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 130px 1fr; grid-template-areas: "bot bubble" "list list";
  gap: 10px 12px; align-items: center;
  padding: 18px 16px;
  border-radius: 30px;
  background:
    radial-gradient(120% 90% at 0% 100%, rgba(134,239,172,.55), transparent 60%),
    radial-gradient(90% 80% at 100% 0%, rgba(147,197,253,.75), transparent 60%),
    linear-gradient(160deg, #e0f2fe, #eef6ff 55%, #ecfdf5);
  box-shadow: 0 20px 40px -24px rgba(37,99,235,.45);
}
.dark .ai-banner, [data-theme="dark"] .ai-banner {
  background:
    radial-gradient(120% 90% at 0% 100%, rgba(34,197,94,.22), transparent 60%),
    radial-gradient(90% 80% at 100% 0%, rgba(37,99,235,.35), transparent 60%),
    linear-gradient(160deg, #13203a, #172338);
}
.ai-banner::before { /* تپه‌های خمیده در پس‌زمینه */
  content: ""; position: absolute; inset: auto -10% -40px -10%; height: 90px;
  background: rgba(34,197,94,.14); border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.ai-banner__bot { grid-area: bot; position: relative; }
.ai-robot { width: 100%; height: auto; display: block; animation: aiFloat 4s ease-in-out infinite; }
.ai-robot__arm { transform-origin: 144px 150px; animation: aiWave 2.4s ease-in-out infinite; }
.ai-robot__led { animation: aiBlink 1.6s infinite; }
@keyframes aiFloat { 50% { transform: translateY(-6px); } }
@keyframes aiWave { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-14deg); } 85% { transform: rotate(8deg); } }
@keyframes aiBlink { 50% { opacity: .35; } }

.ai-banner__bubble {
  grid-area: bubble; position: relative;
  background: var(--bg-card); color: var(--text);
  border-radius: 24px; padding: 14px 16px;
  box-shadow: 0 10px 24px -14px rgba(15,23,42,.35);
}
.ai-banner__bubble::before { /* دُم حباب گفتگو به سمت ربات */
  content: ""; position: absolute; left: -9px; top: 26px;
  border: 10px solid transparent; border-right-color: var(--bg-card); border-left: 0;
}
.ai-banner__hi { font-weight: 900; font-size: .98rem; color: #1e3a8a; }
.dark .ai-banner__hi, [data-theme="dark"] .ai-banner__hi { color: #93c5fd; }
.ai-banner__txt { margin: 6px 0 12px; font-size: .8rem; line-height: 1.9; color: var(--text-muted); }
.ai-banner__btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-btn {
  border: 0; cursor: pointer; font: 800 .8rem var(--font); padding: 10px 16px; border-radius: 99px;
  transition: transform .2s, box-shadow .2s;
}
.ai-btn:hover { transform: translateY(-2px); }
.ai-btn--chat { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; box-shadow: 0 10px 20px -10px rgba(37,99,235,.8); }
.ai-btn--voice { background: #ecfdf5; color: #15803d; border: 1px solid rgba(21,128,61,.25); }
.ai-banner__list {
  grid-area: list; position: relative; list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center;
}
.ai-banner__list li {
  display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--text);
}
.ai-banner__list li::before {
  content: "✓"; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: #22c55e; color: #fff; font-size: .7rem;
}
@media (min-width: 900px) {
  .ai-banner { grid-template-columns: 180px 1fr 200px; grid-template-areas: "bot bubble list"; padding: 22px 28px; }
  .ai-banner__list { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .ai-robot, .ai-robot__arm, .ai-robot__led, .qs-tile { animation: none; }
}

/* ═════════ پنجرهٔ گفتگو با دستیار ═════════ */
html.ai-chat-lock, html.ai-chat-lock body { overflow: hidden; }
.ai-chat { position: fixed; inset: 0; z-index: 10050; pointer-events: none; }
.ai-chat__backdrop {
  position: absolute; inset: 0; background: rgba(10,18,32,.45); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .3s;
}
.ai-chat__panel {
  position: absolute; left: 50%; bottom: 0; width: min(560px, 100%); height: min(640px, 88dvh);
  transform: translate(-50%, 105%); transition: transform .38s cubic-bezier(.22,1,.36,1);
  display: flex; flex-direction: column;
  background: var(--bg, #f5f3ef); color: var(--text);
  border-radius: 30px 30px 0 0; overflow: hidden;
  box-shadow: 0 -20px 60px -20px rgba(0,0,0,.45);
  font-family: var(--font);
}
.ai-chat.is-open { pointer-events: auto; }
.ai-chat.is-open .ai-chat__backdrop { opacity: 1; }
.ai-chat.is-open .ai-chat__panel { transform: translate(-50%, 0); }
@media (min-width: 700px) {
  .ai-chat__panel { bottom: 24px; border-radius: 30px; }
}
.ai-chat__head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: linear-gradient(135deg, #2563eb, #1e40af); color: #fff;
}
.ai-chat__avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.18); font-size: 1.4rem;
}
.ai-chat__who { flex: 1; display: flex; flex-direction: column; line-height: 1.5; }
.ai-chat__who b { font-size: .95rem; }
.ai-chat__who span { font-size: .72rem; opacity: .85; }
.ai-chat__x {
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.18); color: #fff; font-size: 1rem;
  transition: background .2s, transform .2s;
}
.ai-chat__x:hover { background: rgba(255,255,255,.3); transform: rotate(90deg); }
.ai-chat__body { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg {
  max-width: 88%; padding: 10px 14px; font-size: .85rem; line-height: 1.9;
  border-radius: 20px; animation: qsIn .25s both;
}
.ai-msg--bot { align-self: flex-start; background: var(--bg-card); border-bottom-right-radius: 6px; box-shadow: var(--shadow-sm); }
.ai-msg--me  { align-self: flex-end; background: linear-gradient(135deg, #22c55e, #15803d); color: #fff; border-bottom-left-radius: 6px; }
.ai-msg__chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 8px; }
.ai-msg__chips span { font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: rgba(37,99,235,.1); }
.ai-msg__cards {
  display: grid; grid-auto-flow: column; grid-auto-columns: 200px; gap: 10px;
  overflow-x: auto; margin: 8px -6px 0; padding: 2px 6px 8px;
}
.ai-msg__cards .ss-card { box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.ai-msg__cards .ss-card__body { padding: 8px 10px 10px; }
.ai-typing { display: inline-flex; gap: 4px; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: aiDot 1s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; } .ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes aiDot { 50% { transform: translateY(-4px); opacity: .5; } }
.ai-chat__quick { display: flex; gap: 6px; overflow-x: auto; padding: 0 14px 8px; }
.ai-chat__quick button {
  flex: none; border: 1px solid rgba(37,99,235,.25); background: var(--bg-card); color: var(--text);
  font: 700 .74rem var(--font); padding: 7px 12px; border-radius: 99px; cursor: pointer;
}
.ai-chat__form {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg-card); border-top: 1px solid var(--border);
}
.ai-chat__form input {
  flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 99px; outline: 0;
  padding: 11px 16px; font: 500 .85rem var(--font); background: var(--bg); color: var(--text);
}
.ai-chat__form input:focus { border-color: #2563eb; }
.ai-chat__mic, .ai-chat__send {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
}
.ai-chat__mic { background: #eef4ff; color: #2563eb; }
.ai-chat__mic.is-listening { background: #ef4444; color: #fff; animation: ssPulse 1.2s infinite; }
.ai-chat__send { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; }
.ai-chat__send svg { transform: scaleX(-1); }

.ss-toast {
  position: fixed; left: 50%; bottom: 96px; z-index: 10060; transform: translate(-50%, 20px);
  max-width: min(440px, calc(100% - 32px)); padding: 12px 18px; border-radius: 18px;
  background: #1f2937; color: #fff; font: 600 .82rem/1.8 var(--font); text-align: center;
  box-shadow: 0 16px 34px -14px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.ss-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.ss-toast { white-space: pre-line; }
.smart-bar__input.is-dictating, .ai-chat__form input.is-dictating { box-shadow: 0 0 0 3px rgba(239,68,68,.35); border-radius: 99px; }

/* ═══════════ کاشی‌های جستجو سریع — آیکون دوتُن با رنگ اختصاصی هر دسته ═══════════ */
.qs-tile__ico {
  color: var(--tone, #2f7a55);
  background: var(--ss-tile);
  background: color-mix(in srgb, var(--tone, #2f7a55) 11%, var(--bg-card, #fff));
  border-color: color-mix(in srgb, var(--tone, #2f7a55) 22%, transparent);
  border-radius: 22px;
}
.qs-tile__ico::after {
  content: ""; position: absolute; top: 8px; left: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--tone, #2f7a55); opacity: .35;
  transition: transform .4s ease, opacity .3s ease;
}
.qs-tile__ico .sj-ic { width: 36px; height: 36px; }
.qs-tile__ico .ic-d { opacity: .2; }
.qs-tile:hover .qs-tile__ico, .qs-tile:focus-visible .qs-tile__ico {
  transform: translateY(-4px);
  border-radius: 26px;
  color: #fff;
  background: linear-gradient(150deg, color-mix(in srgb, var(--tone, #2f7a55) 78%, #fff), var(--tone, #2f7a55));
  box-shadow: 0 14px 24px -12px var(--tone, #2f7a55);
}
.qs-tile:hover .qs-tile__ico .ic-d, .qs-tile:focus-visible .qs-tile__ico .ic-d { opacity: .3; }
.qs-tile:hover .qs-tile__ico::after { background: #fff; opacity: .7; transform: scale(1.3); }
[data-theme="dark"] .qs-tile__ico { background: color-mix(in srgb, var(--tone, #2f7a55) 22%, #141b18); color: color-mix(in srgb, var(--tone, #2f7a55) 55%, #fff); }
@media (min-width: 900px) { .qs-tile__ico .sj-ic { width: 42px; height: 42px; } }
