/* ============================================================
   PERSONAL ASSISTANT — style.css
   تم مونوکروم (سیاه/سفید/خاکستری) — بدون هیچ رنگ آبی
   ============================================================ */

/* ============================================
   VARIABLES
   ============================================ */
:root {
  --bg: #f5f5f5;
  --bg-elevated: #ffffff;
  --text: #0a0a0a;
  --text-soft: #666666;
  --text-muted: #999999;
  --card: #ffffff;
  --card-elevated: #fafafa;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 48px rgba(0,0,0,0.16);
  --overlay: rgba(0,0,0,0.45);
  --input-bg: #eeeeee;
  --danger: #d4183d;
  --success: #0a8a3a;
  --warning: #b86b00;

  /* حالت‌های خنثی */
  --hover: rgba(0,0,0,0.05);
  --hover-strong: rgba(0,0,0,0.09);
  --focus-ring: rgba(0,0,0,0.08);
  --track-bg: rgba(0,0,0,0.08);

  /* دکمه/اکشن اصلی */
  --action-bg: #0a0a0a;
  --action-text: #ffffff;
}

html.dark {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --text: #f5f5f5;
  --text-soft: #888888;
  --text-muted: #555555;
  --card: #141414;
  --card-elevated: #1a1a1a;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.6);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.7);
  --shadow-xl: 0 20px 48px rgba(0,0,0,0.8);
  --overlay: rgba(0,0,0,0.75);
  --input-bg: #1f1f1f;

  --hover: rgba(255,255,255,0.06);
  --hover-strong: rgba(255,255,255,0.1);
  --focus-ring: rgba(255,255,255,0.08);
  --track-bg: rgba(255,255,255,0.12);

  --action-bg: #f5f5f5;
  --action-text: #0a0a0a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[lang="fa"] body,
html[lang="ar"] body { font-family: 'Vazirmatn', 'Noto Sans Arabic', Tahoma, sans-serif; }
html[lang="zh"] body { font-family: 'Noto Sans SC', sans-serif; }
html[lang="ja"] body { font-family: 'Noto Sans JP', sans-serif; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
input, textarea { font-family: inherit; }

/* ============================================
   ICONS — مینیمال (1.5)
   ============================================ */
button svg,
.icon-btn svg,
.menu-item svg,
.settings-card-icon svg,
.context-menu-item svg,
.choice-btn svg,
.drawer svg,
.chat-bubble svg,
.code-block svg,
.premium-icon svg,
.user-badge svg,
.empty-icon svg,
.back-btn svg,
.close-btn svg,
.auth-back-btn svg,
.password-toggle svg,
.chat-handle-icon svg,
.chat-header-title svg,
.chat-attach-btn svg,
.chat-send-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.icon-btn svg [fill]:not([fill="none"]),
.user-badge svg [fill]:not([fill="none"]) {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  overflow-y: auto;
  animation: screenFadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.screen.active { display: flex; }

@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   WELCOME
   ============================================ */
.welcome-screen { align-items: center; justify-content: center; padding: 24px; }
.welcome-container {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 30px 0;
  animation: fadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.welcome-logo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--action-bg);
  color: var(--action-text);
  animation: pulse 3s ease-in-out infinite;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.welcome-logo svg {
  width: 52px;
  height: 52px;
  stroke-width: 1.5;
  stroke: var(--action-text);
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.welcome-title { font-size: 28px; font-weight: 800; text-align: center; }
.welcome-subtitle { font-size: 15px; color: var(--text-soft); text-align: center; margin-top: -10px; }
.welcome-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.welcome-footer { font-size: 12px; color: var(--text-soft); text-align: center; margin-top: 10px; line-height: 1.5; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.15s ease;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--action-bg);
  color: var(--action-text);
  border: 1.5px solid var(--action-bg);
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border-strong);
}
.btn-secondary:active { background: var(--hover); }
.btn-full { width: 100%; }

.link-btn {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s ease;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
}
.link-btn:hover { background: var(--hover); }

/* ============================================
   AUTH
   ============================================ */
.auth-screen { align-items: center; padding: 24px; }
.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 30px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.auth-back-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  transition: transform 0.15s ease, background 0.15s ease;
}
.auth-back-btn:hover { background: var(--hover); }
.auth-back-btn:active { transform: scale(0.92); }
.auth-back-btn svg { width: 20px; height: 20px; stroke: var(--text); }
html[dir="rtl"] .auth-back-btn svg { transform: rotate(180deg); }

.auth-header { display: flex; flex-direction: column; gap: 6px; }
.auth-title { font-size: 26px; font-weight: 800; }
.auth-subtitle { font-size: 14px; color: var(--text-soft); }

.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.auth-input-group { display: flex; flex-direction: column; gap: 8px; }
.auth-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.3px;
}
.auth-input-wrap { position: relative; width: 100%; }
.auth-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  background: var(--input-bg);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
}
.auth-input:focus {
  border-color: var(--border-strong);
  background: var(--card);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input-wrap .auth-input { padding-right: 50px; }
html[dir="rtl"] .auth-input-wrap .auth-input { padding-right: 18px; padding-left: 50px; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background 0.15s ease;
}
.password-toggle:hover { background: var(--hover); }
html[dir="rtl"] .password-toggle { right: auto; left: 8px; }
.password-toggle svg { width: 18px; height: 18px; stroke: var(--text-soft); }
.password-toggle.showing svg { stroke: var(--text); }

.auth-options { display: flex; align-items: center; justify-content: space-between; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.checkbox-custom {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
}
.checkbox-custom::after {
  content: '';
  width: 5px;
  height: 10px;
  border: solid var(--action-text);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) scale(0);
  position: absolute;
  top: 1px;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.checkbox-label input:checked + .checkbox-custom {
  background: var(--action-bg);
  border-color: var(--action-bg);
}
.checkbox-label input:checked + .checkbox-custom::after {
  transform: rotate(45deg) scale(1);
}

.auth-error {
  display: none;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(212,24,61,0.08);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}
.auth-error.show { display: block; }

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-soft);
  margin-top: 8px;
}

.password-strength {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.password-strength.show { display: flex; }
.strength-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--track-bg);
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--text);
  transition: width 0.3s ease;
}
.strength-fill.weak { width: 33%; }
.strength-fill.medium { width: 66%; }
.strength-fill.strong { width: 100%; }
.strength-text { font-size: 11px; color: var(--text-soft); }

/* ============================================
   APP
   ============================================ */
.app { width: 100%; height: 100%; position: relative; display: none; }
.app.active { display: block; }

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 20px; height: 20px; stroke: var(--text); }

/* ============================================
   LIMIT BADGE — خنثی
   ============================================ */
.limit-badge {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 100px;
  background: transparent;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--border-strong);
  transition: all 0.25s ease;
  min-width: 46px;
}
.limit-badge.limit-low {
  color: var(--warning);
  border-color: var(--warning);
}
.limit-badge.limit-empty {
  color: var(--danger);
  border-color: var(--danger);
}

/* ============================================
   LANGUAGE PANEL — خنثی
   ============================================ */
.lang-panel {
  position: fixed;
  top: 75px;
  right: 18px;
  width: 230px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 400;
  display: none;
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
  transition: opacity 0.2s cubic-bezier(0.32, 0.72, 0, 1), transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  border: 1px solid var(--border);
}
html[dir="rtl"] .lang-panel { right: auto; left: 18px; }
.lang-panel.show { display: block; opacity: 1; transform: translateY(0) scale(1); }
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  width: 100%;
  text-align: left;
  font-size: 14px;
  transition: background 0.15s ease;
  font-family: inherit;
  color: var(--text);
}
html[dir="rtl"] .lang-option { text-align: right; }
.lang-option:hover { background: var(--hover); }
.lang-option.selected { background: var(--hover-strong); font-weight: 600; }
.lang-option .flag { font-size: 18px; }
.lang-option .lang-name { flex: 1; }
.lang-option .check { width: 14px; height: 14px; opacity: 0; stroke: var(--text); stroke-width: 2; }
.lang-option.selected .check { opacity: 1; }

/* ============================================
   ORB
   ============================================ */
.orb-wrapper {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  cursor: pointer;
  user-select: none;
  transition: top 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}
.orb-wrapper.hidden { opacity: 0; pointer-events: none; }
.orb-wrapper.chat-open { top: 15%; }
.orb-container {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1), height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.orb-wrapper.chat-open .orb-container { width: 80px; height: 80px; }
.orb-container::before {
  content: '';
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--hover-strong) 0%, transparent 70%);
  animation: pulse-halo 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pulse-halo {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.6; }
}
.orb {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}
.orb-wrapper.chat-open .orb { width: 70px; height: 70px; }

/* حالت‌های orb — همه خاکستری */
.orb-wrapper.listening .orb {
  background: var(--text);
  border-color: var(--text);
  transform: scale(1.03);
}
.orb-wrapper.thinking .orb {
  background: var(--text-soft);
  border-color: var(--text-soft);
}
.orb-wrapper.speaking .orb {
  background: var(--text);
  border-color: var(--text);
  animation: speakPulse 1.5s ease-in-out infinite;
}
@keyframes speakPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.wave-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 50px;
  position: relative;
  z-index: 1;
}
.orb-wrapper.chat-open .wave-group { height: 24px; gap: 3px; }
.orb-wrapper.chat-open .wave-bar { width: 3px; }
.wave-bar {
  width: 5px;
  height: 10px;
  border-radius: 3px;
  background: var(--text-soft);
  transition: background 0.2s ease, height 0.15s ease-in-out;
}
.orb-wrapper.listening .wave-bar,
.orb-wrapper.speaking .wave-bar,
.orb-wrapper.thinking .wave-bar { background: var(--action-text); }
.orb-wrapper.chat-open .wave-bar { background: var(--text-soft); }

.status-text {
  font-size: 15px;
  color: var(--text-soft);
  font-weight: 500;
  text-align: center;
  min-height: 22px;
  padding: 0 20px;
  transition: opacity 0.25s ease;
}
.orb-wrapper.chat-open .status-text { opacity: 0; }

/* ============================================
   OVERLAY & DRAWERS
   ============================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 200;
  display: none;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}
.overlay.show {
  display: block;
  opacity: 1;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--card);
  z-index: 300;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}
html[dir="ltr"] .drawer { left: 0; transform: translateX(-100%); }
html[dir="rtl"] .drawer { right: 0; transform: translateX(100%); }
.drawer.open { transform: translateX(0) !important; }
.sub-drawer { z-index: 350; }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.user-profile { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--action-bg);
  color: var(--action-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-email {
  font-size: 12px;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--action-bg);
  color: var(--action-text);
  margin-top: 4px;
  letter-spacing: 0.3px;
  border: 1px solid var(--border-strong);
}
.user-badge svg { width: 10px; height: 10px; stroke-width: 1.5; stroke: var(--action-text); }

.close-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.close-btn:hover { background: var(--hover-strong); }
.close-btn:active { transform: scale(0.92); }
.close-btn svg { width: 18px; height: 18px; }

.back-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.back-btn:hover { background: var(--hover); }
.back-btn:active { transform: scale(0.95); }
.back-btn svg { width: 20px; height: 20px; stroke: currentColor; }
html[dir="rtl"] .back-btn svg { transform: rotate(180deg); }

.drawer-title { font-size: 17px; font-weight: 700; flex: 1; text-align: center; }
.drawer-menu {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
  color: var(--text);
}
.menu-item:hover { background: var(--hover); }
.menu-item:active { transform: scale(0.98); }
.menu-item svg { width: 20px; height: 20px; stroke: currentColor; }
.menu-item span:first-of-type { flex: 1; }
.menu-badge {
  background: var(--action-bg);
  color: var(--action-text);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}
.menu-divider { height: 1px; background: var(--border); margin: 8px 16px; }
.menu-item.logout { color: var(--danger); }
.menu-item.logout:hover { background: rgba(212,24,61,0.08); }
.menu-item.premium {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  margin-bottom: 8px;
}
.menu-item.premium:hover { background: var(--hover); }
.menu-item.premium svg { stroke: var(--text); }

.drawer.open .menu-item { animation: slideInMenu 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
.drawer.open .menu-item:nth-child(1) { animation-delay: 0.08s; }
.drawer.open .menu-item:nth-child(2) { animation-delay: 0.13s; }
.drawer.open .menu-item:nth-child(3) { animation-delay: 0.18s; }
.drawer.open .menu-item:nth-child(4) { animation-delay: 0.23s; }
.drawer.open .menu-item:nth-child(5) { animation-delay: 0.28s; }
.drawer.open .menu-item:nth-child(6) { animation-delay: 0.33s; }

@keyframes slideInMenu {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}
html[dir="rtl"] .drawer.open .menu-item { animation-name: slideInMenuRTL; }
@keyframes slideInMenuRTL {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-soft);
}
.empty-icon { opacity: 0.35; color: var(--text); animation: floatIcon 3s ease-in-out infinite; }
.empty-icon svg { width: 56px; height: 56px; }
@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.empty-text { font-size: 14px; font-weight: 500; line-height: 1.6; max-width: 260px; }

/* ============================================
   SETTINGS CARDS
   ============================================ */
.settings-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 14px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  margin-bottom: 10px;
  animation: slideIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.settings-card:nth-child(1) { animation-delay: 0.08s; }
.settings-card:nth-child(2) { animation-delay: 0.13s; }
.settings-card:nth-child(3) { animation-delay: 0.18s; }
.settings-card:nth-child(4) { animation-delay: 0.23s; }
.settings-card:nth-child(5) { animation-delay: 0.28s; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.settings-card:hover {
  background: var(--hover);
  border-color: var(--border-strong);
}
.settings-card:active { transform: scale(0.99); }

.settings-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.settings-card:hover .settings-card-icon { transform: scale(1.1); }
.settings-card-info { flex: 1; min-width: 0; }
.settings-card-title { font-size: 15px; font-weight: 600; }
.settings-card-sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.settings-card-arrow { color: var(--text-muted); font-size: 18px; transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.settings-card:hover .settings-card-arrow { transform: translateX(3px); }
html[dir="rtl"] .settings-card:hover .settings-card-arrow { transform: translateX(-3px); }

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  background: transparent;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  animation: slideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.setting-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.setting-label {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.setting-label svg { width: 16px; height: 16px; }
.setting-value { font-size: 13px; color: var(--text); font-weight: 700; }
.setting-hint {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 6px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.setting-hint svg {
  width: 12px;
  height: 12px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}
html[dir="rtl"] .setting-hint svg { margin-right: 0; margin-left: 4px; }

.setting-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--track-bg);
  outline: none;
}
.setting-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--action-bg);
  border: 1.5px solid var(--action-bg);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.setting-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--action-bg);
  border: 1.5px solid var(--action-bg);
  cursor: pointer;
}
.setting-slider::-webkit-slider-thumb:active { transform: scale(1.2); }

.setting-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: var(--track-bg);
  cursor: pointer;
  transition: background 0.25s ease;
  flex-shrink: 0;
}
.setting-switch.on { background: var(--action-bg); }
.setting-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-elevated);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
html.dark .setting-switch::after { background: #f5f5f5; }
.setting-switch.on::after { transform: translateX(20px); }

.choice-row { display: flex; gap: 8px; flex-wrap: wrap; }
.choice-btn {
  padding: 8px 14px;
  border-radius: 10px;
  background: transparent;
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text);
}
.choice-btn svg { width: 14px; height: 14px; stroke: currentColor; }
.choice-btn:hover { background: var(--hover); border-color: var(--border-strong); }
.choice-btn:active { transform: scale(0.96); }
.choice-btn.active {
  border-color: var(--text);
  background: var(--action-bg);
  color: var(--action-text);
}

.danger-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: transparent;
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  border: 1.5px solid var(--danger);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.danger-btn svg { width: 16px; height: 16px; stroke: currentColor; }
.danger-btn:hover { background: rgba(212,24,61,0.08); }
.danger-btn:active { transform: scale(0.98); }

/* ============================================
   CHAT DRAWER
   ============================================ */
.chat-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 88vh;
  background: var(--bg);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-top: 1px solid var(--border);
  transform: translateY(calc(100% - 72px));
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 250;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-drawer.open { transform: translateY(0); }

.chat-handle {
  width: 100%;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
  position: relative;
  touch-action: none;
}
.chat-handle:active { cursor: grabbing; }
.chat-handle-bar {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.chat-drawer.open .chat-handle-bar {
  opacity: 0;
  transform: translateX(-50%) scale(0.5);
}
.chat-handle-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--card);
  border-radius: 100px;
  box-shadow: var(--shadow-sm);
  margin-top: 8px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}
.chat-handle-icon { width: 16px; height: 16px; stroke: var(--text); }
.chat-handle-text { font-size: 13px; font-weight: 600; color: var(--text); }
.chat-handle-count {
  background: var(--action-bg);
  color: var(--action-text);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  min-width: 20px;
  text-align: center;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 14px;
  flex-shrink: 0;
}
.chat-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.chat-header-title svg { width: 20px; height: 20px; stroke: currentColor; }

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.chat-list::-webkit-scrollbar { width: 4px; }
.chat-list::-webkit-scrollbar-track { background: transparent; }
.chat-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 14.5px;
  line-height: 1.55;
  word-wrap: break-word;
  animation: bubble-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--action-bg);
  color: var(--action-text);
  border-bottom-right-radius: 6px;
}
html[dir="rtl"] .chat-bubble.user { align-self: flex-start; }
.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--card);
  color: var(--text);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--border);
}
html[dir="rtl"] .chat-bubble.assistant { align-self: flex-end; }
.chat-bubble-image {
  max-width: 100%;
  border-radius: 14px;
  margin-bottom: 8px;
  display: block;
}
.chat-bubble-time {
  display: block;
  font-size: 10px;
  margin-top: 6px;
  opacity: 0.6;
  font-weight: 500;
}
.chat-bubble.user .chat-bubble-time { text-align: right; }
.chat-bubble.assistant .chat-bubble-time { text-align: left; }
html[dir="rtl"] .chat-bubble.user .chat-bubble-time { text-align: left; }
html[dir="rtl"] .chat-bubble.assistant .chat-bubble-time { text-align: right; }

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 6px 0;
}
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-soft);
  animation: typing 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.chat-input-area {
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.chat-image-preview {
  display: none;
  position: relative;
  margin-bottom: 10px;
  padding: 8px;
  background: var(--input-bg);
  border-radius: 14px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
}
.chat-image-preview.show { display: flex; }
.chat-image-preview img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 10px;
}
.chat-image-preview-info {
  flex: 1;
  font-size: 12px;
  color: var(--text-soft);
}
.chat-image-preview-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-image-preview-remove:hover { background: var(--hover); }
.chat-image-preview-remove svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.5;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}
.chat-attach-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  align-self: flex-end;
}
.chat-attach-btn:hover { background: var(--hover); }
.chat-attach-btn:active { transform: scale(0.92); }
.chat-attach-btn svg { width: 20px; height: 20px; stroke: var(--text); }

.chat-input {
  flex: 1;
  padding: 11px 18px;
  border-radius: 22px;
  background: var(--input-bg);
  border: 1.5px solid transparent;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  line-height: 1.4;
  transition: border-color 0.2s ease, background 0.2s ease;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chat-input::-webkit-scrollbar { display: none; width: 0; height: 0; }
.chat-input:focus {
  border-color: var(--border-strong);
  background: var(--card);
}
.chat-input::placeholder { color: var(--text-muted); }

.chat-send-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: var(--action-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  align-self: flex-end;
  border: 1.5px solid var(--action-bg);
}
.chat-send-btn:active { transform: scale(0.9); }
.chat-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.chat-send-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--action-text);
  stroke-width: 1.5;
  fill: none;
}

/* ============================================
   HISTORY
   ============================================ */
.history-item {
  padding: 14px 16px 14px 56px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  margin-bottom: 8px;
  position: relative;
  animation: slideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.history-item:hover { background: var(--hover); border-color: var(--border-strong); }
.history-item:active { transform: scale(0.99); }
.history-item.active-chat {
  background: var(--hover);
  border-color: var(--text);
}
html[dir="rtl"] .history-item.active-chat {
  border-left: none;
}
.history-item-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}
.history-item-meta {
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  gap: 10px;
  align-items: center;
}
.history-item-delete {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
html[dir="rtl"] .history-item-delete { left: auto; right: 12px; }
.history-item-delete svg { width: 16px; height: 16px; stroke: currentColor; }
.history-item-delete:hover {
  background: rgba(212,24,61,0.08);
  border-color: var(--danger);
  color: var(--danger);
}

/* ============================================
   PREMIUM — خنثی
   ============================================ */
.premium-page { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.premium-hero {
  text-align: center;
  padding: 30px 20px;
  background: transparent;
  border-radius: 20px;
  border: 1.5px solid var(--border-strong);
  animation: slideIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.premium-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--text);
}
.premium-icon svg { width: 60px; height: 60px; stroke-width: 1.5; stroke: currentColor; }
.premium-title { font-size: 24px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.premium-subtitle { font-size: 14px; color: var(--text-soft); line-height: 1.6; }
.premium-plans { display: flex; flex-direction: column; gap: 12px; }
.premium-plan {
  padding: 20px;
  border-radius: 16px;
  background: transparent;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
.premium-plan:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.premium-plan.selected {
  border-color: var(--text);
  background: var(--hover);
}
.premium-plan.featured { border-color: var(--text); }
.premium-badge {
  position: absolute;
  top: -8px;
  right: 16px;
  background: var(--action-bg);
  color: var(--action-text);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}
html[dir="rtl"] .premium-badge { right: auto; left: 16px; }
.premium-plan-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.premium-plan-price { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.premium-plan-price span { font-size: 14px; color: var(--text-soft); font-weight: 500; }
.premium-plan-features { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.premium-plan-features li {
  font-size: 13px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}
.premium-plan-features li::before {
  content: '—';
  color: var(--text);
  font-weight: 700;
}
.premium-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: var(--action-bg);
  color: var(--action-text);
  font-size: 15px;
  font-weight: 700;
  margin-top: 16px;
  transition: transform 0.2s ease;
  border: 1.5px solid var(--action-bg);
}
.premium-btn:active { transform: scale(0.98); }
.premium-active {
  text-align: center;
  padding: 24px;
  background: transparent;
  border-radius: 16px;
  border: 1.5px solid var(--border-strong);
}
.premium-active-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--text);
}
.premium-active-icon svg { width: 48px; height: 48px; stroke-width: 1.5; stroke: currentColor; }
.premium-active-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.premium-active-sub { font-size: 13px; color: var(--text-soft); line-height: 1.6; }
.premium-active-info {
  margin-top: 16px;
  padding: 12px;
  background: var(--input-bg);
  border-radius: 12px;
}
.premium-active-plan { font-size: 13px; color: var(--text-soft); margin-bottom: 4px; }
.premium-active-expiry { font-size: 12px; color: var(--text-soft); }

/* ============================================
   TOAST
   ============================================ */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 100%;
  max-width: 400px;
  padding: 0 16px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  animation: toastIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
  border: 1px solid var(--border);
  border-left: 3px solid var(--text);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast.hide { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-20px); }
}

/* ============================================
   CONTEXT MENU
   ============================================ */
.context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 200px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow-xl);
  padding: 6px;
  display: none;
  opacity: 0;
  transform: scale(0.92);
  transform-origin: top left;
  transition: opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1), transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.context-menu.show { opacity: 1; transform: scale(1); }
.context-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background 0.15s ease;
}
html[dir="rtl"] .context-menu-item { text-align: right; flex-direction: row-reverse; }
.context-menu-item:hover { background: var(--hover); }
.context-menu-item:active { transform: scale(0.98); }
.context-menu-item svg { width: 18px; height: 18px; stroke: currentColor; }
.context-menu-divider { height: 1px; background: var(--border); margin: 4px 8px; }
.chat-bubble.msg-liked { border-left: 3px solid var(--text); }
.chat-bubble.msg-disliked { border-left: 3px solid var(--text-soft); }

/* ============================================
   CODE BLOCK — همیشه مشکی
   ============================================ */
.code-block {
  margin: 14px 0;
  border-radius: 14px;
  overflow: hidden;
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.1);
  direction: ltr;
  text-align: left;
  animation: codeBlockIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.code-block.incomplete {
  border-color: rgba(255,200,100,0.4);
}
@keyframes codeBlockIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.code-block-lang { display: flex; align-items: center; gap: 10px; }
.code-block-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8b949e;
  flex-shrink: 0;
}
.code-block-lang-name {
  color: #f0f6fc;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.code-block-lines {
  color: #8b949e;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
}
.code-block-actions { display: flex; gap: 6px; }
.code-block-copy,
.code-block-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: #c9d1d9;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255,255,255,0.08);
}
.code-block-copy:hover,
.code-block-wrap:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.2);
}
.code-block-copy:active,
.code-block-wrap:active { transform: scale(0.95); }
.code-block-copy svg,
.code-block-wrap svg { width: 14px; height: 14px; stroke: currentColor; }
.code-block-wrap.active { background: rgba(255,255,255,0.15); color: #fff; }
.code-block-copy .check-icon { display: none; }
.code-block-copy.copied {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.code-block-copy.copied .copy-icon { display: none; }
.code-block-copy.copied .check-icon { display: block; }
.code-block-body {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 500px;
  -webkit-overflow-scrolling: touch;
}
.code-block-body::-webkit-scrollbar { width: 8px; height: 8px; }
.code-block-body::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.code-block-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}
.code-block-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}
.code-block-pre {
  margin: 0;
  padding: 16px 18px;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.65;
  color: #c9d1d9;
  white-space: pre;
  tab-size: 2;
  min-width: 100%;
  width: max-content;
  letter-spacing: 0.2px;
}
.code-block-pre.wrap {
  white-space: pre-wrap;
  word-wrap: break-word;
  width: 100%;
}
.code-block-code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  white-space: inherit;
}
.code-block-incomplete {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255,200,100,0.08);
  border-top: 1px solid rgba(255,200,100,0.3);
  color: #e6b450;
  font-size: 12px;
  font-weight: 500;
}
.code-block-incomplete svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.5;
  flex-shrink: 0;
}
.cm-comment { color: #8b949e; font-style: italic; }
.cm-keyword { color: #ff7b72; font-weight: 600; }
.cm-string { color: #a5d6ff; }
.cm-number { color: #79c0ff; }
.cm-boolean { color: #79c0ff; font-weight: 600; }
.cm-tag { color: #7ee787; }
.cm-attr { color: #79c0ff; }
.cm-function { color: #d2a8ff; }

.inline-code {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 0.88em;
  font-weight: 500;
  direction: ltr;
  border: 1px solid var(--border);
}
.msg-heading {
  font-size: 16px;
  font-weight: 700;
  margin: 12px 0 8px;
  color: var(--text);
}
.chat-bubble.assistant { max-width: 92% !important; }
.chat-bubble-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.65;
  font-size: 14.5px;
}
.chat-bubble-text strong { color: var(--text); font-weight: 700; }
.chat-bubble-text em { font-style: italic; color: var(--text-soft); }
.chat-bubble-text a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
}

.hidden { display: none !important; }
.no-select { user-select: none; -webkit-user-select: none; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
  .code-block-pre { font-size: 12px; padding: 12px; }
  .code-block-copy .copy-label,
  .code-block-wrap .wrap-label { display: none; }
  .chat-bubble { font-size: 14px; }
  .chat-drawer { height: 92vh; }
  .settings-card-icon svg { width: 20px; height: 20px; }
  .limit-badge { padding: 5px 9px; font-size: 10px; min-width: 40px; }
}

/* ============================================
   UPSELL CARD — دعوت نرم به پرمیوم
   ============================================ */
.upsell-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 18px 16px;
  margin: 6px 0 14px;
  border-radius: 18px;
  background: var(--card);
  border: 1.5px solid var(--border-strong);
  position: relative;
  overflow: hidden;
  animation: upsellIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: 0.15s;
}
.upsell-card::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--hover-strong) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.9;
}
.upsell-card::after {
  content: '✦';
  position: absolute;
  top: 14px; right: 18px;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.5;
  animation: upsellSparkle 3s ease-in-out infinite;
}
@keyframes upsellSparkle {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.15); }
}
@keyframes upsellIn {
  from { opacity: 0; transform: translateY(20px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.upsell-card.upsell-hide {
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.upsell-icon {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 2px;
  display: inline-block;
  animation: upsellBrain 4s ease-in-out infinite;
}
@keyframes upsellBrain {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-4deg) scale(1.03); }
  75% { transform: rotate(4deg) scale(1.03); }
}
.upsell-body { display: flex; flex-direction: column; gap: 4px; position: relative; z-index: 1; }
.upsell-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  line-height: 1.35;
}
.upsell-sub { font-size: 12.5px; color: var(--text-soft); line-height: 1.5; }
.upsell-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; position: relative; z-index: 1; }
.upsell-btn {
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--action-bg);
  color: var(--action-text);
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid var(--action-bg);
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.1px;
}
.upsell-btn:hover { transform: translateY(-1px); opacity: 0.92; }
.upsell-btn:active { transform: scale(0.97); }
.upsell-later {
  background: transparent;
  border: none;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: inherit;
}
.upsell-later:hover { background: var(--hover); color: var(--text); }
.upsell-later:active { transform: scale(0.96); }

@media (max-width: 480px) {
  .upsell-card { padding: 16px 16px 14px; border-radius: 16px; }
  .upsell-icon { font-size: 24px; }
  .upsell-title { font-size: 14.5px; }
  .upsell-sub { font-size: 12px; }
  .upsell-btn { padding: 8px 14px; font-size: 12.5px; }
  .upsell-later { font-size: 11.5px; }
}


/* ============================================
   THINKING CARD — مثل DeepSeek R1
   ============================================ */
.thinking-card {
  align-self: flex-start;
  max-width: 92%;
  margin: 4px 0 8px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: thinkingIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes thinkingIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.thinking-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}
.thinking-header:hover { background: var(--hover); }

.thinking-dot-group {
  display: flex;
  gap: 4px;
  align-items: center;
}
.thinking-dot-group span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-soft);
  animation: thinkingPulse 1.4s infinite ease-in-out;
}
.thinking-dot-group span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dot-group span:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinkingPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

.thinking-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  font-style: italic;
}

.thinking-toggle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), background 0.15s ease;
}
.thinking-toggle:hover { background: var(--hover-strong); }
.thinking-toggle svg { width: 14px; height: 14px; }

.thinking-card.collapsed .thinking-toggle { transform: rotate(-90deg); }
.thinking-card.collapsed .thinking-body { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }

.thinking-body {
  max-height: 400px;
  overflow-y: auto;
  padding: 0 14px 12px;
  transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease, padding 0.3s ease;
}

.thinking-content {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-style: italic;
  padding-left: 14px;
  border-left: 2px solid var(--border-strong);
  margin-top: 4px;
}

.thinking-card.done .thinking-label {
  font-style: normal;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .thinking-card { max-width: 95%; }
  .thinking-content { font-size: 12.5px; }
  .thinking-body { max-height: 280px; }
}