/* ============================================================
   CHAT.CSS — Fənn üzrə şərh / müzakirə sistemi
   ============================================================ */

.subject-chat {
  margin-top: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}

.chat-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
}

.chat-title {
  font-family: 'Arial Nova', 'Nunito', 'Arial', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.chat-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Mesaj siyahısı ─────────────────────────────────────── */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 14px;
}

.chat-loading,
.chat-empty {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 18px 0;
}

.chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  position: relative;
}

.chat-msg-mine {
  border-color: var(--border);
}

.chat-avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.chat-msg-body {
  flex: 1;
  min-width: 0;
}

.chat-msg-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-msg-name {
  font-size: 0.82rem;
  font-weight: 700;
}

.chat-msg-time {
  font-size: 0.72rem;
  color: var(--muted);
}

.chat-msg-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--glow);
  color: var(--accent2);
  border: 1px solid var(--border);
}

.chat-msg-text {
  font-size: 0.88rem;
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-del {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  transition: all 0.2s;
}

.chat-msg-del:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.1);
}

/* ── Input sahəsi ───────────────────────────────────────── */
.chat-input-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-tag-btn {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.chat-tag-btn:hover {
  border-color: var(--border);
  color: var(--text);
}

.chat-tag-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

#chat-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

#chat-input:focus {
  border-color: var(--accent);
}

.chat-send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 18px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.chat-send-btn:hover {
  opacity: 0.9;
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-login-btn {
  width: 100%;
  background: var(--surface2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  color: var(--accent2);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-login-btn:hover {
  border-color: var(--accent2);
}

/* ── Mobil ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .subject-chat {
    padding: 14px 14px;
  }
  .chat-messages {
    max-height: 320px;
  }
  .chat-input-row {
    flex-direction: column;
  }
  .chat-send-btn {
    padding: 10px;
  }
}
