/* Chat Widget Styles - Animated Right-Side Panel */

.chat-widget-overlay {
  position: fixed;
  right: 0;
  top: 80px;
  width: 380px;
  max-height: calc(100vh - 100px);
  min-height: 320px;
  background: #f8fafc;
  border-left: 1px solid #e2e8f0;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.08);
  z-index: 999;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: height 0.3s ease;
}

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

/* Header */
.chat-widget-header {
  padding: 1.25rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.chat-widget-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.chat-widget-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  flex: 1;
}

.chat-widget-close-btn {
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: color 0.2s;
  flex-shrink: 0;
  padding: 0;
}

.chat-widget-close-btn:hover {
  color: #1f2937;
}

.chat-widget-close-btn svg {
  width: 18px;
  height: 18px;
}

.chat-widget-logo {
  height: 28px;
  width: auto;
}

/* Messages Container */
.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-widget-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #64748b;
  padding: 1rem;
}

.chat-widget-empty-heading {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.5;
  margin: 0 0 1.5rem 0;
}

.chat-widget-animated-questions {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-widget-example-question {
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.4;
  margin: 0;
  animation: fadeInOut 0.6s ease-in-out;
  max-width: 100%;
  word-wrap: break-word;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  10% {
    opacity: 1;
    transform: translateY(0);
  }
  90% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* Message Rows */
.chat-widget-msg-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-widget-msg-row.user {
  flex-direction: row-reverse;
}

.chat-widget-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
}

.chat-widget-avatar.ai {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.chat-widget-avatar.ai img {
  height: 18px;
  width: auto;
}

.chat-widget-avatar.user {
  background: #3b82f6;
  color: #fff;
}

.chat-widget-bubble {
  max-width: 75%;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.chat-widget-msg-row.ai .chat-widget-bubble {
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  border-top-left-radius: 4px;
}

.chat-widget-msg-row.user .chat-widget-bubble {
  background: #3b82f6;
  color: #fff;
  border-top-right-radius: 4px;
}

.chat-widget-bubble p {
  margin-bottom: 0.4rem;
  margin: 0;
}

.chat-widget-bubble p:last-child {
  margin-bottom: 0;
}

.chat-widget-bubble strong {
  font-weight: 600;
}

/* Typing Indicator */
.chat-widget-typing {
  display: flex;
  gap: 3px;
  align-items: center;
  padding: 0.6rem 0.9rem;
}

.chat-widget-typing span {
  width: 5px;
  height: 5px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

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

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

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

/* Input Area */
.chat-widget-input-area {
  flex-shrink: 0;
  padding: 0.75rem;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}

.chat-widget-input-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-widget-textarea-wrap {
  flex: 1;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 0.5rem 0.7rem;
  transition: border-color 0.2s;
}

.chat-widget-textarea-wrap:focus-within {
  border-color: #3b82f6;
  background: #fff;
}

.chat-widget-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  color: #0f172a;
  resize: none;
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
  padding: 0;
}

.chat-widget-input::placeholder {
  color: #94a3b8;
}

.chat-widget-send-btn {
  width: 36px;
  height: 36px;
  background: #3b82f6;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.chat-widget-send-btn:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-1px);
}

.chat-widget-send-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
}

.chat-widget-send-btn svg {
  color: #fff;
  width: 16px;
  height: 16px;
}

.chat-widget-disclaimer {
  font-size: 0.65rem;
  color: #94a3b8;
  text-align: center;
  margin-top: 0.4rem;
  padding: 0 0.5rem;
}

.chat-widget-disclaimer a {
  color: #3b82f6;
  text-decoration: none;
}

/* Error Message */
.chat-widget-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0.25rem;
}

.chat-widget-error svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Scrollbar Styling */
.chat-widget-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-widget-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chat-widget-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Bot Character (when chat collapsed) */
.chat-bot-character {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 998;
  animation: botPopIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes botPopIn {
  from {
    opacity: 0;
    transform: scale(0) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.chat-bot-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.chat-bot-avatar {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-bot-btn:hover .chat-bot-avatar {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.chat-bot-avatar svg {
  width: 32px;
  height: 32px;
  animation: botWave 0.6s ease-in-out infinite;
}

@keyframes botWave {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(15deg);
  }
  75% {
    transform: rotate(-15deg);
  }
}

.chat-bot-greeting {
  text-align: center;
  max-width: 140px;
  pointer-events: none;
}

.chat-bot-wave {
  font-size: 1.5rem;
  margin: 0 0 0.25rem 0;
  animation: waveBounce 0.6s ease-in-out infinite;
}

@keyframes waveBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.chat-bot-text {
  font-size: 0.8rem;
  color: #374151;
  margin: 0;
  line-height: 1.3;
  background: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive: Hide on Mobile */
@media (max-width: 768px) {
  .chat-widget-overlay {
    display: none !important;
  }

  .chat-bot-character {
    display: none !important;
  }
}

/* Responsive: Adjust for Smaller Desktops */
@media (max-width: 1024px) {
  .chat-widget-overlay {
    width: 380px;
  }

  .chat-widget-bubble {
    max-width: 85%;
  }
}
