/* Tara AI Chatbot Styles - Premium Tarkan Labs Design System */

#tara-ai-widget {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  line-height: 1.5;
}

/* Floating Launcher Button */
.tara-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 18px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4), 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  outline: none;
}

.tara-launcher:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 15px 30px -5px rgba(37, 99, 235, 0.55), 0 8px 16px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.tara-launcher:active {
  transform: translateY(-1px) scale(0.98);
}

.tara-avatar-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: visible;
  padding: 2px;
}

.tara-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.tara-avatar-badge::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.tara-launcher-text {
  letter-spacing: -0.01em;
}

.tara-unread-dot {
  width: 8px;
  height: 8px;
  background: #f59e0b;
  border-radius: 50%;
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Chat Drawer Window */
.tara-window {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 110px);
  background: #ffffff;
  color: #0f172a;
  border-radius: 20px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.08);
  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);
  z-index: 99999;
}

.tara-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Dark Theme Support */
[data-theme="dark"] .tara-window {
  background: #0b1120;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Chat Header */
.tara-header {
  padding: 14px 18px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .tara-header {
  background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
}

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

.tara-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  padding: 2px;
  overflow: visible;
}

.tara-header-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  background: #10b981;
  border: 2px solid #0f172a;
  border-radius: 50%;
}

.tara-header-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tara-header-title span.badge {
  font-size: 0.65rem;
  background: rgba(37, 99, 235, 0.3);
  color: #60a5fa;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tara-header-subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 2px 0 0 0;
}

.tara-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tara-icon-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.tara-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Chat Body / Messages Area */
.tara-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  background: #f8fafc;
}

[data-theme="dark"] .tara-body {
  background: #090d16;
}

/* Message Item */
.tara-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: messageSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

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

.tara-msg-bubble {
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-wrap: break-word;
}

.tara-msg-bot .tara-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .tara-msg-bot .tara-msg-bubble {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tara-msg-user .tara-msg-bubble {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.tara-msg-time {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 4px;
  padding: 0 4px;
}

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

/* Typing Indicator */
.tara-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: #ffffff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .tara-typing {
  background: #1e293b;
}

.tara-typing span {
  width: 6px;
  height: 6px;
  background: #3b82f6;
  border-radius: 50%;
  animation: typingBlink 1.4s infinite ease-in-out both;
}

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

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

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

.tara-chip {
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.tara-chip:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  transform: translateY(-1px);
}

[data-theme="dark"] .tara-chip {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .tara-chip:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* Embedded Product Recommendation Card inside Chat */
.tara-product-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 10px;
  margin-top: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.tara-product-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.12);
}

[data-theme="dark"] .tara-product-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tara-product-card:hover {
  border-color: #60a5fa;
}

.tara-product-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: #f1f5f9;
  flex-shrink: 0;
}

.tara-product-info {
  flex: 1;
  min-width: 0;
}

.tara-product-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .tara-product-title {
  color: #f8fafc;
}

.tara-product-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  margin-bottom: 6px;
}

.tara-product-price {
  font-weight: 700;
  color: #059669;
}

[data-theme="dark"] .tara-product-price {
  color: #34d399;
}

.tara-product-rating {
  color: #10b981;
  font-weight: 600;
}

.tara-product-actions {
  display: flex;
  gap: 6px;
}

.tara-btn {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.tara-btn-primary {
  background: #2563eb;
  color: #ffffff;
}

.tara-btn-primary:hover {
  background: #1d4ed8;
}

.tara-btn-amazon {
  background: #ff9900;
  color: #111827;
}

.tara-btn-amazon:hover {
  background: #e68a00;
}

/* Chat Input Footer */
.tara-footer {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-theme="dark"] .tara-footer {
  background: #0f172a;
  border-top-color: rgba(255, 255, 255, 0.08);
}

.tara-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.tara-input {
  width: 100%;
  padding: 10px 38px 10px 14px;
  border-radius: 24px;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s ease;
}

.tara-input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .tara-input {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.15);
  color: #f8fafc;
}

[data-theme="dark"] .tara-input:focus {
  border-color: #3b82f6;
  background: #0f172a;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.tara-mic-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tara-mic-btn.listening {
  color: #ef4444;
  animation: pulseGlow 1s infinite;
}

.tara-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.tara-send-btn:hover {
  background: #1d4ed8;
  transform: scale(1.05);
}

.tara-send-btn:active {
  transform: scale(0.95);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  #tara-ai-widget {
    bottom: 16px;
    right: 16px;
  }

  .tara-window {
    right: 12px;
    bottom: 74px;
    width: calc(100vw - 24px);
    height: 520px;
  }
}
