/* style.css (FINAL - All Features & Fixes + Mobile Header Tweak + Purple Credit Balance) */
body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: #0f0f1a;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}
#chat-container {
  max-width: 720px;
  width: 100%;
  margin: 20px;
  background: #1a1a2a;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  max-height: 90dvh;
  height: 90dvh;
}
#chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  position: relative;
  flex-shrink: 0;
}
#chat-header .expert-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}
.expert-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left: 10px;
}
.expert-info h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}
.expert-info p {
  margin: 3px 0 0;
  font-size: 13px;
  color: #bbb;
}
.chat-box {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px 20px 10px 10px;
  background: #151522;
  border-radius: 12px;
  margin-bottom: 12px;
}
.chat-box::-webkit-scrollbar {
  width: 8px;
}
.chat-box::-webkit-scrollbar-track {
  background: #151522;
}
.chat-box::-webkit-scrollbar-thumb {
  background-color: #4a5568;
  border-radius: 4px;
  border: 2px solid #151522;
}
.message-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}
.message-group.user {
  flex-direction: row-reverse;
}
.message-group img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  margin-top: 2px;
}
.bubble {
  background: #26263a;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
}
.message-group.user .bubble {
  background: #7b3fe4;
  color: #fff;
}
.feedback-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  border-top: 1px solid #3e3e5a;
  padding-top: 8px;
}
.feedback-btn {
  background: transparent;
  border: 1px solid #4a5568;
  color: #d1d5db;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}
.feedback-btn:hover {
  background: #4a5568;
  color: #fff;
}
.feedback-btn.liked,
.feedback-btn.disliked {
  color: #fff;
}
.feedback-btn.liked {
  background: #10b981;
  border-color: #10b981;
}
.feedback-btn.disliked {
  background: #ef4444;
  border-color: #ef4444;
}
.feedback-btn svg {
  width: 14px;
  height: 14px;
}
form#chat-form {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
#user-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  background: #2c2c3c;
  color: #fff;
  font-size: 15px;
}
#chat-form button {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  border: none;
  padding: 0 20px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
.menu-wrapper {
  position: relative;
  z-index: 20;
}
.menu-btn {
  background: none;
  color: #ccc;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 6px;
}
.menu-popup {
  position: absolute;
  top: 38px;
  right: 0;
  background: #2c2c3c;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 6px 0;
  z-index: 10;
  min-width: 150px;
}
.menu-popup button {
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.menu-popup button:hover {
  background: #3f3f5c;
}
.hidden {
  display: none;
}
.typing-indicator span {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  margin: 0 2px;
  animation: bounce 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}
.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* ✅ Updated Purple Credit Balance Style */
#credit-balance {
  background: #2e1f52;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #c084fc;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* Purple custom scrollbar */
.chat-box::-webkit-scrollbar {
  width: 8px;
}
.chat-box::-webkit-scrollbar-track {
  background: #1a1a2a;
}
.chat-box::-webkit-scrollbar-thumb {
  background-color: #7b3fe4;
  border-radius: 4px;
  border: 2px solid #1a1a2a;
}

.chat-box a {
  color: #8b5cf6;
  text-decoration: underline;
}
.chat-box a:hover {
  color: #c084fc;
}

/* ✅ Final alignment fix for Chat Now buttons */
.vv-bot-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
}
.vv-chat-now-link {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  text-align: center !important;
  margin-top: auto !important;
  padding-top: 16px;
}

@media (max-width: 768px) {
  .vv-experts-grid {
    flex-direction: column;
    align-items: center;
  }
}

/* ✅ Mobile Header Optimization */
@media (max-width: 480px) {
  #chat-header {
    gap: 8px;
    flex-wrap: wrap;
  }

  #chat-header .expert-avatar {
    width: 40px;
    height: 40px;
  }

  .expert-info h2 {
    font-size: 14px;
    margin-bottom: 2px;
  }

  .expert-info p {
    font-size: 11px;
    line-height: 1.2;
  }

  #credit-balance {
    font-size: 11px;
    padding: 4px 8px;
    gap: 4px;
    margin-top: 2px;
  }

  .expert-info {
    margin-left: 8px;
  }
}
