/* ==========================================
   ACTEEK Premium Chatbot Stylesheet
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700;800&display=swap');


/* FAB Button Container */
.act-chatbot-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 15px var(--c-accent-glow);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.act-chatbot-fab:not(.active) {
  animation: act-heartbeat 4s ease-in-out infinite;
}

.act-chatbot-fab:hover {
  animation: none !important;
  transform: scale(1.1) rotate(5deg);
  border-color: var(--c-accent);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(74, 244, 255, 0.4);
}

@keyframes act-heartbeat {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 15px var(--c-accent-glow);
  }
  15% {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 25px rgba(74, 244, 255, 0.5);
  }
  30% {
    transform: scale(1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 15px var(--c-accent-glow);
  }
  45% {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 25px rgba(74, 244, 255, 0.5);
  }
  60% {
    transform: scale(1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 15px var(--c-accent-glow);
  }
}

.act-chatbot-fab img {
  width: 75%;
  height: 75%;
  object-fit: contain;
  border-radius: 50%;
  transition: transform 0.3s;
}

.act-chatbot-fab.active img {
  transform: scale(0) rotate(90deg);
}

.act-chatbot-fab .act-close-icon {
  position: absolute;
  font-size: 20px;
  color: var(--c-accent);
  opacity: 0;
  transform: scale(0) rotate(-90deg);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.act-chatbot-fab.active .act-close-icon {
  opacity: 1;
  transform: scale(1) rotate(0);
}

/* Chatbot Window Container */
.act-chatbot-window {
  position: fixed;
  bottom: 105px;
  right: 30px;
  width: 400px;
  height: 580px;
  max-height: calc(100vh - 140px);
  max-width: calc(100vw - 60px);
  background: rgba(12, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(74, 244, 255, 0.05);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  overflow: hidden;
  
  /* Font Family Stack with Arabic fallback */
  font-family: 'Inter', 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.act-chatbot-window input,
.act-chatbot-window button,
.act-chatbot-window textarea,
.act-chatbot-window select {
  font-family: 'Inter', 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* RTL / Arabic specific overrides */
.act-chatbot-window[dir="rtl"],
.act-chatbot-window[dir="rtl"] input,
.act-chatbot-window[dir="rtl"] button,
.act-chatbot-window[dir="rtl"] textarea,
.act-chatbot-window[dir="rtl"] select {
  font-family: 'Cairo', 'Inter', sans-serif;
}


.act-chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header styling */
.act-chat-header {
  padding: 16px 20px;
  background: rgba(19, 23, 38, 0.9);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.act-chat-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--c-border);
}

.act-chat-title-group {
  display: flex;
  flex-direction: column;
}

.act-chat-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: 0.02em;
}

.act-chat-status {
  font-size: 11px;
  color: var(--c-text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.act-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: blink 2s infinite;
}

.act-chat-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.act-chat-clear {
  background: transparent;
  border: none;
  color: var(--c-text-dim);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.act-chat-clear:hover {
  color: #ef4444; /* Premium alert red on hover */
  transform: scale(1.1);
}

.act-chat-close {
  background: transparent;
  border: none;
  color: var(--c-text-dim);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.act-chat-close:hover {
  color: var(--c-accent-3);
  transform: scale(1.1);
}

/* Messages Area */
.act-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Custom Scrollbar for Chat Messages */
.act-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.act-chat-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.act-chat-messages::-webkit-scrollbar-thumb {
  background: var(--c-border-bright);
  border-radius: 10px;
  transition: background 0.2s;
}

.act-chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--c-accent);
}


/* Message Bubbles */
.act-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: message-fade 0.3s ease-out forwards;
}

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

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

.act-message.user {
  align-self: flex-end;
}

.act-message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.act-message.bot .act-message-bubble {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  border-top-left-radius: 4px;
}

.act-message.user .act-message-bubble {
  background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-accent-2) 100%);
  color: var(--c-on-accent);
  font-weight: 500;
  border-top-right-radius: 4px;
}

.act-message-time {
  font-size: 10px;
  color: var(--c-text-dim);
  margin-top: 4px;
  align-self: flex-start;
}

.act-message.user .act-message-time {
  align-self: flex-end;
}

/* Rich links and lists inside bot messages */
.act-message-bubble a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(74, 244, 255, 0.08);
  border: 1px solid rgba(74, 244, 255, 0.2);
  color: var(--c-accent) !important;
  text-decoration: none !important;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  margin: 4px 2px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-family: var(--font-display);
}

.act-message-bubble a:hover {
  background: var(--c-accent);
  color: var(--c-on-accent) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 244, 255, 0.25);
  border-color: transparent;
}

.act-message-bubble a::after {
  content: "\f08e"; /* FontAwesome arrow-up-right-from-square */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 10px;
}

.act-message.user .act-message-bubble a {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff !important;
}

.act-message.user .act-message-bubble a:hover {
  background: #ffffff;
  color: var(--c-on-accent) !important;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

/* Lists styling inside bot responses */
.act-message-bubble ul {
  margin: 10px 0;
  padding-left: 20px;
  list-style-type: none;
}

.act-message-bubble li {
  position: relative;
  margin-bottom: 8px;
  padding-left: 14px;
}

.act-message-bubble li::before {
  content: "•";
  color: var(--c-accent);
  font-weight: bold;
  font-size: 16px;
  position: absolute;
  left: 0;
  top: -2px;
}

.act-message.user .act-message-bubble li::before {
  color: #ffffff;
}


/* Suggestion Chips */
.act-chat-suggestions {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  scrollbar-width: none; /* Firefox */
}

.act-chat-suggestions::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.act-suggestion-chip {
  padding: 8px 14px;
  background: rgba(74, 244, 255, 0.04);
  border: 1px solid var(--c-border);
  color: var(--c-text-muted);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.act-suggestion-chip:hover {
  background: rgba(74, 244, 255, 0.08);
  border-color: var(--c-accent);
  color: var(--c-accent);
}

/* Typing Indicator */
.act-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  border-top-left-radius: 4px;
  width: fit-content;
  align-self: flex-start;
}

.act-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--c-text-dim);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.act-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.act-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input Area */
.act-chat-input-area {
  padding: 16px;
  background: rgba(19, 23, 38, 0.9);
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: 10px;
}

.act-chat-input {
  flex: 1;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s;
}

.act-chat-input:focus {
  border-color: var(--c-accent);
}

.act-chat-send {
  width: 44px;
  height: 44px;
  background: var(--c-accent);
  color: var(--c-on-accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.act-chat-send:hover {
  background: #6ffffb;
  color: #060810;
  box-shadow: 0 0 15px rgba(74, 244, 255, 0.4);
}

/* RTL Support for Arabic Pages */
[lang="ar"] .act-chatbot-window {
  left: 30px;
  right: auto;
  direction: rtl;
}

[lang="ar"] .act-chatbot-fab {
  left: 30px;
  right: auto;
}

[lang="ar"] .act-message.bot {
  align-self: flex-start;
}

[lang="ar"] .act-message.user {
  align-self: flex-end;
}

[lang="ar"] .act-message.bot .act-message-bubble {
  border-radius: 16px;
  border-top-right-radius: 4px;
}

[lang="ar"] .act-message.user .act-message-bubble {
  border-radius: 16px;
  border-top-left-radius: 4px;
}

[lang="ar"] .act-chat-header {
  flex-direction: row-reverse;
}

[lang="ar"] .act-chat-header-info {
  flex-direction: row-reverse;
  text-align: right;
}

[lang="ar"] .act-chat-status {
  flex-direction: row-reverse;
}

[lang="ar"] .act-message-bubble ul {
  margin: 8px 16px 0 0;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .act-chatbot-fab {
    bottom: 20px;
    right: 20px;
    width: 54px;
    height: 54px;
  }
  [lang="ar"] .act-chatbot-fab {
    left: 20px;
    right: auto;
  }
  .act-chatbot-window {
    bottom: 85px;
    right: 20px;
    width: calc(100vw - 40px);
    height: calc(100vh - 120px);
    max-height: 520px;
  }
  [lang="ar"] .act-chatbot-window {
    left: 20px;
    right: auto;
  }
}

/* Light Theme Overrides */
html[data-theme="light"] .act-chatbot-window {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--c-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12), 0 0 30px rgba(26, 111, 232, 0.05);
}

html[data-theme="light"] .act-chat-header {
  background: rgba(240, 245, 255, 0.9);
  border-bottom: 1px solid var(--c-border);
}

html[data-theme="light"] .act-chat-input-area {
  background: rgba(240, 245, 255, 0.9);
  border-top: 1px solid var(--c-border);
}

html[data-theme="light"] .act-chatbot-fab {
  background: var(--c-surface);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 15px rgba(26, 111, 232, 0.1);
}

html[data-theme="light"] .act-chatbot-fab:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 0 25px rgba(26, 111, 232, 0.2);
}

html[data-theme="light"] .act-chat-suggestions {
  border-top: 1px solid rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .act-suggestion-chip {
  background: rgba(26, 111, 232, 0.04);
}

html[data-theme="light"] .act-suggestion-chip:hover {
  background: rgba(26, 111, 232, 0.08);
}

/* Chatbot Rate Limit Warning Banner */
.act-chat-warning-banner {
  padding: 10px 16px;
  background: rgba(239, 68, 68, 0.14); /* Red warning tint */
  border-top: 1px solid rgba(239, 68, 68, 0.22);
  border-bottom: 1px solid rgba(239, 68, 68, 0.22);
  color: #f87171;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: warning-slide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-display);
}

@keyframes warning-slide {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

html[data-theme="light"] .act-chat-warning-banner {
  background: rgba(239, 68, 68, 0.07);
  border-color: rgba(239, 68, 68, 0.16);
  color: #dc2626;
}


