/* b2c-web — styles.css (تم تیره، هماهنگ با لوگوی Ai Noor)
   کاملاً self-contained: فونت وزیرمتن لوکال، بدون هیچ CDN خارجی. */

@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #0e0e10;
  --panel: #151518;
  --panel-2: #1c1c22;
  --ink: #f0f2f8;
  --muted: #9aa0b4;
  --brand: #4a90e2;
  --brand-deep: #2f6fd0;
  --brand-soft: rgba(74, 144, 226, 0.13);
  --brand-glow: rgba(74, 144, 226, 0.35);
  --user-bubble: linear-gradient(135deg, #2b6fd6, #4aa3e8);
  --bot-bubble: #1e1e26;
  --border: #26262e;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c2c35; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a45; }

.app { display: flex; height: 100dvh; }

/* ---------- سایدبار ---------- */
.sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 16px;
  gap: 12px;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 10px; }
.brand-text h1 { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.brand-text p { font-size: 0.75rem; color: var(--muted); }

.btn-new {
  font-family: inherit;
  background: linear-gradient(135deg, var(--brand-deep), var(--brand));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 11px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 14px var(--brand-glow);
}
.btn-new:hover { filter: brightness(1.1); }

.side-label { font-size: 0.72rem; color: var(--muted); font-weight: 700; margin-top: 4px; }

.model-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: inherit;
  border: 1.5px solid var(--border);
  background: var(--panel-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--brand); }
.chip.active { background: var(--brand-soft); border-color: var(--brand); color: #8fbdf5; font-weight: 700; }
.chip.locked { opacity: 0.7; border-style: dashed; }

.notice {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #23232c;
  color: var(--ink);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  padding: 11px 20px;
  border-radius: 12px;
  opacity: 0;
  transition: all 0.25s;
  pointer-events: none;
  z-index: 50;
  max-width: 90vw;
  text-align: center;
}
.notice.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.conv-item {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  text-align: right;
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.conv-item:hover { background: #1b1b22; }
.conv-item.active { background: var(--brand-soft); border-color: rgba(74, 144, 226, 0.4); font-weight: 700; }
.conv-item .del { color: var(--muted); border: none; background: none; cursor: pointer; font-size: 0.9rem; }
.conv-item .del:hover { color: #f87171; }

.demo-badge {
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}

/* ---------- ناحیه چت ---------- */
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.chat-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.menu-btn { display: none; border: none; background: none; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
.chat-title { display: flex; flex-direction: column; }
.chat-title span { font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.chat-title small { color: var(--muted); font-size: 0.75rem; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; margin-inline-start: auto; box-shadow: 0 0 8px rgba(34, 197, 94, 0.7); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(74, 144, 226, 0.05), transparent);
}

.empty-state { margin: auto; text-align: center; color: var(--muted); max-width: 380px; }
.empty-logo { width: 96px; border-radius: 20px; margin-bottom: 12px; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5); }
.empty-state h2 { color: var(--ink); font-size: 1.1rem; margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; line-height: 1.9; }

.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg .bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user { align-self: flex-end; }          /* در RTL: سمت چپ */
.msg.user .bubble { background: var(--user-bubble); color: #fff; border-bottom-left-radius: 4px; box-shadow: 0 2px 12px rgba(43, 111, 214, 0.35); }
.msg.bot { align-self: flex-start; }        /* در RTL: سمت راست */
.msg.bot .bubble { background: var(--bot-bubble); color: var(--ink); border: 1px solid var(--border); border-bottom-right-radius: 4px; }
.msg .meta { font-size: 0.68rem; color: var(--muted); margin-top: 4px; }

.typing { display: inline-flex; gap: 5px; padding: 14px 18px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

/* ---------- کامپوزر ---------- */
.composer {
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 12px 18px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.composer textarea {
  flex: 1;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  resize: none;
  max-height: 140px;
  outline: none;
  background: var(--panel-2);
  line-height: 1.9;
}
.composer textarea::placeholder { color: var(--muted); }
.composer textarea:focus { border-color: var(--brand); background: #202028; box-shadow: 0 0 0 3px var(--brand-soft); }
.btn-send {
  font-family: inherit;
  width: 48px; height: 48px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-deep), var(--brand));
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  transform: scaleX(-1); /* جهت درست در RTL */
  transition: filter 0.15s, opacity 0.15s;
  box-shadow: 0 2px 14px var(--brand-glow);
}
.btn-send:hover { filter: brightness(1.12); }
.btn-send:disabled { opacity: 0.45; cursor: default; box-shadow: none; }

.hint { text-align: center; font-size: 0.68rem; color: var(--muted); padding: 6px; background: var(--panel); }

/* ---------- موبایل ---------- */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    inset-inline-start: 0; top: 0; bottom: 0;
    transform: translateX(100%); /* سایدبار در RTL سمت راست است؛ می‌رود بیرون کادر */
    transition: transform 0.25s;
    box-shadow: -8px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: block; }
  .msg { max-width: 88%; }
}

/* ===== دکمه و مودال نصب اپلیکیشن ===== */
.btn-install {
  font-family: inherit;
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-top: 8px;
}
.btn-install:hover { border-color: var(--brand); background: rgba(59,130,246,0.08); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 420px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px 24px;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
}
.modal-close:hover { color: var(--ink); }
.modal-icon { width: 76px; height: 76px; border-radius: 18px; margin-bottom: 8px; }
.modal h3 { margin: 4px 0 6px; font-size: 1.1rem; }
.modal .muted { color: var(--muted); font-size: 0.85rem; margin: 0 0 16px; }
.install-steps { text-align: right; }
.install-steps h4 { margin: 14px 0 6px; font-size: 0.95rem; }
.install-steps ol { margin: 0 0 8px; padding-right: 20px; font-size: 0.87rem; line-height: 1.9; color: var(--ink); }
.install-steps li::marker { color: var(--brand); font-weight: 700; }
.ios-share {
  display: inline-block;
  border: 1.5px solid var(--brand);
  border-radius: 6px;
  padding: 0 7px;
  font-size: 0.8rem;
  color: var(--brand);
}

/* ===== بنر خودکار نصب iOS ===== */
.ios-banner {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  right: 12px;
  left: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  z-index: 900;
  box-shadow: 0 10px 34px rgba(0,0,0,0.55);
  animation: iosBannerUp 0.35s ease-out;
}
.ios-banner[hidden] { display: none; }
@keyframes iosBannerUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.ios-banner-icon { width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0; }
.ios-banner-text { flex: 1; min-width: 0; text-align: right; }
.ios-banner-text b { display: block; font-size: 0.88rem; }
.ios-banner-text span { font-size: 0.75rem; color: var(--muted); line-height: 1.7; }
.ios-banner-btn {
  font-family: inherit;
  background: linear-gradient(135deg, var(--brand-deep), var(--brand));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.ios-banner-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}
