/* ===== آوا VOD — کامپوننت‌های تماشا/چت/پیشنهاد (مکمل app.css) ===== */

/* فاصلهٔ پایین برای بات‌نوِ موبایل */
:root { --botnav-h: 64px; }
.has-botnav { padding-bottom: calc(var(--botnav-h) + env(safe-area-inset-bottom, 0px) + 8px); }

/* ---------- Prompt / recommend hero ---------- */
.ask { position: relative; background: var(--grad-hero); color: #eaffff; overflow: hidden; }
.ask::after { content: ""; position: absolute; inset: 0; background: radial-gradient(680px 320px at 15% 120%, rgba(16,185,129,.22), transparent 70%); pointer-events: none; }
.ask .container { position: relative; z-index: 2; padding-top: clamp(30px, 6vw, 60px); padding-bottom: clamp(30px, 6vw, 58px); }
.ask h1 { color: #fff; font-size: clamp(1.5rem, 1.1rem + 2.4vw, 2.5rem); font-weight: 800; letter-spacing: -.01em; margin-bottom: .3em; }
.ask .lead { color: #cdeef5; font-size: clamp(1rem, .92rem + .4vw, 1.18rem); max-width: 560px; margin-bottom: 22px; }

.askbox { display: flex; gap: 8px; background: var(--surface); border-radius: 999px; padding: 7px 7px 7px 18px;
  box-shadow: var(--shadow-lg); max-width: 620px; border: 1px solid var(--border-2); }
.askbox input { border: none; background: transparent; box-shadow: none !important; padding: 8px 4px; min-height: 40px; font-size: 1rem; }
.askbox input:focus { outline: none; }
.askbox .btn { flex: none; padding-inline: 20px; }
.ask-hints { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.24); color: #eafcff; border-radius: 999px;
  padding: 7px 14px; font-size: .84rem; font-weight: 600; cursor: pointer; transition: background .15s, transform .12s; }
.chip:hover { background: rgba(255,255,255,.22); }
.chip:active { transform: scale(.97); }

/* پاسخِ پیشنهاد */
.rec-result { margin-top: 18px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border-2);
  border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); display: none; animation: slideup .3s ease; }
.rec-result.show { display: block; }
.rec-result .rec-why { color: var(--muted); font-size: .92rem; margin: 4px 0 12px; }
.rec-result .rec-why b { color: var(--primary-600); }

/* ---------- video grid ---------- */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
@media (max-width: 560px){ .vgrid { grid-template-columns: 1fr 1fr; gap: 12px; } }

.vcard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); text-align: start;
  transition: box-shadow .25s, transform .2s, border-color .25s; cursor: pointer; color: inherit; }
.vcard:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); border-color: var(--border-2); }
.vcard:active { transform: translateY(-1px) scale(.995); }
.vcard[aria-disabled="true"] { cursor: default; }
.vcard[aria-disabled="true"]:hover { transform: none; box-shadow: var(--shadow-sm); }

.vthumb { position: relative; aspect-ratio: 16/9; background: var(--grad-accent); overflow: hidden; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vthumb .vfallback { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.9); }
.vthumb .vfallback svg { width: 46px; height: 46px; opacity: .85; }
.vthumb::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(3,26,33,.55)); }
.play-fab { position: absolute; inset-block-end: 10px; inset-inline-end: 10px; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--primary-700); display: grid; place-items: center; box-shadow: var(--shadow);
  transition: transform .18s, background .18s; }
.vcard:hover .play-fab { transform: scale(1.08); background: #fff; }
.vthumb .v-dur { position: absolute; inset-block-end: 10px; inset-inline-start: 10px; background: rgba(3,26,33,.72); color: #fff;
  font-size: .74rem; font-weight: 600; padding: 3px 8px; border-radius: 7px; font-variant-numeric: tabular-nums; }
.vthumb .v-tag { position: absolute; inset-block-start: 10px; inset-inline-start: 10px; }

.vbody { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.vbody h3 { font-size: 1rem; margin: 0; line-height: 1.45; }
.vbody p { color: var(--muted); font-size: .85rem; margin: 0; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vmeta { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; color: var(--faint); font-size: .78rem; }

/* ---------- watch layout ---------- */
.watch-wrap { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (min-width: 1000px){ .watch-wrap { grid-template-columns: minmax(0,1.6fr) minmax(320px, 1fr); align-items: start; } }

.player { position: relative; background: #041016; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.player video { width: 100%; display: block; aspect-ratio: 16/9; background: #041016; object-fit: contain; }
.watch-title { font-size: clamp(1.2rem, 1rem + 1vw, 1.7rem); margin: 16px 0 4px; }
.watch-sub { color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: .88rem; }

/* متنِ توضیحاتِ مشترک */
.explainer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: clamp(18px,3vw,28px); box-shadow: var(--shadow-sm); }
.explainer h2 { font-size: 1.25rem; }
.explainer h3 { font-size: 1.05rem; margin-top: 1.4em; color: var(--primary-700); }
[data-theme="dark"] .explainer h3 { color: var(--secondary); }
.explainer p, .explainer li { color: var(--fg); font-size: .96rem; line-height: 1.85; }
.explainer ul { padding-inline-start: 1.1em; margin: .4em 0 1em; display: grid; gap: 8px; }
.explainer li::marker { color: var(--accent); }
.explainer .note { background: var(--bg-2); border: 1px solid var(--border-2); border-inline-start: 4px solid var(--primary);
  border-radius: var(--r); padding: 14px 16px; color: var(--muted); font-size: .9rem; margin-top: 14px; }

/* suggested rail */
.rail { display: flex; gap: 14px; overflow-x: auto; padding-block: 4px 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.rail::-webkit-scrollbar { height: 6px; }
.rail::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; }
.rail .vcard { flex: 0 0 220px; scroll-snap-align: start; }

/* ---------- chatbot ---------- */
.chat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
@media (min-width: 1000px){ .chat.sticky { position: sticky; top: 86px; max-height: calc(100dvh - 108px); } }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.chat-head .avatar { width: 38px; height: 38px; border-radius: 12px; background: var(--grad-accent); color: #fff; display: grid; place-items: center; flex: none; }
.chat-head .ct { font-weight: 700; font-size: .98rem; }
.chat-head .cs { font-size: .76rem; color: var(--muted); }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 260px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: .93rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.msg.bot { align-self: flex-start; background: var(--bg-2); color: var(--fg); border-bottom-inline-start-radius: 5px; }
.msg.me { align-self: flex-end; background: var(--grad-accent); color: #fff; border-bottom-inline-end-radius: 5px; }
[data-theme="dark"] .msg.me { color: #04222b; }
.msg .refs { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.msg .refchip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border-2);
  color: var(--primary-700); border-radius: 10px; padding: 6px 10px; font-size: .8rem; font-weight: 600; text-align: start; }
.typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 16px; background: var(--bg-2); border-radius: 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: bounce 1.1s infinite; }
.typing i:nth-child(2){ animation-delay: .15s; } .typing i:nth-child(3){ animation-delay: .3s; }
@keyframes bounce { 0%,80%,100%{ transform: translateY(0); opacity:.5;} 40%{ transform: translateY(-5px); opacity:1;} }
.chat-foot { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; background: var(--surface); }
.chat-foot input { border-radius: 999px; }
.chat-foot .btn { flex: none; width: 46px; padding: 0; }
.chat-disc { font-size: .72rem; color: var(--faint); text-align: center; padding: 0 12px 10px; }

/* ---------- bottom nav (mobile) ---------- */
.botnav { position: fixed; inset-inline: 0; bottom: 0; z-index: 90; display: none;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 0px); }
.botnav .inner { display: grid; grid-template-columns: repeat(4, 1fr); height: var(--botnav-h); max-width: 560px; margin-inline: auto; }
.botnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted);
  font-size: .7rem; font-weight: 600; text-decoration: none; position: relative; }
.botnav a svg { width: 23px; height: 23px; }
.botnav a[aria-current="page"] { color: var(--primary-600); }
.botnav a[aria-current="page"]::before { content:""; position:absolute; top:6px; width:30px; height:3px; border-radius:999px; background: var(--accent); }
@media (max-width: 860px){ .botnav { display: block; } }

/* ---------- modal (login / checkout) ---------- */
.modal-scrim { position: fixed; inset: 0; z-index: 500; background: rgba(3,20,26,.55); backdrop-filter: blur(3px);
  display: none; align-items: flex-end; justify-content: center; padding: 0; }
@media (min-width: 640px){ .modal-scrim { align-items: center; padding: 20px; } }
.modal-scrim.show { display: flex; animation: fade .2s ease; }
.modal { background: var(--surface); width: 100%; max-width: 440px; border-radius: 22px 22px 0 0; padding: 24px 22px 28px;
  box-shadow: var(--shadow-lg); animation: sheetup .28s cubic-bezier(.2,.7,.3,1); max-height: 92dvh; overflow-y: auto; }
@media (min-width: 640px){ .modal { border-radius: 22px; animation: pop .22s ease; } }
.modal .m-close { float: inline-end; }
.modal h2 { font-size: 1.3rem; margin-bottom: .2em; }
.modal .m-sub { color: var(--muted); font-size: .92rem; margin-bottom: 18px; }
.otp-code { font-variant-numeric: tabular-nums; letter-spacing: .3em; font-size: 1.9rem; font-weight: 800; text-align: center;
  color: var(--primary-700); background: var(--bg-2); border: 1px dashed var(--primary); border-radius: var(--r); padding: 14px; margin: 6px 0 14px; }
[data-theme="dark"] .otp-code { color: var(--secondary); }
@keyframes fade { from{opacity:0} to{opacity:1} }
@keyframes sheetup { from{ transform: translateY(100%); } to{ transform: none; } }
@keyframes pop { from{ transform: scale(.96); opacity:0; } to{ transform: none; opacity:1; } }

/* ---------- subscription / quota ---------- */
.quota-bar { height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.quota-bar i { display: block; height: 100%; background: var(--grad-accent); border-radius: 999px; transition: width .5s; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; }
.plan { border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 22px; background: var(--surface); position: relative; }
.plan.featured { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.plan .p-price { font-size: 1.9rem; font-weight: 800; color: var(--fg-strong); }
.plan .p-price small { font-size: .82rem; font-weight: 500; color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 9px; }
.plan li { display: flex; gap: 8px; font-size: .9rem; color: var(--fg); }
.plan li svg { color: var(--accent); flex: none; }

/* ---------- چتِ موبایل: FAB + bottom-sheet (به‌سبکِ ۷صبح) ---------- */
.chat-grab { display: none; width: 38px; height: 4px; border-radius: 3px; background: var(--border-2); margin: 8px auto 0; flex: none; }
.chat-close { display: none; margin-inline-start: auto; }
.chat-fab { display: none; position: fixed; inset-inline-start: 16px; z-index: 80;
  bottom: calc(var(--botnav-h) + env(safe-area-inset-bottom, 0px) + 14px);
  height: 50px; padding: 0 18px; border: none; border-radius: 26px; background: var(--grad-accent); color: #fff;
  align-items: center; gap: 9px; font-family: inherit; font-weight: 700; font-size: .92rem; box-shadow: var(--shadow-lg); cursor: pointer; }
[data-theme="dark"] .chat-fab { color: #04222b; }
.chat-fab svg { width: 20px; height: 20px; }
.chat-fab .pulse { position: absolute; inset: 0; border-radius: 26px; box-shadow: 0 0 0 0 var(--ring); animation: fabpulse 2.6s infinite; }
@keyframes fabpulse { 0% { box-shadow: 0 0 0 0 var(--ring); } 70% { box-shadow: 0 0 0 13px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.chat-scrim { position: fixed; inset: 0; background: rgba(3,20,33,.5); backdrop-filter: blur(2px); z-index: 95; opacity: 0; pointer-events: none; transition: opacity .25s; }
.chat-scrim.on { opacity: 1; pointer-events: auto; }

@media (max-width: 999px) {
  .chat-fab { display: inline-flex; }
  aside.chat-host { position: fixed; inset-inline: 0; bottom: 0; z-index: 96;
    transform: translateY(101%); transition: transform .32s cubic-bezier(.32,.72,0,1); will-change: transform; }
  aside.chat-host.open { transform: translateY(0); }
  aside.chat-host .chat { border-radius: 22px 22px 0 0; max-height: 86dvh; box-shadow: var(--shadow-lg); border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px); }
  aside.chat-host .chat-grab { display: block; }
  aside.chat-host .chat-close { display: grid; }
  aside.chat-host .chat-body { min-height: 42dvh; }
}

/* section header helper */
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.sec-head h2 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.9rem); margin: 0; }
.sec-head p { margin: 4px 0 0; }
