
/* ================= GLOBAL ================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
}

html {
  height: 100%;
  overscroll-behavior: none;
}

body {
  height: 100%;
  background: radial-gradient(circle at top, #0f172a, #020617 70%);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

/* ================= HEADER ================= */
header {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  z-index: 100;
}

header img {
  height: 40px;
}

#refreshBtn {
  background: none;
  border: none;
  color: #38bdf8;
  font-size: 1.4rem;
  cursor: pointer;
}

/* ================= MAIN ================= */
main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
  height: calc(var(--vh, 1vh) * 100);
}

/* ================= CHAT WRAPPER ================= */
.chat-wrapper {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  overflow: hidden;
}

/* ================= WELCOME ================= */
.welcome-card {
  margin: 12px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.08);
  text-align: center;
}

.welcome-card h1 {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.welcome-card p {
  font-size: 0.95rem;
  color: #cbd5f5;
}

.quick-prompts {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.quick-prompts button {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-prompts button:hover {
  background: rgba(56,189,248,0.18);
  border-color: #38bdf8;
}

/* ================= CHAT MESSAGES ================= */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ================= MESSAGES ================= */
.message {
  max-width: 82%;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user {
  margin-left: auto;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #020617;
  border-bottom-right-radius: 6px;
}

.message.ai {
  background: rgba(255,255,255,0.08);
  border-bottom-left-radius: 6px;
}

/* ================= DESKTOP INPUT ================= */
.chat-input {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(2,6,23,0.96);
  align-items: flex-end; /* stops stretching */
}

.chat-input textarea {
  flex: 1;
  resize: none;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
  color: #e5e7eb;
  font-size: 1rem;
  outline: none;
}

.chat-input button {
  height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

/* ================= MOBILE INPUT ================= */
.input-modal {
  display: none;
}

@media (max-width: 600px) {
  .chat-input {
    display: none;
  }

  .input-modal {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: rgba(2,6,23,0.97);
    border-top: 1px solid rgba(255,255,255,0.08);
    align-items: flex-end;
    position: sticky;
    bottom: 0;
    z-index: 300;
  }

  .input-modal textarea {
    flex: 1;
    min-height: 48px;
    max-height: 160px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.06);
    color: #e5e7eb;
    resize: none;
    outline: none;
    touch-action: manipulation;
  }

  .input-modal button {
    min-width: 48px;
    height: 48px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
  }

  .input-modal button svg {
    width: 20px;
    height: 20px;
    fill: #020617;
    pointer-events: none; /* 🔥 FIX: ensures button click works */
  }

  footer {
    display: none;
  }
}

/* ================= FOOTER ================= */
footer {
  text-align: center;
  font-size: 0.75rem;
  padding: 8px;
  color: #94a3b8;
}

/* ================= DESKTOP SCROLLBAR (THEMED & SMOOTH) ================= */
@media (hover: hover) and (pointer: fine) {

  .chat-messages::-webkit-scrollbar {
    width: 12px;
  }

  .chat-messages::-webkit-scrollbar-track {
    background: rgba(2,6,23,0.8);
    border-radius: 12px;
  }

  .chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(
      180deg,
      rgba(56,189,248,0.9),
      rgba(14,165,233,0.9)
    );
    border-radius: 12px;
    border: 3px solid rgba(2,6,23,0.8);
  }

  .chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
      180deg,
      rgba(125,211,252,1),
      rgba(56,189,248,1)
    );
  }

  /* Firefox */
  .chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #38bdf8 rgba(2,6,23,0.8);
  }
}

