/* ===================================================
   AI CUSTOMER SUPPORT CHAT WIDGET - HQUAN98
   =================================================== */

:root {
  --ai-gold: #FFD700;
  --ai-gold2: #FFA500;
  --ai-purple: #7c3aed;
  --ai-blue: #2563eb;
  --ai-dark: #0c0d19;
  --ai-card: #131428;
  --ai-card2: #1b1c36;
  --ai-border: rgba(255, 215, 0, 0.2);
}

/* Floating Launcher Sticker */
#ai-chat-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
}

.ai-launcher-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.ai-launcher-pill {
  background: rgba(19, 20, 40, 0.95);
  border: 1px solid var(--ai-border);
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 15px rgba(255, 215, 0, 0.15);
  cursor: pointer;
  animation: aiBounce 3s ease-in-out infinite;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
  transition: transform 0.2s, background 0.2s;
}

.ai-launcher-pill:hover {
  background: rgba(27, 28, 54, 0.98);
  transform: scale(1.03);
}

.ai-launcher-pill .ai-gold-text {
  background: linear-gradient(90deg, var(--ai-gold), var(--ai-gold2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.ai-launcher-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #181935 0%, #0d0e20 100%);
  border: 2px solid rgba(255, 215, 0, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 25px rgba(255, 215, 0, 0.35);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-launcher-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 35px rgba(0,0,0,0.7), 0 0 35px rgba(255, 215, 0, 0.5);
}

.ai-launcher-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 215, 0, 0.4);
  animation: aiPulse 2.5s infinite;
  pointer-events: none;
}

@keyframes aiPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 0; }
  100% { transform: scale(0.95); opacity: 0; }
}

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

.ai-launcher-icon {
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s;
}

.ai-online-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #10b981;
  border: 2.5px solid #0c0d19;
  border-radius: 50%;
}

/* Chat Window Modal */
.ai-chat-window {
  display: none;
  position: fixed;
  bottom: 94px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--ai-card);
  border: 1px solid var(--ai-border);
  border-radius: 22px;
  box-shadow: 0 25px 70px rgba(0,0,0,0.7), 0 0 40px rgba(255, 215, 0, 0.15);
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  backdrop-filter: blur(20px);
  animation: aiSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-chat-window.open {
  display: flex;
}

@keyframes aiSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Window Header */
.ai-header {
  background: linear-gradient(135deg, #191a38 0%, #101124 100%);
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ai-gold), var(--ai-gold2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.ai-header-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-header-title span {
  background: linear-gradient(90deg, var(--ai-gold), var(--ai-gold2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ai-header-sub {
  font-size: 0.75rem;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.ai-header-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #aaa;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
}

.ai-header-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Quick Support Banner */
.ai-top-support {
  background: rgba(124, 58, 237, 0.12);
  border-bottom: 1px solid rgba(124, 58, 237, 0.25);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
}

.ai-top-support-text {
  color: #d8b4fe;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ai-top-support-btns {
  display: flex;
  gap: 6px;
}

.ai-btn-top {
  padding: 4px 10px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.ai-btn-top.zalo {
  background: #0068ff;
  color: #fff;
}

.ai-btn-top.mess {
  background: linear-gradient(135deg, #00B2FF, #006AFF);
  color: #fff;
}

.ai-btn-top:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Messages Area */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: aiMsgIn 0.2s ease-out;
}

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

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

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

.ai-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.86rem;
  line-height: 1.5;
  word-break: break-word;
}

.ai-msg.bot .ai-bubble {
  background: var(--ai-card2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-top-left-radius: 4px;
}

.ai-msg.user .ai-bubble {
  background: linear-gradient(135deg, var(--ai-purple), var(--ai-blue));
  color: #fff;
  border-top-right-radius: 4px;
}

.ai-msg-time {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 4px;
  padding: 0 4px;
}

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

/* Quick Question Chips */
.ai-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ai-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: #f1f5f9;
  padding: 6px 11px;
  border-radius: 14px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-chip:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: var(--ai-gold);
  color: var(--ai-gold);
  transform: translateY(-1px);
}

/* Issue Support Card inside Chat */
.ai-issue-card {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(124, 58, 237, 0.15));
  border: 1.5px solid rgba(239, 68, 68, 0.4);
  border-radius: 14px;
  padding: 12px;
  margin-top: 8px;
}

.ai-issue-card-title {
  color: #fca5a5;
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.ai-issue-card-desc {
  color: #e2e8f0;
  font-size: 0.78rem;
  margin-bottom: 10px;
  line-height: 1.4;
}

.ai-issue-card-btns {
  display: flex;
  gap: 8px;
}

.ai-issue-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.2s, opacity 0.2s;
}

.ai-issue-btn:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.ai-issue-btn.zalo {
  background: #0068ff;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 104, 255, 0.3);
}

.ai-issue-btn.mess {
  background: linear-gradient(135deg, #00B2FF, #006AFF);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 178, 255, 0.3);
}

/* Typing Indicator */
.ai-typing {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--ai-card2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  width: fit-content;
  border-top-left-radius: 4px;
}

.ai-typing.active {
  display: flex;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ai-gold);
  animation: aiTypingBounce 1.4s infinite ease-in-out both;
}

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

@keyframes aiTypingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Input Bar */
.ai-input-bar {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(19, 20, 40, 0.95);
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-input {
  flex: 1;
  background: #1b1c36;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.ai-input:focus {
  border-color: rgba(255, 215, 0, 0.5);
}

.ai-input::placeholder {
  color: #64748b;
}

.ai-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ai-gold), var(--ai-gold2));
  border: none;
  color: #000;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(255, 215, 0, 0.25);
}

.ai-send-btn:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.ai-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Responsive Mobile */
@media (max-width: 480px) {
  #ai-chat-root {
    bottom: 16px;
    right: 16px;
  }
  .ai-chat-window {
    bottom: 84px;
    right: 12px;
    left: 12px;
    width: calc(100vw - 24px);
    height: calc(100vh - 110px);
  }
  .ai-launcher-pill {
    display: none;
  }
}
