/* ==========================================================================
   FLOATING AI ASSISTANT (TAYLOR) WIDGET & CHAT DRAWER
   Nút tròn nổi góc màn hình + Cửa sổ chat pop-up/drawer sang trọng
   ========================================================================== */

/* Nút Trợ lý Nổi (Floating Assistant Button) */
.taylor-floating-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 99999 !important;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: linear-gradient(135deg, var(--rose-gold) 0%, var(--rose-gold-dark) 100%);
  color: #FFFFFF;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-full);
  padding: 0.65rem 1.25rem 0.65rem 0.75rem;
  box-shadow: 0 8px 24px rgba(224, 122, 95, 0.4), 0 2px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: floatGentlePulse 4s ease-in-out infinite;
}

.taylor-floating-btn:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 12px 30px rgba(224, 122, 95, 0.6);
  border-color: #FFFFFF;
}

.taylor-floating-btn.active {
  background: linear-gradient(135deg, var(--burgundy) 0%, var(--burgundy-dark) 100%);
  box-shadow: 0 8px 20px rgba(123, 17, 19, 0.4);
}

.taylor-btn-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.taylor-btn-content {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.taylor-btn-title {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.taylor-btn-status {
  font-size: 0.72rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.taylor-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34D399; /* Green active */
  display: inline-block;
  box-shadow: 0 0 6px #34D399;
}

@keyframes floatGentlePulse {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 8px 24px rgba(224, 122, 95, 0.4);
  }
  50% {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(224, 122, 95, 0.55);
  }
}

/* Cửa sổ Popup / Drawer Chat Trợ Lý Taylor */
.taylor-chat-drawer {
  position: fixed;
  bottom: 5.5rem;
  right: 2rem;
  width: 420px;
  max-width: calc(100vw - 2rem);
  height: 620px;
  max-height: calc(100vh - 7rem);
  background: var(--bg-surface);
  border-radius: var(--radius-xl, 20px);
  border: 1px solid var(--border-light);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 100000 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.taylor-chat-drawer.open {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1) !important;
  pointer-events: auto !important;
  display: flex !important;
}

/* Header Drawer */
.taylor-drawer-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-surface-alt) 100%);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.taylor-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.taylor-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-gold-light) 0%, var(--primary-gold-light) 100%);
  border: 1.5px solid var(--rose-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: var(--shadow-sm);
}

.taylor-header-info h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0;
}

.taylor-header-info span {
  font-size: 0.74rem;
  color: var(--color-success);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.taylor-close-btn {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
  position: relative;
}

.taylor-close-btn::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border-radius: 50%;
}

.taylor-close-btn:hover {
  background: var(--rose-gold-light);
  color: var(--rose-gold-dark);
}

/* Khu vực tin nhắn */
.taylor-messages-wrap {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.taylor-msg-bubble {
  max-width: 86%;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
}

.taylor-msg-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--rose-gold) 0%, var(--rose-gold-dark) 100%);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px var(--rose-gold-glow);
}

.taylor-msg-bubble.ai {
  align-self: flex-start;
  background: var(--bg-surface-alt);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 4px;
}

/* Quick Question Chips */
.taylor-chips-bar {
  padding: 0.65rem 1rem;
  background: var(--bg-surface-alt);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  cursor: grab;
  user-select: none;
}

.taylor-chips-bar:active {
  cursor: grabbing;
}

.taylor-chips-bar::-webkit-scrollbar {
  height: 4px;
}

.taylor-chips-bar::-webkit-scrollbar-track {
  background: transparent;
}

.taylor-chips-bar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

.taylor-chip-btn {
  flex-shrink: 0;
  padding: 0.45rem 0.95rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 20px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.taylor-chip-btn:hover {
  background: var(--rose-gold-light);
  border-color: var(--rose-gold);
  color: var(--rose-gold-dark);
}

/* Input Bar */
.taylor-input-bar {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.taylor-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.taylor-chat-input {
  flex: 1;
  height: 42px;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.taylor-chat-input:focus {
  border-color: var(--rose-gold);
  box-shadow: 0 0 0 3px var(--rose-gold-glow);
}

.taylor-send-btn {
  height: 42px;
  padding: 0 1.15rem;
  background: linear-gradient(135deg, var(--rose-gold) 0%, var(--rose-gold-dark) 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 3px 10px var(--rose-gold-glow);
}

.taylor-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px var(--rose-gold-glow);
}

.taylor-stop-btn {
  height: 42px;
  padding: 0 0.85rem;
  background: var(--bg-surface-alt);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  display: none;
}

.taylor-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0 0.2rem;
}

@media (max-width: 768px) {
  .taylor-floating-btn {
    bottom: 1.25rem;
    right: 1.25rem;
    padding: 0.5rem 0.85rem 0.5rem 0.5rem;
  }
  .taylor-btn-title {
    font-size: 0.82rem;
  }
  .taylor-chat-drawer {
    right: 1rem;
    left: 1rem;
    width: auto;
    bottom: 5.5rem;
    height: 75vh;
  }
}
