* {
  box-sizing: border-box;
}

/* توجه: این استایل‌ها فقط باید روی خودِ پنل چت‌بات اثر بگذارند، نه کل صفحه سایت.
   به همین دلیل به‌جای html/body، مستقیماً روی main-container اعمال می‌شوند. */
.main-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #111827;
}

.main-container {
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

/* Sidebar */
.sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 80vw;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 12px;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  height: 48px;
  flex-shrink: 0;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #111827;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.new-chat-btn:hover {
  background-color: #f3f4f6;
}

.sidebar-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 8px 4px;
  flex-shrink: 0;
}

.history-list {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-empty {
  color: #9ca3af;
  font-size: 13px;
  padding: 8px;
}

.history-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #374151;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.15s ease;
}

.history-item:hover {
  background-color: #f3f4f6;
}

.history-item.active {
  background-color: #f3f4f6;
  font-weight: 500;
  color: #111827;
}

.sidebar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.header {
  /* position: fixed; */
  top: 0; left: 0; right: 0;
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 20;
  background: #f9fafb;
}

.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.header-title {
  font-size: 15px;
  font-weight: 500;
  color: #1f2937;
  margin: 0;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #374151;
  transition: background-color 0.15s ease;
}

.icon-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon.small {
  width: 16px;
  height: 16px;
}

/* Chat area */
.chat-container {
  flex-grow: 1;
  padding: 48px 16px 128px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-inner {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-section {
  display: flex;
  flex-direction: column;
}

.message-section.new-section {
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.message-row {
  display: flex;
  flex-direction: column;
}

.message-row.user {
  align-items: flex-end;
}

.message-row.system {
  align-items: flex-start;
}

.message-bubble {
  max-width: 80%;
  padding: 8px 16px;
  border-radius: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
}

.message-row.user .message-bubble {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-bottom-right-radius: 2px;
}

.message-row.system .message-bubble {
  color: #111827;
  padding-left: 4px;
  padding-right: 4px;
}

.fade-in-word {
  opacity: 0;
  display: inline;
  animation: fadeIn 0.25s ease-out forwards;
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(2px); }
  100% { opacity: 1; transform: translateY(0); }
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.message-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.15s ease;
}

.message-actions button:hover {
  color: #4b5563;
}

/* Input area */
.input-area {
  /* position: fixed; */
  bottom: 0; left: 0; right: 0;
  padding: 16px;
  background: #f9fafb;
  /* z-index: 0; */
}

.chat-form {
  max-width: 48rem;
  margin: 0 auto;
}

.input-container {
  position: relative;
  width: 100%;
  border-radius: 24px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 12px;
  cursor: text;
  transition: opacity 0.15s ease;
}

.input-container.streaming {
  opacity: 0.8;
}

.textarea-wrap {
  padding-bottom: 36px;
}

.chat-textarea {
  min-height: 24px;
  max-height: 160px;
  width: 100%;
  border: 0;
  background: transparent;
  color: #111827;
  font-size: 16px;
  padding: 0 16px 0 8px;
  resize: none;
  overflow-y: auto;
  line-height: 1.3;
  outline: none;
  font-family: inherit;
}

.chat-textarea::placeholder {
  color: #9ca3af;
}

.chat-textarea::-webkit-scrollbar {
  width: 6px;
}

.chat-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.chat-textarea::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.chat-textarea::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.2);
}

.controls-row {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-btn {
  height: 32px;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  cursor: pointer;
  color: #6b7280;
  font-size: 14px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.pill-btn.icon-only {
  width: 32px;
  padding: 0;
  justify-content: center;
  flex-shrink: 0;
}

.pill-btn span {
  color: #111827;
}

.pill-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.pill-btn.active {
  background-color: #f3f4f6;
  border-color: #d1d5db;
}

.pill-btn.active .icon {
  color: #374151;
}

.pill-btn.active span {
  font-weight: 500;
}

.submit-btn {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #e5e7eb;
  color: #6b7280;
  transition: all 0.2s ease;
}

.submit-btn:disabled {
  cursor: not-allowed;
}

.submit-btn.active {
  background: #000000;
  color: #ffffff;
  transform: scale(1.1);
}


@keyframes float{

0%{
transform:translateY(0px) scale(1);
}

25%{
transform:translateY(-6px) scale(1.02);
}

50%{
transform:translateY(4px) scale(.98);
}

75%{
transform:translateY(-3px) scale(1.01);
}

100%{
transform:translateY(0px) scale(1);
}

}

@keyframes pulse{

0%{
filter:blur(2px);
}

50%{
filter:blur(7px);
}

100%{
filter:blur(2px);
}

}

.welcome-screen{
    position:absolute;
    inset:0;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    background:#f9fafb;
    transition:.35s;
    z-index:100;
}

.welcome-screen.hide{
    opacity:0;
    visibility:hidden;
    pointer-events:none;
}

.jarvis{
    width:180px;
    height:180px;
    display:flex;
    justify-content:center;
    align-items:center;
    margin-bottom:35px;
}

.blob{
    width:180px;
    height:180px;
    border-radius:50%;

    background:
    radial-gradient(circle at 35% 30%, #8FE9FF, transparent 45%),
    radial-gradient(circle at 65% 65%, #FFC6D8, transparent 35%),
    radial-gradient(circle at 45% 50%, #9EF0B5, transparent 30%),
    #EEF2FF;

    animation: float 6s ease-in-out infinite;
}

@keyframes float{
    0%{transform:scale(1);}
    50%{transform:scale(1.06);}
    100%{transform:scale(1);}
}

.welcome-screen h1{
    color:#60697a;
    font-size:20px;
    font-weight: 400;
    margin-bottom:15px;
}

.welcome-screen p{
    color:#98a1b3;
    font-size:15px;
    font-weight: 300;
}

.chat-container{
    position:relative;
}

.chat-container{
    position:relative;
}

.chat-inner{
    position:relative;
    z-index:1;
}

.welcome-screen{
    position:absolute;
    inset:0;
    z-index:2;
}