/* ============================================
   CHAT WIDGET STYLES - PURPLE & GOLD THEME
   ============================================ */

/* Chat Widget Container */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: var(--font-primary);
}

/* Chat Toggle Button */
.chat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(75, 0, 130, 0.3);
  transition: var(--transition);
  font-weight: 600;
  font-size: 0.95rem;
}

.chat-toggle:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(75, 0, 130, 0.4);
}

.chat-toggle svg {
  stroke: var(--white);
}

.chat-toggle-text {
  display: none;
}

@media (min-width: 768px) {
  .chat-toggle-text {
    display: inline;
  }
}

/* Chat Window */
.chat-window {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 350px;
  max-width: calc(100vw - 40px);
  height: 550px;
  max-height: calc(100vh - 100px);
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 10px 50px rgba(75, 0, 130, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-color);
}

.chat-window.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: var(--white);
  padding: 1rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--secondary);
}

.chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--white);
}

.chat-status {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #28a745;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-close {
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: var(--transition);
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--white-soft);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: fadeInUp 0.3s ease;
}

.chat-message.bot {
  align-self: flex-start;
}

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.chat-message.bot .message-content {
  background: var(--white);
  color: var(--gray-dark);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.chat-message.user .message-content {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message-content p {
  margin: 0;
}

.message-content ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.message-content li {
  margin-bottom: 0.3rem;
}

.message-content a {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 500;
}

.chat-message.user .message-content a {
  color: var(--secondary);
}

/* Quick Questions */
.chat-quick-questions {
  padding: 0.8rem 1rem;
  background: var(--white);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-question {
  padding: 6px 12px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.quick-question:hover {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* Chat Input */
.chat-input-container {
  padding: 1rem;
  background: var(--white);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 25px;
  font-size: 0.95rem;
  background: var(--white);
  color: var(--black);
  transition: var(--transition);
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(75, 0, 130, 0.1);
}

.chat-input::placeholder {
  color: var(--gray);
}

.chat-send {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(75, 0, 130, 0.3);
}

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

/* Chat Disclaimer */
.chat-disclaimer {
  padding: 0.8rem 1rem;
  background: var(--secondary-soft);
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--gray);
  line-height: 1.4;
}

.chat-disclaimer p {
  margin: 0;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  width: fit-content;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--gray);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Responsive Adjustments */
@media (max-width: 480px) {
  .chat-widget {
    bottom: 15px;
    right: 15px;
  }
  
  .chat-window {
    bottom: 70px;
    right: 15px;
    width: calc(100vw - 30px);
    height: 70vh;
  }
  
  .chat-toggle {
    padding: 12px 16px;
  }
  
  .chat-toggle-text {
    display: none;
  }
}

/* Accessibility */
.chat-toggle:focus,
.chat-close:focus,
.chat-send:focus,
.chat-input:focus,
.quick-question:focus {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .chat-window,
  .chat-toggle,
  .chat-send,
  .chat-message,
  .status-dot {
    transition: none;
    animation: none;
  }
}