/* AI Chat Modal Styles - Mobile-first, responsive */

.chat-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chat-modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
}

.chat-modal-content {
  background: white;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Desktop: make it a modal instead of full-screen */
@media (min-width: 768px) {
  .chat-modal-content {
    width: 600px;
    max-width: 90%;
    height: 700px;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  }

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

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #003580 0%, #004ba0 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 3px solid #DA291C;
}

.chat-header-left h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.chat-subtitle {
  font-size: 0.875rem;
  opacity: 0.9;
  display: block;
  margin-top: 4px;
}

.chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s ease;
}

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

/* Usage Counter */
.chat-usage {
  background: #f8f9fa;
  padding: 12px 20px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 0.875rem;
  color: #666;
  flex-shrink: 0;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f5f7fa;
}

.chat-message {
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

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

.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
}

.user-message .message-content {
  background: #00205B;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.ai-message .message-content {
  background: white;
  color: #333;
  border: 1px solid #e0e0e0;
  border-bottom-left-radius: 4px;
}

.ai-message .message-content p {
  margin: 0 0 12px 0;
}

.ai-message .message-content p:last-child {
  margin-bottom: 0;
}

.ai-message .message-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.ai-message .message-content li {
  margin: 6px 0;
}

.system-message .message-content {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
  margin: 0 auto;
  text-align: center;
  font-size: 0.875rem;
}

.disclaimer {
  color: #666;
  font-size: 0.8rem;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e0e0e0;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  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% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-6px);
  }
}

/* Input Area */
.chat-input-container {
  background: white;
  padding: 16px 20px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

#chatInput {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  transition: border-color 0.2s ease;
}

#chatInput:focus {
  outline: none;
  border-color: #00205B;
}

#chatSendBtn {
  background: #DA291C;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

#chatSendBtn:hover {
  background: #B81F15;
}

#chatSendBtn:active {
  transform: scale(0.98);
}

/* Donation Prompt */
.chat-donation-prompt {
  margin: 20px 0;
  animation: fadeIn 0.5s ease;
}

.donation-content {
  background: linear-gradient(135deg, #fff9e6 0%, #fffcf2 100%);
  border: 2px solid #DA291C;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.donation-content h4 {
  margin: 0 0 12px 0;
  color: #00205B;
  font-size: 1.125rem;
}

.donation-content p {
  margin: 0 0 16px 0;
  color: #555;
  line-height: 1.5;
}

.donation-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-donate {
  background: #DA291C;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s ease;
  display: inline-block;
}

.btn-donate:hover {
  background: #B81F15;
}

.btn-dismiss {
  background: transparent;
  color: #666;
  border: 1px solid #ddd;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.btn-dismiss:hover {
  background: #f5f5f5;
  border-color: #999;
}

/* Ask AI Button (used inline on pages) */
.ask-ai-button {
  background: linear-gradient(135deg, #003580 0%, #004ba0 100%);
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 32, 91, 0.2);
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

.ask-ai-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 32, 91, 0.3);
}

.ask-ai-button:active {
  transform: translateY(0);
}

.ask-ai-section {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 24px;
  margin: 32px 0;
  text-align: center;
}

.ask-ai-section h3 {
  margin: 0 0 8px 0;
  color: #00205B;
  font-size: 1.25rem;
}

.ask-ai-section p {
  margin: 0 0 20px 0;
  color: #666;
  line-height: 1.5;
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .chat-input-container {
    padding: 12px 16px;
  }

  #chatInput {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .donation-actions {
    flex-direction: column;
  }

  .btn-donate,
  .btn-dismiss {
    width: 100%;
  }
}
