/* ═══════════════════════════════════════════════════════════════════
   AKRENIX AI ASSISTANT CHATBOT WIDGET STYLES (2026)
   ═══════════════════════════════════════════════════════════════════ */

/* Floating Launcher Trigger */
.ak-chat-launcher {
  position: fixed;
  bottom: max(20px, calc(12px + env(safe-area-inset-bottom)));
  right: max(16px, calc(12px + env(safe-area-inset-right)));
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  touch-action: manipulation;
}

.ak-chat-badge-teaser {
  background: #071731;
  color: #FFFFFF;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(7, 23, 49, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(212, 152, 38, 0.4);
  cursor: pointer;
  animation: floatTeaser 3s ease-in-out infinite;
  white-space: nowrap;
  touch-action: manipulation;
}

.ak-chat-badge-teaser span.highlight {
  color: #F59E0B;
}

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

.ak-chat-trigger-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #071731 0%, #17386D 100%);
  border: 2px solid #F59E0B;
  box-shadow: 0 12px 28px rgba(7, 23, 49, 0.35);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ak-chat-trigger-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 16px 36px rgba(7, 23, 49, 0.45);
}

.ak-chat-trigger-btn .online-ping {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #10B981;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
}

/* Chat Window Container */
.ak-chat-window {
  position: fixed;
  bottom: max(88px, calc(78px + env(safe-area-inset-bottom)));
  right: max(16px, calc(12px + env(safe-area-inset-right)));
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: min(580px, calc(100dvh - 120px));
  background: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(7, 23, 49, 0.3), 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ak-chat-window.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */
.ak-chat-header {
  background: linear-gradient(135deg, #071731 0%, #102A54 100%);
  color: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #F59E0B;
  flex-shrink: 0;
}

.ak-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ak-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #071731;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  position: relative;
}

.ak-chat-header-text h3 {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ak-chat-header-text p {
  font-size: 11.5px;
  color: #A5B4FC;
  margin: 2px 0 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ak-chat-header-text .status-dot {
  width: 7px;
  height: 7px;
  background: #10B981;
  border-radius: 50%;
  display: inline-block;
}

.ak-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ak-chat-header-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ak-chat-header-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Chat Body (Message stream) */
.ak-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F8FAFC;
  scroll-behavior: smooth;
}

.ak-chat-body::-webkit-scrollbar {
  width: 5px;
}

.ak-chat-body::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 5px;
}

/* Messages */
.ak-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: fadeInMsg 0.2s ease-out;
}

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

.ak-msg.bot {
  align-self: flex-start;
}

.ak-msg.user {
  align-self: flex-end;
}

.ak-msg-bubble {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  word-break: break-word;
}

.ak-msg.bot .ak-msg-bubble {
  background: #FFFFFF;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  border-top-left-radius: 4px;
}

.ak-msg.user .ak-msg-bubble {
  background: linear-gradient(135deg, #071731 0%, #1E3A8A 100%);
  color: #FFFFFF;
  border-top-right-radius: 4px;
}

.ak-msg-bubble strong {
  color: #071731;
}

.ak-msg.user .ak-msg-bubble strong {
  color: #FDE047;
}

.ak-msg-time {
  font-size: 10.5px;
  color: #94A3B8;
  margin-top: 4px;
  padding: 0 4px;
}

.ak-msg.user .ak-msg-time {
  text-align: right;
}

/* WhatsApp CTA inside message */
.ak-wa-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25D366;
  color: #FFFFFF !important;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  margin-top: 8px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
  transition: all 0.2s ease;
}

.ak-wa-cta-btn:hover {
  background: #1EBE5D;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

.ak-syllabus-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #071731;
  color: #FFFFFF !important;
  font-weight: 700;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 8px;
  margin-top: 6px;
  cursor: pointer;
  border: none;
}

/* Suggested Question Chips */
.ak-chat-chips-area {
  padding: 8px 14px 10px 14px;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  flex-shrink: 0;
}

.ak-chat-chips-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748B;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ak-chips-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.ak-chips-scroll::-webkit-scrollbar {
  height: 3px;
}

.ak-chip {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #1E293B;
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.ak-chip:hover {
  background: #071731;
  color: #FFFFFF;
  border-color: #071731;
  transform: translateY(-1px);
}

.ak-chip.gold-chip {
  background: #FEF3C7;
  border-color: #F59E0B;
  color: #92400E;
  font-weight: 700;
}

/* Typing Indicator */
.ak-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  width: fit-content;
  border-top-left-radius: 4px;
}

.ak-typing-dot {
  width: 6px;
  height: 6px;
  background: #94A3B8;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.ak-typing-dot:nth-child(1) { animation-delay: 0s; }
.ak-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ak-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); background: #2563EB; }
}

/* Footer Input Area */
.ak-chat-footer {
  padding: 10px 14px;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ak-chat-input {
  flex: 1;
  border: 1.5px solid #CBD5E1;
  border-radius: 99px;
  padding: 10px 16px;
  font-size: 16px; /* Crucial: 16px prevents iOS Safari automatic zoom-in */
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #F8FAFC;
}

.ak-chat-input:focus {
  border-color: #2563EB;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ak-chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #071731;
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ak-chat-send-btn:hover {
  background: #2563EB;
  transform: scale(1.05);
}

@media (max-width: 480px) {
  .ak-chat-badge-teaser {
    display: none !important; /* Hide wide teaser on small screens to prevent covering content */
  }

  .ak-chat-launcher {
    bottom: max(16px, calc(10px + env(safe-area-inset-bottom)));
    right: max(14px, calc(10px + env(safe-area-inset-right)));
    z-index: 9998;
    pointer-events: auto;
  }

  .ak-chat-trigger-btn {
    width: 54px;
    height: 54px;
  }

  .ak-chat-window {
    left: 8px;
    right: 8px;
    bottom: max(76px, calc(66px + env(safe-area-inset-bottom)));
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    height: min(520px, calc(100dvh - 84px));
    max-height: calc(100dvh - 84px);
    border-radius: 16px;
  }

  .ak-chat-header {
    padding: 12px 16px;
  }

  .ak-chat-body {
    padding: 12px;
  }

  .ak-chat-input {
    font-size: 16px;
    padding: 9px 14px;
  }

  .ak-chat-send-btn {
    width: 40px;
    height: 40px;
  }
}
