* {
  box-sizing: border-box;
  font-family: "Vazirmatn", Tahoma;
}

body {
  margin: 0;
  height: 100vh;
  background: linear-gradient(135deg, #0f0f14, #181825);
  direction: rtl;
  color: #e5e7eb;
}

.app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: #020617;
  border-left: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 14px;
  font-weight: 600;
  border-bottom: 1px solid #1f2937;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-actions {
  display: flex;
  gap: 6px;
}

.sidebar-actions button {
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: #1f2937;
  color: #e5e7eb;
  font-size: 12px;
  padding: 4px 6px;
}

.sidebar-actions button:hover {
  background: #374151;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
}

.conversation-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid #1f2937;
}

.conversation-item.active {
  background: #1f2937;
  font-weight: bold;
}

/* Promo */
.promo-btn {
  padding: 10px;
  border-bottom: 1px solid #1f2937;
}

#gishehBtn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #020617;
  box-shadow: 0 4px 12px rgba(249,115,22,.4);
}

#gishehBtn:hover {
  transform: translateY(-1px);
}

/* Chat */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #111827;
}

.chat.loading {
  opacity: .7;
  pointer-events: none;
}

.chat-header {
  padding: 14px;
  background: #1f2937;
  text-align: center;
  font-weight: 600;
  border-bottom: 1px solid #374151;
}

.new-chat-banner {
  text-align: center;
  padding: 8px;
  font-size: 13px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  display: none;
}

.new-chat-banner.active {
  display: block;
}

.chat-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
}

.message {
  max-width: 70%;
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 14px;
  line-height: 1.6;
  animation: fadeIn .2s ease-out;
}

.message.user {
  background: #2563eb;
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.message.bot {
  background: #374151;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  background: #374151;
  padding: 10px 14px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  margin-right: auto;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #e5e7eb;
  border-radius: 50%;
  display: inline-block;
  margin: 0 2px;
  animation: blink 1.4s infinite both;
}

.typing-indicator span:nth-child(2) { animation-delay: .2s; }
.typing-indicator span:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
  0% { opacity: .2; }
  20% { opacity: 1; }
  100% { opacity: .2; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Input */
.chat-input {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #020617;
  border-top: 1px solid #374151;
}

.chat-input textarea {
  flex: 1;
  resize: none;
  height: 45px;
  border-radius: 10px;
  border: none;
  padding: 10px;
  background: #020617;
  color: #e5e7eb;
  outline: none;
}

.chat-input button {
  width: 48px;
  border-radius: 10px;
  border: none;
  background: #22c55e;
  font-size: 18px;
  cursor: pointer;
}

.chat-input button:hover {
  background: #16a34a;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    border-left: none;
    border-bottom: 1px solid #1f2937;
    flex-direction: row;
    overflow-x: auto;
  }

  .sidebar-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .conversation-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
  }

  .conversation-item {
    flex: 0 0 auto;
    margin-right: 6px;
    border-bottom: none;
    border-right: 1px solid #1f2937;
  }

  .chat {
    flex: 1;
  }

  .chat-input textarea {
    height: 40px;
  }
}
