/* ── OTP inputs — اعداد انگلیسی، چپ به راست ── */
.otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  direction: ltr;
  margin-bottom: 16px;
}
.otp-digit {
  width: 42px;
  height: 50px;
  text-align: center;
  font-size: 22px;
  font-family: 'Courier New', 'Consolas', monospace !important;
  font-variant-numeric: tabular-nums;
  direction: ltr !important;
  unicode-bidi: plaintext;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-text-security: none;
  caret-color: var(--accent);
}
.otp-digit:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ── استایل فایل‌های پیوست ── */
.file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
  max-width: 220px;
  transition: border-color .15s, box-shadow .15s;
  animation: chipIn .18s ease;
}
@keyframes chipIn {
  from { opacity:0; transform:scale(.88) translateY(4px); }
  to   { opacity:1; transform:scale(1)  translateY(0);    }
}
.file-chip:hover { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent); }
.file-chip-icon {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.file-chip-icon.img  { background: rgba(99,102,241,.15); color: #818cf8; }
.file-chip-icon.pdf  { background: rgba(239, 68, 68,.15); color: #f87171; }
.file-chip-icon.code { background: rgba(16,185,129,.15);  color: #34d399; }
.file-chip-icon.txt  { background: rgba(245,158, 11,.15); color: #fbbf24; }
.file-chip-body { flex:1; overflow:hidden; }
.file-chip-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:500; color:var(--text-primary); }
.file-chip-size { font-size:10px; color:var(--text-muted); margin-top:1px; }
.file-chip-del {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px;
  border-radius: 4px; line-height:1; flex-shrink:0;
  transition: color .15s, background .15s;
}
.file-chip-del:hover { color: #ef4444; background: rgba(239,68,68,.12); }
.attach-btn { position:relative; }
.attach-btn.has-files::after {
  content: attr(data-count);
  position: absolute; top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--accent); color: #fff;
  border-radius: 50%; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; line-height:1;
}

/* ── پیام‌ها: ساختار جدید ── */
.msg-body { display:flex; flex-direction:column; gap:4px; max-width: min(72%, 680px); }
.msg.user .msg-body { align-items: flex-end; }
.msg.ai   .msg-body { align-items: flex-start; }

/* ── action bar ── */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity .18s;
  padding: 2px 0;
}
.msg:hover .msg-actions { opacity: 1; }
.msg-act-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 7px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  font-family: inherit;
}
.msg-act-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.msg-act-btn i { font-size: 13px; }
.msg-act-btn span { font-size: 11.5px; }
.msg-act-btn.active-thumb.thumb-up   { color: #34d399; }
.msg-act-btn.active-thumb.thumb-down { color: #f87171; }
.regen-btn { margin-right: 4px; border-right: 1px solid var(--border); padding-right: 10px; }

/* ── کد بلاک ── */
.code-block {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 6px 0;
  font-size: 13px;
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--bg-tertiary) 60%, #000 40%);
  border-bottom: 1px solid var(--border);
}
.code-lang {
  font-size: 11px; color: var(--text-muted);
  font-family: monospace; text-transform: lowercase;
}
.code-copy-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 11.5px;
  padding: 2px 6px; border-radius: 5px;
  transition: color .15s, background .15s;
  font-family: inherit;
}
.code-copy-btn:hover { color: var(--text-primary); background: var(--bg-secondary); }
.code-block pre {
  margin: 0; padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px; line-height: 1.6;
  color: var(--text-primary);
}
.code-block code { font-family: 'Courier New', monospace; }
.inline-code {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
  font-family: monospace;
  color: #f472b6;
}
.md-h1,.md-h2,.md-h3 { margin: 8px 0 4px; color: var(--text-primary); }
.md-h1 { font-size: 18px; } .md-h2 { font-size: 16px; } .md-h3 { font-size: 14px; }
.md-hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.msg-bubble ul { margin: 4px 0; padding-right: 18px; }
.msg-bubble li { margin: 2px 0; }

/* ── ویرایش پیام ── */
.edit-wrap { display:flex; flex-direction:column; gap:8px; width:100%; }
.edit-textarea {
  width: 100%; min-height: 60px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit; font-size: 14px;
  resize: none; outline: none;
  line-height: 1.6;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.edit-actions { display:flex; gap:8px; justify-content:flex-end; }
.edit-save-btn {
  display:inline-flex; align-items:center; gap:5px;
  background: var(--accent); color:#fff;
  border:none; border-radius:8px;
  padding: 6px 14px; font-size:13px;
  cursor:pointer; font-family:inherit;
  transition: opacity .15s;
}
.edit-save-btn:hover { opacity:.88; }
.edit-cancel-btn {
  background: var(--bg-tertiary); color:var(--text-muted);
  border: 1px solid var(--border); border-radius:8px;
  padding: 6px 12px; font-size:13px;
  cursor:pointer; font-family:inherit;
  transition: color .15s, background .15s;
}
.edit-cancel-btn:hover { color:var(--text-primary); background:var(--bg-secondary); }


/* ── OTP inputs — اعداد انگلیسی، چپ به راست ── */
.otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  direction: ltr;
  margin-bottom: 16px;
}
.otp-digit {
  width: 42px;
  height: 50px;
  text-align: center;
  font-size: 22px;
  font-family: 'Courier New', 'Consolas', monospace !important;
  font-variant-numeric: tabular-nums;
  direction: ltr !important;
  unicode-bidi: plaintext;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-text-security: none;
  caret-color: var(--accent);
}
.otp-digit:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ── استایل فایل‌های پیوست ── */
.file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
  max-width: 220px;
  transition: border-color .15s, box-shadow .15s;
  animation: chipIn .18s ease;
}
@keyframes chipIn {
  from { opacity:0; transform:scale(.88) translateY(4px); }
  to   { opacity:1; transform:scale(1)  translateY(0);    }
}
.file-chip:hover { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent); }
.file-chip-icon {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.file-chip-icon.img  { background: rgba(99,102,241,.15); color: #818cf8; }
.file-chip-icon.pdf  { background: rgba(239, 68, 68,.15); color: #f87171; }
.file-chip-icon.code { background: rgba(16,185,129,.15);  color: #34d399; }
.file-chip-icon.txt  { background: rgba(245,158, 11,.15); color: #fbbf24; }
.file-chip-body { flex:1; overflow:hidden; }
.file-chip-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:500; color:var(--text-primary); }
.file-chip-size { font-size:10px; color:var(--text-muted); margin-top:1px; }
.file-chip-del {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px;
  border-radius: 4px; line-height:1; flex-shrink:0;
  transition: color .15s, background .15s;
}
.file-chip-del:hover { color: #ef4444; background: rgba(239,68,68,.12); }
.attach-btn { position:relative; }
.attach-btn.has-files::after {
  content: attr(data-count);
  position: absolute; top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--accent); color: #fff;
  border-radius: 50%; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; line-height:1;
}

/* ── پیام‌ها: ساختار جدید ── */
.msg-body { display:flex; flex-direction:column; gap:4px; max-width: min(72%, 680px); }
.msg.user .msg-body { align-items: flex-end; }
.msg.ai   .msg-body { align-items: flex-start; }

/* ── action bar ── */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity .18s;
  padding: 2px 0;
}
.msg:hover .msg-actions { opacity: 1; }
.msg-act-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 7px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  font-family: inherit;
}
.msg-act-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.msg-act-btn i { font-size: 13px; }
.msg-act-btn span { font-size: 11.5px; }
.msg-act-btn.active-thumb.thumb-up   { color: #34d399; }
.msg-act-btn.active-thumb.thumb-down { color: #f87171; }
.regen-btn { margin-right: 4px; border-right: 1px solid var(--border); padding-right: 10px; }

/* ── کد بلاک ── */
.code-block {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 6px 0;
  font-size: 13px;
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--bg-tertiary) 60%, #000 40%);
  border-bottom: 1px solid var(--border);
}
.code-lang {
  font-size: 11px; color: var(--text-muted);
  font-family: monospace; text-transform: lowercase;
}
.code-copy-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 11.5px;
  padding: 2px 6px; border-radius: 5px;
  transition: color .15s, background .15s;
  font-family: inherit;
}
.code-copy-btn:hover { color: var(--text-primary); background: var(--bg-secondary); }
.code-block pre {
  margin: 0; padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px; line-height: 1.6;
  color: var(--text-primary);
}
.code-block code { font-family: 'Courier New', monospace; }
.inline-code {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
  font-family: monospace;
  color: #f472b6;
}
.md-h1,.md-h2,.md-h3 { margin: 8px 0 4px; color: var(--text-primary); }
.md-h1 { font-size: 18px; } .md-h2 { font-size: 16px; } .md-h3 { font-size: 14px; }
.md-hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.msg-bubble ul { margin: 4px 0; padding-right: 18px; }
.msg-bubble li { margin: 2px 0; }

/* ── ویرایش پیام ── */
.edit-wrap { display:flex; flex-direction:column; gap:8px; width:100%; }
.edit-textarea {
  width: 100%; min-height: 60px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit; font-size: 14px;
  resize: none; outline: none;
  line-height: 1.6;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.edit-actions { display:flex; gap:8px; justify-content:flex-end; }
.edit-save-btn {
  display:inline-flex; align-items:center; gap:5px;
  background: var(--accent); color:#fff;
  border:none; border-radius:8px;
  padding: 6px 14px; font-size:13px;
  cursor:pointer; font-family:inherit;
  transition: opacity .15s;
}
.edit-save-btn:hover { opacity:.88; }
.edit-cancel-btn {
  background: var(--bg-tertiary); color:var(--text-muted);
  border: 1px solid var(--border); border-radius:8px;
  padding: 6px 12px; font-size:13px;
  cursor:pointer; font-family:inherit;
  transition: color .15s, background .15s;
}
.edit-cancel-btn:hover { color:var(--text-primary); background:var(--bg-secondary); }
</style>