/* ===================================
   AI MASHINANI CHATBOT STYLES
   Kenyan Flag Theme Integration
   Modern, Professional Design
   =================================== */

/* Modern chatbot with Kenyan flag colors */
.chatbot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  left: auto;
  width: 400px;
  max-width: 90%;
  background-color: var(--color-white);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 0 1px rgba(0, 0, 0, 0.12);
  transform: scale(0);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
  overflow: hidden;
  border: none;
  display: flex;
  flex-direction: column;
  height: 600px;
}

.chatbot.open {
  transform: scale(1);
  animation: chatbotEntrance 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header with Kenyan green background */
.chatbot-header {
  background: linear-gradient(135deg, #005500 0%, #006600 100%);
  color: var(--color-white);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}

.chatbot-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
  pointer-events: none;
}

.chatbot-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-family: var(--font-heading);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
  letter-spacing: 0.3px;
}

.chatbot-header h3::before {
  content: "💬";
  font-size: 1.3rem;
}

/* Online status badge on header - DISABLED */
.chatbot-header::after {
  display: none;
}

/* Enhanced close button with Kenyan colors */
.chatbot-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--color-white);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  z-index: 10;
  font-weight: bold;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.1);
}

.chatbot-close:active {
  transform: scale(0.95);
}

/* Body with clean minimal background */
.chatbot-body {
  padding: 0;
  flex: 1;
  overflow: hidden;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Custom scrollbar with Kenyan green */
.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 102, 0, 0.3);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 102, 0, 0.5);
}

.chatbot-message {
  padding: 12px 16px;
  border-radius: 16px;
  max-width: 80%;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 0.95rem;
  position: relative;
  animation: messageSlide 0.3s ease-out;
  box-shadow: none;
  border: none;
}

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

/* User messages with Kenyan green */
.chatbot-message.user {
  background: #006600;
  color: var(--color-white);
  align-self: flex-end;
  border-radius: 16px 16px 4px 16px;
  font-weight: 500;
}

/* Bot messages with clean white background */
.chatbot-message.bot {
  background: var(--color-white);
  color: var(--color-text);
  align-self: flex-start;
  border-radius: 16px 16px 16px 4px;
  border: 1px solid #e0e0e0;
}

/* Remove green accent bar from bot messages */
.chatbot-message.bot::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0px;
  background: transparent;
  border-radius: 18px 0 0 18px;
}

/* Input section - modern clean design */
.chatbot-input {
  display: flex;
  padding: 16px 24px;
  border-top: 1px solid #e8e8e8;
  background: var(--color-white);
  gap: 12px;
  flex-shrink: 0;
}

.chatbot-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  outline: none;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  background: #f5f5f5;
  color: var(--color-text);
  font-family: var(--font-base);
}

.chatbot-input input:focus {
  border-color: #006600;
  background: var(--color-white);
  box-shadow: 0 0 0 3px rgba(0, 102, 0, 0.08);
}

.chatbot-input input::placeholder {
  color: #999;
  font-size: 0.9rem;
}

/* Send button - modern green design */
.chatbot-input button {
  background: #006600;
  color: var(--color-white);
  border: none;
  padding: 12px 20px;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  font-size: 1rem;
  min-width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 102, 0, 0.15);
  flex-shrink: 0;
}

.chatbot-input button:hover {
  background: #005500;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 0, 0.25);
}

.chatbot-input button:active {
  transform: translateY(0);
}

/* Toggle button with Kenyan flag gradient */
.chatbot-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  left: auto;
  background: var(--color-primary);
  color: var(--color-white);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 102, 0, 0.3);
  z-index: 9998;
  transition: all 0.3s ease;
  border: none;
  overflow: hidden;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(0, 102, 0, 0.4);
}

.chatbot-toggle:active {
  transform: scale(0.95);
}

/* Typing indicator with Kenyan colors */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--color-white);
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  align-self: flex-start;
  margin: 5px 0;
  box-shadow: none;
  position: relative;
}

.typing-indicator::before {
  content: "";
  display: none;
}

/* Remove accent bar from typing indicator */
.typing-indicator::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0px;
  background: transparent;
  border-radius: 18px 0 0 18px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #006600;
  animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
  background: #006600;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
  background: #006600;
}

@keyframes typingAnimation {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* Welcome message with modern clean design */
.chatbot-welcome {
  background: linear-gradient(135deg, rgba(0, 102, 0, 0.08) 0%, rgba(0, 102, 0, 0.04) 100%);
  border: 1px solid rgba(0, 102, 0, 0.2);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 8px;
  text-align: left;
}

.chatbot-welcome h4 {
  color: #333;
  margin: 0 0 8px 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.chatbot-welcome p {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

/* Quick action buttons with Kenyan colors */
.chatbot-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-action-btn {
  background: var(--color-white);
  border: 1.5px solid #e0e0e0;
  color: #333;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.quick-action-btn:hover {
  background: #f0f9f0;
  border-color: #006600;
  color: #006600;
  transform: translateY(-1px);
}

/* Link styling in messages */
.chatbot-message a {
  color: var(--color-secondary);
  text-decoration: underline;
  font-weight: 500;
  transition: color 0.2s ease;
}

.chatbot-message.user a {
  color: var(--color-white);
  text-decoration: underline;
}

.chatbot-message a:hover {
  color: var(--color-secondary-dark);
}

/* Loading state with Kenyan colors */
.chatbot-loading {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  background: var(--color-white);
  border-radius: 18px;
  align-self: flex-start;
  border: 1px solid rgba(0, 102, 0, 0.15);
}

.loading-bar {
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border-radius: 2px;
  animation: loadingAnimation 1s infinite ease-in-out;
}

.loading-bar:nth-child(2) {
  animation-delay: 0.1s;
}

.loading-bar:nth-child(3) {
  animation-delay: 0.2s;
}

@keyframes loadingAnimation {
  0%, 100% {
    transform: scaleY(0.5);
    opacity: 0.5;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* Error message styling */
.chatbot-error {
  background: rgba(187, 0, 0, 0.08);
  border: 1px solid rgba(187, 0, 0, 0.3);
  color: #c33;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatbot-error::before {
  content: "⚠️";
  font-size: 1rem;
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
  .chatbot {
    width: 100%;
    height: 85vh;
    max-width: none;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
  }

  .chatbot.open {
    animation: chatbotMobileEntrance 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .chatbot-toggle {
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
  }

  .chatbot-header {
    padding: 16px 20px;
  }

  .chatbot-header h3 {
    font-size: 1.1rem;
  }

  .chatbot-header::after {
    right: 20px;
    font-size: 0.7rem;
    padding: 5px 10px;
  }

  .chatbot-body {
    flex: 1;
  }

  .chatbot-messages {
    padding: 16px 20px;
    gap: 12px;
  }

  .chatbot-message {
    font-size: 0.9rem;
    max-width: 85%;
  }

  .chatbot-input {
    padding: 12px 16px;
    gap: 10px;
  }

  .chatbot-input input {
    padding: 10px 14px;
    font-size: 1rem;
  }

  .chatbot-input button {
    padding: 10px 18px;
  }
}

@media (max-width: 480px) {
  .chatbot {
    height: 90vh;
  }

  .chatbot-messages {
    padding: 16px 16px;
  }

  .chatbot-message {
    max-width: 90%;
    font-size: 0.88rem;
  }

  .chatbot-header h3 {
    font-size: 1rem;
  }

  .chatbot-input input::placeholder {
    font-size: 0.85rem;
  }
}

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

/* Smooth entrance animation */
@keyframes chatbotEntrance {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Pulse animation for new messages */
@keyframes messagePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 102, 0, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 102, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 102, 0, 0);
  }
}

.chatbot-message.new {
  animation: messageSlide 0.3s ease-out, messagePulse 0.8s ease-out 0.3s;
}

/* Accessibility improvements */
.chatbot-close:focus,
.chatbot-input button:focus,
.quick-action-btn:focus {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .chatbot {
    border: 2px solid var(--color-accent);
  }

  .chatbot-message.user {
    border: 2px solid var(--color-white);
  }

  .chatbot-message.bot {
    border: 2px solid var(--color-secondary);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .chatbot,
  .chatbot-message,
  .typing-dot,
  .loading-bar,
  .chatbot-toggle {
    animation: none !important;
    transition: none !important;
  }
}


        .hero-chatbot-messages {
            height: 100%;
            overflow-y: auto;
            padding: 24px;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .hero-chatbot-messages::-webkit-scrollbar {
            width: 6px;
        }

        .hero-chatbot-messages::-webkit-scrollbar-track {
            background: transparent;
        }

        .hero-chatbot-messages::-webkit-scrollbar-thumb {
            background: #cbd5e0;
            border-radius: 3px;
        }

        .hero-chatbot-messages::-webkit-scrollbar-thumb:hover {
            background: #a0aec0;
        }

        .chatbot-message {
            max-width: 80%;
            padding: 14px 18px;
            border-radius: 18px;
            font-size: 15px;
            line-height: 1.5;
            word-wrap: break-word;
            animation: slideIn 0.3s ease-out;
        }

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

        .chatbot-message.bot {
            align-self: flex-start;
            background: white;
            color: #2d3748;
            border-bottom-left-radius: 4px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        }

        .chatbot-message.user {
            align-self: flex-end;
            background: linear-gradient(135deg, #006600 0%, #00AA00 100%);
            color: white;
            border-bottom-right-radius: 4px;
            box-shadow: 0 2px 8px rgba(0, 102, 0, 0.3);
        }

        .hero-chatbot-input {
            padding: 20px;
            background: white;
            border-top: 1px solid #e2e8f0;
            display: flex;
            gap: 12px;
            align-items: center;
        }

        .hero-chatbot-input input {
            flex: 1;
            padding: 14px 18px;
            border: 2px solid #e2e8f0;
            border-radius: 12px;
            font-size: 15px;
            outline: none;
            transition: all 0.2s ease;
            font-family: inherit;
        }

        .hero-chatbot-input input:focus {
            border-color: #006600;
            box-shadow: 0 0 0 3px rgba(0, 102, 0, 0.1);
        }

        .hero-chatbot-input input::placeholder {
            color: #a0aec0;
        }

        .hero-chatbot-input button {
            padding: 14px 18px;
            background: linear-gradient(135deg, #BB0000 0%, #000000 100%);
            color: white;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 52px;
        }

        .hero-chatbot-input button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(187, 0, 0, 0.4);
        }

        .hero-chatbot-input button:active {
            transform: translateY(0);
        }

        .hero-chatbot-input button i {
            font-size: 18px;
        }

        .typing-indicator {
            align-self: flex-start;
            background: white;
            padding: 14px 18px;
            border-radius: 18px;
            border-bottom-left-radius: 4px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
            display: flex;
            gap: 4px;
            align-items: center;
        }

        .typing-indicator span {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #cbd5e0;
            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);
                background: #cbd5e0;
            }
            30% {
                transform: translateY(-8px);
                background: #006600;
            }
        }

        @media (max-width: 640px) {
            .hero-chatbot {
                height: 500px;
                border-radius: 20px;
            }

            .chatbot-message {
                max-width: 85%;
                font-size: 14px;
            }

            .hero-chatbot-header {
                padding: 20px;
            }

            .hero-chatbot-header h4 {
                font-size: 18px;
            }

            .hero-chatbot-messages {
                padding: 16px;
            }
        }
