/* ==========================================================================
   CYF QA — Floating Chatbot UI Styling
   Design System: Dark Mode / Glassmorphism / Cyberpunk Accents
   ========================================================================== */

/* Floating Trigger Button */
.cyf-chatbot-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.95));
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #f8fafc;
  padding: 12px 18px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(56, 189, 248, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.cyf-chatbot-trigger:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.5), 0 0 25px rgba(56, 189, 248, 0.4);
}

.cyf-chatbot-trigger-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.cyf-chatbot-logo-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
}

.cyf-chatbot-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background-color: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 8px #38bdf8;
  animation: cyf-pulse-anim 2s infinite;
}

@keyframes cyf-pulse-anim {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(56, 189, 248, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

/* Chat Panel Widget */
.cyf-chatbot-widget {
  position: fixed;
  bottom: 90px;
  right: 28px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  z-index: 9995;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(56, 189, 248, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cyf-chatbot-widget.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Widget Header */
.cyf-chat-header {
  padding: 16px 20px;
  background: rgba(30, 41, 59, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.cyf-avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
  flex-shrink: 0;
}

.cyf-chatbot-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cyf-chat-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
  line-height: 1.2;
}

.cyf-chat-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cyf-icon-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.cyf-icon-btn:hover, .cyf-icon-btn:active {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

/* Chat Messages Area */
.cyf-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar */
.cyf-chat-messages::-webkit-scrollbar {
  width: 5px;
}
.cyf-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.cyf-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.cyf-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.4);
}

/* Message Bubble */
.cyf-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  line-height: 1.5;
  font-size: 0.88rem;
  word-break: break-word;
}

.cyf-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

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

.cyf-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  margin-top: 2px;
}

.cyf-msg-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cyf-msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  color: #e2e8f0;
}

.cyf-msg.user .cyf-msg-bubble {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3);
}

.cyf-msg.bot .cyf-msg-bubble {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.cyf-msg-bubble p {
  margin: 0 0 8px 0;
}
.cyf-msg-bubble p:last-child {
  margin-bottom: 0;
}

.cyf-msg-bubble a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed rgba(56, 189, 248, 0.5);
  transition: all 0.2s;
}

.cyf-msg-bubble a:hover {
  color: #7dd3fc;
  border-bottom-style: solid;
}

.cyf-msg-bubble ul, .cyf-msg-bubble ol {
  margin: 6px 0;
  padding-left: 18px;
}

.cyf-msg-bubble li {
  margin-bottom: 4px;
}

.cyf-msg-bubble code {
  background: rgba(15, 23, 42, 0.8);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.82rem;
  color: #38bdf8;
}

/* Quick Suggestion Chips */
.cyf-chips-container {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(15, 23, 42, 0.6);
  -webkit-overflow-scrolling: touch;
}

.cyf-chips-container::-webkit-scrollbar {
  height: 3px;
}

.cyf-chip {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #cbd5e1;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  touch-action: manipulation;
}

.cyf-chip:hover, .cyf-chip:active {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.7);
}

/* Chat Input Footer */
.cyf-chat-input-area {
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cyf-chat-input {
  flex: 1;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 14px;
  color: #f8fafc;
  font-size: 16px; /* 16px prevents iOS browser auto-zoom */
  outline: none;
  transition: all 0.2s ease;
}

.cyf-chat-input:focus {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.cyf-chat-send-btn {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: none;
  color: #ffffff;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  touch-action: manipulation;
}

.cyf-chat-send-btn:hover, .cyf-chat-send-btn:active {
  background: linear-gradient(135deg, #0369a1, #075985);
  transform: scale(1.03);
}

/* Typing Indicator Animation */
.cyf-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.cyf-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  animation: cyf-typing-bounce 1.4s infinite ease-in-out both;
}

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

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

/* Mobile & Touch Responsive Adjustments */
@media (max-width: 768px) {
  .cyf-chatbot-trigger {
    bottom: 20px;
    right: 16px;
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  .cyf-chatbot-widget {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    height: 85dvh;
    max-height: 85dvh;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  .cyf-msg {
    max-width: 92%;
  }

  .cyf-chat-header {
    padding: 14px 16px;
  }
}

/* ==========================================================================
   MODE SPECIFIC THEMES (Normal / Creative / Desktop)
   ========================================================================== */

/* 1. Normal Mode (pro): Black sleek style with cream logo */
body[data-mode="pro"] .cyf-chatbot-trigger,
body:not([data-mode]) .cyf-chatbot-trigger {
  background: linear-gradient(135deg, rgba(10, 15, 26, 0.95), rgba(20, 28, 45, 0.98));
  border: 1px solid rgba(245, 240, 220, 0.4);
  color: #fdfbf7;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 18px rgba(245, 240, 220, 0.15);
}

body[data-mode="pro"] .cyf-avatar-circle,
body:not([data-mode]) .cyf-avatar-circle {
  background: #0b0f19;
  border-color: rgba(245, 240, 220, 0.4);
}

/* 2. Creative Mode (creative): White/Light glass style with black logo */
body[data-mode="creative"] .cyf-chatbot-trigger {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(240, 244, 250, 0.98));
  border: 1px solid rgba(0, 0, 0, 0.18);
  color: #0f172a;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 20px rgba(255, 255, 255, 0.8);
}

body[data-mode="creative"] .cyf-chatbot-trigger:hover {
  border-color: rgba(0, 0, 0, 0.4);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.35);
}

body[data-mode="creative"] .cyf-chatbot-widget {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

body[data-mode="creative"] .cyf-chat-header {
  background: rgba(241, 245, 249, 0.95);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body[data-mode="creative"] .cyf-chat-title {
  color: #0f172a;
}

body[data-mode="creative"] .cyf-avatar-circle {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.2);
}

body[data-mode="creative"] .cyf-icon-btn {
  color: #475569;
}

body[data-mode="creative"] .cyf-icon-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #0f172a;
}

body[data-mode="creative"] .cyf-msg.bot .cyf-msg-bubble {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body[data-mode="creative"] .cyf-msg-bubble a {
  color: #0284c7;
}

body[data-mode="creative"] .cyf-chip {
  background: rgba(241, 245, 249, 0.9);
  color: #334155;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

body[data-mode="creative"] .cyf-chip:hover {
  background: #0284c7;
  color: #ffffff;
}

body[data-mode="creative"] .cyf-chat-input-area {
  background: rgba(248, 250, 252, 0.95);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

body[data-mode="creative"] .cyf-chat-input {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #0f172a;
}

body[data-mode="creative"] .cyf-chat-input::placeholder {
  color: #94a3b8;
}

/* 3. Desktop OS Mode (desktop): Rover Windows XP Sticker & Windows 7 Aero Glass */
body[data-mode="desktop"] .cyf-chatbot-trigger {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 10px 14px 10px 14px;
  background: linear-gradient(180deg, rgba(240, 250, 255, 0.92) 0%, rgba(195, 225, 250, 0.95) 50%, rgba(155, 200, 240, 0.95) 51%, rgba(185, 220, 250, 0.92) 100%);
  border: 1.5px solid #ffffff;
  outline: 1px solid rgba(0, 120, 215, 0.5);
  color: #0c2a4a;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  box-shadow: 0 10px 30px rgba(0, 70, 150, 0.45), inset 0 1px 0 #ffffff;
  border-radius: 18px;
  text-align: center;
}

.cyf-rover-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

body[data-mode="desktop"] .cyf-chatbot-trigger .cyf-chatbot-trigger-icon {
  width: 54px;
  height: 54px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

body[data-mode="desktop"] .cyf-avatar-circle .cyf-rover-video {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

body[data-mode="desktop"] .cyf-msg-avatar .cyf-rover-video {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

body[data-mode="desktop"] .cyf-chatbot-trigger:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(215, 240, 255, 0.96) 50%, rgba(175, 215, 250, 0.98) 51%, rgba(205, 235, 255, 0.95) 100%);
  box-shadow: 0 12px 35px rgba(0, 120, 215, 0.55), inset 0 1px 0 #ffffff;
}

body[data-mode="desktop"] .cyf-chatbot-widget {
  background: linear-gradient(135deg, rgba(220, 238, 255, 0.88), rgba(180, 215, 245, 0.92));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid #ffffff;
  outline: 1px solid rgba(0, 100, 200, 0.3);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 40, 100, 0.45), inset 0 1px 0 #ffffff;
}

body[data-mode="desktop"] .cyf-chat-header {
  background: linear-gradient(180deg, rgba(255,255,255,0.75) 0%, rgba(205,230,255,0.65) 45%, rgba(150,195,238,0.75) 50%, rgba(180,220,250,0.65) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.8);
}

body[data-mode="desktop"] .cyf-chat-title {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 700;
  color: #0f3460;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

body[data-mode="desktop"] .cyf-avatar-circle {
  background: linear-gradient(135deg, #ffffff, #dbeafe);
  border: 1px solid #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

body[data-mode="desktop"] .cyf-icon-btn {
  color: #0c2a4a;
}

body[data-mode="desktop"] #cyf-chat-close-btn:hover {
  background: #ef4444;
  color: #ffffff;
}

body[data-mode="desktop"] .cyf-msg.bot .cyf-msg-bubble {
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 10px rgba(0, 50, 100, 0.1);
}

body[data-mode="desktop"] .cyf-msg-bubble a {
  color: #0284c7;
}

body[data-mode="desktop"] .cyf-chip {
  background: rgba(255, 255, 255, 0.85);
  color: #0f3460;
  border: 1px solid rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

body[data-mode="desktop"] .cyf-chip:hover {
  background: #0284c7;
  color: #ffffff;
}

body[data-mode="desktop"] .cyf-chat-input-area {
  background: rgba(240, 248, 255, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.8);
}

body[data-mode="desktop"] .cyf-chat-input {
  background: #ffffff;
  border: 1px solid rgba(0, 120, 215, 0.4);
  color: #0f172a;
}

