/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #a78bfa;
  --primary-dark: #7c3aed;
  --accent: #38bdf8;
  --accent2: #f472b6;

  /* Dark theme colors */
  --bg-deep:    #0f0c29;
  --bg-mid:     #1a1040;
  --bg-card:    rgba(255,255,255,0.06);
  --bg-input:   rgba(255,255,255,0.08);
  --glass-border: rgba(255,255,255,0.12);

  --user-bubble-bg: linear-gradient(135deg, #7c3aed, #a855f7);
  --bot-bubble-bg:  rgba(255,255,255,0.08);

  --text-main:  #e2e8f0;
  --text-soft:  rgba(255,255,255,0.55);
  --text-white: #ffffff;

  --shadow-glow: 0 0 40px rgba(124,58,237,0.35);
  --shadow-card: 0 25px 60px rgba(0,0,0,0.5);
  --radius: 24px;
  --radius-sm: 14px;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

/* ===== ANIMATED MESH BACKGROUND ===== */
.bg-animation {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.25;
  animation: floatBubble linear infinite;
}

.bubble:nth-child(1) {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #7c3aed, transparent);
  left: -5%; top: -10%;
  animation-duration: 20s;
  animation-delay: 0s;
}
.bubble:nth-child(2) {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #38bdf8, transparent);
  right: -5%; top: 20%;
  animation-duration: 25s;
  animation-delay: -5s;
}
.bubble:nth-child(3) {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #f472b6, transparent);
  left: 30%; bottom: -15%;
  animation-duration: 30s;
  animation-delay: -10s;
}
.bubble:nth-child(4) {
  width: 200px; height: 200px;
  background: radial-gradient(circle, #818cf8, transparent);
  left: 60%; top: 10%;
  animation-duration: 18s;
  animation-delay: -3s;
}
.bubble:nth-child(5) {
  width: 250px; height: 250px;
  background: radial-gradient(circle, #34d399, transparent);
  left: 10%; bottom: 20%;
  animation-duration: 22s;
  animation-delay: -8s;
}

@keyframes floatBubble {
  0%   { transform: translate(0px, 0px) scale(1); }
  25%  { transform: translate(30px, -40px) scale(1.05); }
  50%  { transform: translate(-20px, 30px) scale(0.95); }
  75%  { transform: translate(40px, 20px) scale(1.08); }
  100% { transform: translate(0px, 0px) scale(1); }
}

/* Star particles */
.bg-animation::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 25% 45%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 20%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 30%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 75%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 15% 70%, rgba(255,255,255,0.3) 0%, transparent 100%);
}

/* ===== CHAT WRAPPER (Glassmorphism Card) ===== */
.chat-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: rgba(15, 10, 40, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: calc(100vh - 32px);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(50px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== HEADER ===== */
.chat-header {
  background: linear-gradient(135deg, rgba(124,58,237,0.8), rgba(168,85,247,0.6));
  backdrop-filter: blur(10px);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-avatar {
  width: 46px;
  height: 46px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-white);
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(167,139,250,0.5);
}

.header-info h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-white);
  margin: 0;
  letter-spacing: 0.3px;
}

.status {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 8px #4ade80; }
  50%       { transform: scale(1.3); box-shadow: 0 0 14px #4ade80; }
}

.icon-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text-white);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
  transform: rotate(5deg);
}

/* ===== CHAT BOX ===== */
#chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: transparent;
  min-height: 300px;
  max-height: 400px;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
#chat-box::-webkit-scrollbar { width: 4px; }
#chat-box::-webkit-scrollbar-track { background: transparent; }
#chat-box::-webkit-scrollbar-thumb {
  background: rgba(167,139,250,0.4);
  border-radius: 4px;
}

/* ===== MESSAGE BUBBLES ===== */
.bot-msg-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  animation: fadeInLeft 0.35s ease;
}

.user-msg-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  animation: fadeInRight 0.35s ease;
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: translateX(0); }
}

.bot-avatar-sm {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-white);
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 0 12px rgba(167,139,250,0.4);
}

.bot-bubble {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-main);
  padding: 11px 15px;
  border-radius: 4px 18px 18px 18px;
  max-width: 80%;
  font-size: 13.5px;
  line-height: 1.55;
}

.user-bubble {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: var(--text-white);
  padding: 11px 15px;
  border-radius: 18px 18px 4px 18px;
  max-width: 80%;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
}

.time {
  font-size: 10px;
  color: var(--text-soft);
  margin-top: 4px;
  padding: 0 4px;
}

/* ===== TYPING INDICATOR ===== */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 13px 18px;
}

.typing-bubble span {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: typingDot 1.2s infinite;
  box-shadow: 0 0 8px rgba(167,139,250,0.6);
}

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

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.4; }
  30%            { transform: translateY(-7px); opacity: 1; }
}

/* ===== WELCOME MESSAGE ===== */
.welcome-msg .bot-bubble {
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(56,189,248,0.15));
  border-color: rgba(167,139,250,0.35);
}

/* ===== SUGGESTIONS ===== */
.suggestions {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
  scrollbar-width: none;
}

.suggestions::-webkit-scrollbar { display: none; }

.suggestion-chip {
  background: rgba(167,139,250,0.12);
  border: 1px solid rgba(167,139,250,0.35);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Poppins', sans-serif;
  transition: all 0.25s;
}

.suggestion-chip:hover {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: var(--text-white);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(124,58,237,0.45);
}

/* ===== INPUT AREA ===== */
.chat-input-area {
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.07);
  border-radius: 50px;
  padding: 6px 6px 6px 18px;
  border: 1.5px solid rgba(255,255,255,0.12);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.input-wrapper:focus-within {
  border-color: rgba(167,139,250,0.6);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2), 0 0 20px rgba(124,58,237,0.15);
  background: rgba(255,255,255,0.1);
}

#user-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  color: var(--text-main);
  outline: none;
  min-width: 0;
}

#user-input::placeholder {
  color: var(--text-soft);
}

.send-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: var(--text-white);
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(124,58,237,0.5);
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.12) rotate(-5deg);
  box-shadow: 0 6px 20px rgba(124,58,237,0.7);
}

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

/* ===== FEEDBACK SECTION ===== */
#feedback-section {
  text-align: center;
  padding: 12px 16px 16px;
  background: rgba(255,255,255,0.02);
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

#feedback-section p {
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 8px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

#feedback-section p i {
  color: #fbbf24;
  margin-right: 4px;
  filter: drop-shadow(0 0 4px #fbbf24);
}

.stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.star {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  transition: all 0.25s;
  color: var(--text-main);
}

.star:hover {
  transform: translateY(-3px) scale(1.08);
  border-color: #fbbf24;
  background: rgba(251,191,36,0.12);
  box-shadow: 0 6px 16px rgba(251,191,36,0.25);
}

/* ===== DIVIDER ===== */
.chat-divider {
  text-align: center;
  font-size: 10px;
  color: var(--text-soft);
  margin: 4px 0;
  position: relative;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  body {
    padding: 0;
    align-items: flex-end;
  }

  .chat-wrapper {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 96vh;
    animation: slideUpMobile 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  @keyframes slideUpMobile {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  #chat-box {
    max-height: 50vh;
  }

  .bot-bubble, .user-bubble {
    max-width: 90%;
    font-size: 13px;
  }

  .chat-header {
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 14px 16px;
  }

  .star { font-size: 11px; padding: 4px 8px; }
}

@media (max-width: 375px) {
  .header-info h2 { font-size: 13px; }
  .suggestion-chip { font-size: 11px; padding: 5px 11px; }
  #chat-box { max-height: 44vh; }
}

@media (min-width: 768px) {
  .chat-wrapper { max-height: 720px; }
  #chat-box { max-height: 400px; }
}
