/* ============================================================
   chat.css — AI Chat page styles
   Load AFTER main.css
   ============================================================ */

/* ---- PAGE LAYOUT ---- */
.chat-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7rem 1.5rem 4rem;
  position: relative;
  z-index: 1;
  gap: 1.5rem;
}

/* Glowing orb — purple tint to differentiate from other pages */
.chat-orb {
  position: fixed;
  left: 5%;
  top: 40%;
  transform: translateY(-50%);
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(124,58,237,0.18) 0%,
    rgba(0,212,255,0.06) 50%,
    transparent 70%);
  filter: blur(50px);
  pointer-events: none;
  animation: pulse 4s ease-in-out infinite;
  z-index: 0;
}

/* ---- PAGE HEADER ---- */
.chat-header {
  width: 100%;
  max-width: 680px;
  text-align: center;
}

.chat-subheading {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 0.6rem;
}

.chat-subheading .powered-by {
  color: var(--accent);
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem;
}

.chat-notice {
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.7;
}

.chat-notice a {
  color: var(--accent);
  text-decoration: none;
}

.chat-notice a:hover { text-decoration: underline; }

/* ---- CHAT CARD ---- */
.chat-card {
  width: 100%;
  max-width: 680px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.5s 0.1s ease both;
}

/* Accent bar at top */
.chat-card::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--accent2), var(--accent), transparent);
  flex-shrink: 0;
}

/* ---- MESSAGES AREA ---- */
.chat-messages {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  overflow-y: auto;
  max-height: 480px;
  min-height: 260px;
  scroll-behavior: smooth;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ---- MESSAGE BUBBLES ---- */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  animation: fadeUp 0.25s ease both;
}

/* User messages sit on the right */
.msg-user {
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.3);
  color: #a78bfa;
  font-family: 'Orbitron', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

.msg-bubble {
  max-width: 78%;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.7;
}

/* AI bubble */
.msg-ai .msg-bubble {
  background: rgba(0,212,255,0.05);
  border: 1px solid rgba(0,212,255,0.12);
  color: var(--text);
  border-top-left-radius: 2px;
}

/* User bubble */
.msg-user .msg-bubble {
  background: rgba(124,58,237,0.12);
  border: 1px solid rgba(124,58,237,0.2);
  color: var(--text);
  border-top-right-radius: 2px;
}

.msg-bubble p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- TYPING INDICATOR ---- */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 1.5rem 0.8rem;
}

.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50%       { transform: translateY(-5px); opacity: 1; }
}

/* ---- INPUT BAR ---- */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.chat-textarea {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  outline: none;
  resize: none;
  line-height: 1.5;
  transition: border-color 0.2s;
  max-height: 120px;
  overflow-y: auto;
}

.chat-textarea:focus { border-color: var(--accent); }
.chat-textarea:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-textarea::placeholder { color: var(--muted); }

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  border: none;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #fff;
  box-shadow: 0 0 20px rgba(0,212,255,0.4);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  background: var(--accent);
}

/* ---- CARD FOOTER BAR ---- */
.chat-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.2rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
}

.chat-card-footer a {
  color: var(--accent);
  text-decoration: none;
}

.chat-card-footer a:hover { text-decoration: underline; }

.chat-clear-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--muted);
  font-family: 'Syne', sans-serif;
  font-size: 0.72rem;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}

.chat-clear-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .chat-page { padding: 6rem 1rem 3rem; }
  .chat-orb { display: none; }
  .chat-messages { max-height: 55vh; }
  .msg-bubble { max-width: 90%; }
}
