/* ==========================================================================
   BotLiva Live Support Widget - Design System & Stylesheet
   Inspired by Speakbee modern purple aesthetics
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --botliva-primary: #2563eb;
  --botliva-primary-hover: #1d4ed8;
  --botliva-primary-dark: #1e40af;
  --botliva-primary-light: #eff6ff;
  --botliva-primary-border: #bfdbfe;
  --botliva-primary-pill-border: #93c5fd;

  --botliva-bg-card: #ffffff;
  --botliva-bg-chat: #ffffff;
  --botliva-bg-input: #f8fafc;

  --botliva-text-dark: #101828;
  --botliva-text-muted: #667085;
  --botliva-text-light: #ffffff;

  --botliva-border-subtle: #eaecf0;
  --botliva-radius-card: 28px;
  --botliva-radius-bubble: 18px;

  --botliva-shadow-card: 0 24px 48px -12px rgba(16, 24, 40, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --botliva-shadow-trigger: 0 12px 28px -4px rgba(37, 99, 235, 0.45), 0 6px 12px -2px rgba(37, 99, 235, 0.25);

  --botliva-font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Base Widget Scope */
.botliva-widget-root {
  font-family: var(--botliva-font-family);
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

.botliva-widget-root *,
.botliva-widget-root *::before,
.botliva-widget-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   1. Floating Trigger Button (Bottom Right)
   ========================================================================== */
.botliva-trigger-container {
  position: relative;
  margin-top: 12px;
}

.botliva-trigger-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--botliva-primary) 0%, var(--botliva-primary-hover) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--botliva-shadow-trigger);
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

.botliva-trigger-btn:hover {
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 16px 32px -4px rgba(37, 99, 235, 0.55);
}

.botliva-trigger-btn:active {
  transform: scale(0.95);
}

.botliva-trigger-btn.is-open {
  background: var(--botliva-primary);
  transform: rotate(0deg);
}

.botliva-trigger-icon {
  transition: transform 0.25s ease;
}

/* ==========================================================================
   Unread Message Preview Card (Floating above Widget Trigger)
   ========================================================================== */
.botliva-unread-preview-card {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  background: #ffffff;
  border-radius: 16px;
  padding: 10px 14px 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 32px -4px rgba(16, 24, 40, 0.16), 0 4px 12px -2px rgba(16, 24, 40, 0.08);
  border: 1px solid #eaecf0;
  max-width: 290px;
  min-width: 220px;
  cursor: pointer;
  user-select: none;
  animation: botliva-preview-popup 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 99999;
}

.botliva-unread-preview-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -4px rgba(16, 24, 40, 0.22), 0 6px 16px -2px rgba(16, 24, 40, 0.1);
}

.botliva-unread-preview-card::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-right: 1px solid #eaecf0;
  border-bottom: 1px solid #eaecf0;
  transform: rotate(45deg);
}

@keyframes botliva-preview-popup {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.botliva-unread-preview-avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.botliva-unread-preview-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #f1f5f9;
  border: 1.5px solid #ffffff;
  display: block;
}

.botliva-unread-preview-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #10b981;
  border: 1.5px solid #ffffff;
}

.botliva-unread-preview-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.botliva-unread-preview-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.botliva-unread-preview-text {
  font-size: 12px;
  color: #475467;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  line-height: 1.35;
}

.botliva-unread-preview-close {
  background: transparent;
  border: none;
  color: #98a2b3;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  margin-left: 2px;
  transition: all 0.15s ease;
}

.botliva-unread-preview-close:hover {
  background: #f1f5f9;
  color: #344054;
}

/* Karşılama (Welcome) Mesajına Özel Daha Geniş ve Okunaklı Önizleme Kartı */
.botliva-unread-preview-card.is-welcome {
  max-width: 350px;
  min-width: 270px;
  padding: 12px 14px 12px 13px;
  border-radius: 18px;
  align-items: flex-start;
}

.botliva-unread-preview-card.is-welcome .botliva-unread-preview-avatar-wrap {
  margin-top: 1px;
}

.botliva-unread-preview-card.is-welcome .botliva-unread-preview-content {
  gap: 3px;
}

.botliva-unread-preview-card.is-welcome .botliva-unread-preview-name {
  font-size: 13px;
  font-weight: 700;
}

.botliva-unread-preview-card.is-welcome .botliva-unread-preview-text {
  max-width: 245px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.42;
  font-size: 12.5px;
  color: #334155;
}

.botliva-unread-preview-card.is-welcome .botliva-unread-preview-close {
  margin-top: -2px;
}

.botliva-unread-pulse-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 11px;
  height: 11px;
  background-color: #22c55e;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: botliva-pulse 2s infinite;
}

@keyframes botliva-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* ==========================================================================
   2. Main Card Window (380px x 620px)
   ========================================================================== */
.botliva-card-window {
  width: 380px;
  height: 620px;
  background: var(--botliva-bg-card);
  border-radius: var(--botliva-radius-card);
  box-shadow: var(--botliva-shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  animation: botliva-slide-up 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              max-width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              max-height 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.botliva-card-window.is-expanded {
  width: 680px;
  max-width: calc(100vw - 36px);
  height: 750px;
  max-height: calc(100vh - 100px);
}

@keyframes botliva-slide-up {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================================================
   3. Header (Clean White, Divider Line, Expand, Profile, Close)
   ========================================================================== */
.botliva-header {
  background-color: #ffffff;
  background-image: none !important;
  padding: 12px 16px;
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #eaecf0;
  box-sizing: border-box;
  z-index: 10;
}

.botliva-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.botliva-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Header Buttons: Expand and Close */
.botliva-header-btn {
  background: transparent;
  border: none;
  color: #475467;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.16s ease;
  outline: none;
}

.botliva-header-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  transform: translateY(-1px);
}

.botliva-header-btn:active {
  transform: translateY(0);
  background: #e2e8f0;
}

.botliva-header-expand-btn {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.botliva-header-close-btn {
  border: none !important;
  color: #64748b;
}

.botliva-header-close-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border: none !important;
}

/* Profile section */
.botliva-header-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.botliva-header-avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.botliva-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: #f1f5f9;
  display: block;
  border: 1.5px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Online / Offline Status Dot */
.botliva-header-status-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background-color: #10b981;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2);
}

.botliva-header-status-dot.offline {
  background-color: #94a3b8;
  box-shadow: none;
}

/* Meta: Name & Subtext */
.botliva-header-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.botliva-header-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.botliva-header-name {
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.botliva-header-sep {
  color: #cbd5e1;
  font-size: 12px;
}

.botliva-header-brand {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
}

.botliva-header-subtext {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  line-height: 1.3;
  margin-top: 1px;
}

/* Legacy fallback styles */
.botliva-header-action-btn {
  background: transparent;
  border: none;
  color: #475467;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}


/* ==========================================================================
   3.1 Offline Notice Banner
   ========================================================================== */
.botliva-offline-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fef2f2;
  border-bottom: 1px solid #fee2e2;
  padding: 8px 14px;
  font-size: 11.5px;
  color: #991b1b;
  font-weight: 500;
  animation: botlivaFadeIn 0.2s ease-out;
  flex-shrink: 0;
  z-index: 10;
}

.botliva-offline-banner-content {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.botliva-offline-banner-icon {
  flex-shrink: 0;
  color: #ef4444;
}

.botliva-offline-banner-text {
  line-height: 1.35;
  word-break: break-word;
}

.botliva-offline-reload-btn {
  background: #ef4444;
  color: #ffffff;
  border: none;
  outline: none;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.botliva-offline-reload-btn:hover {
  background: #dc2626;
}

/* ==========================================================================
   3.2 Live Support Devre Dışı Blur Overlay (Session Init Error)
   ========================================================================== */
.botliva-maintenance-overlay {
  position: absolute;
  inset: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  animation: botlivaMaintenanceFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-sizing: border-box;
}

@keyframes botlivaMaintenanceFadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.botliva-maintenance-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.9);
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  z-index: 10;
  padding: 0;
}

.botliva-maintenance-close-btn:hover {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  transform: scale(1.05);
}

.botliva-maintenance-card {
  width: 100%;
  max-width: 320px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 22px;
  box-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.16),
              0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  padding: 24px 18px 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
}

.botliva-maintenance-icon-badge {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px -4px rgba(239, 68, 68, 0.25);
  position: relative;
}

.botliva-maintenance-icon-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 22px;
  background: rgba(239, 68, 68, 0.15);
  animation: botlivaPulseRing 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  z-index: -1;
}

@keyframes botlivaPulseRing {
  0%, 100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.25;
  }
}

.botliva-maintenance-title {
  font-size: 16.5px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px 0;
  line-height: 1.35;
  letter-spacing: -0.015em;
  font-family: inherit;
}

.botliva-maintenance-desc {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 18px 0;
  line-height: 1.5;
  font-family: inherit;
}

.botliva-maintenance-channels {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.botliva-maintenance-btn {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  width: 100%;
  position: relative;
  cursor: pointer;
  border: 1px solid transparent;
}

.botliva-maintenance-discord {
  background: #f0f2fe;
  color: #5865f2;
  border-color: rgba(88, 101, 242, 0.2);
}

.botliva-maintenance-discord:hover {
  background: #5865f2;
  color: #ffffff;
  border-color: #5865f2;
  transform: translateY(-1.5px);
  box-shadow: 0 8px 20px -4px rgba(88, 101, 242, 0.4);
}

.botliva-maintenance-email {
  background: #f0fdf4;
  color: #16a34a;
  border-color: rgba(22, 163, 74, 0.2);
}

.botliva-maintenance-email:hover {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
  transform: translateY(-1.5px);
  box-shadow: 0 8px 20px -4px rgba(22, 163, 74, 0.4);
}

.botliva-maintenance-btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.botliva-maintenance-discord:hover .botliva-maintenance-btn-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.botliva-maintenance-email:hover .botliva-maintenance-btn-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.botliva-maintenance-btn-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  flex: 1;
  min-width: 0;
}

.botliva-maintenance-btn-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.8;
  line-height: 1.2;
}

.botliva-maintenance-btn-val {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.botliva-maintenance-chevron {
  opacity: 0.6;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.botliva-maintenance-btn:hover .botliva-maintenance-chevron {
  opacity: 1;
  transform: translateX(2px);
}

.botliva-maintenance-retry-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475467;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
  font-family: inherit;
  outline: none;
}

.botliva-maintenance-retry-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

.botliva-maintenance-retry-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.botliva-maintenance-retry-icon {
  flex-shrink: 0;
}


/* ==========================================================================
   4. Message List & Bubbles
   ========================================================================== */
.botliva-message-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--botliva-bg-chat);
  scrollbar-width: thin;
  scrollbar-color: #e4e7ec transparent;
}

.botliva-message-list::-webkit-scrollbar {
  width: 5px;
}

.botliva-message-list::-webkit-scrollbar-thumb {
  background: #e4e7ec;
  border-radius: 10px;
}

/* Date Divider Pill (Screenshot: "22 May") */
.botliva-date-pill-container {
  display: flex;
  justify-content: center;
  margin: 4px 0 8px 0;
}

.botliva-date-pill {
  font-size: 11px;
  font-weight: 500;
  color: #667085;
  background: transparent;
  padding: 2px 10px;
  letter-spacing: 0.02em;
}

/* Message Rows */
.botliva-message-row {
  display: flex;
  gap: 10px;
  width: 100%;
  animation: botliva-fade-in 0.2s ease-out;
}

@keyframes botliva-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.botliva-message-row.user {
  justify-content: flex-end;
}

.botliva-message-row.agent {
  justify-content: flex-start;
}

/* Grouped consecutive messages in same minute */
.botliva-message-row.is-grouped {
  margin-top: -8px;
}

.botliva-message-row.agent.is-grouped .botliva-message-avatar img {
  visibility: hidden;
}

.botliva-message-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-top: 2px;
}

.botliva-message-avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--botliva-border-subtle);
}

.botliva-bubble-wrapper {
  max-width: 82%;
  display: flex;
  flex-direction: column;
}

.botliva-message-row.user .botliva-bubble-wrapper {
  align-items: flex-end;
}

.botliva-message-row.agent .botliva-bubble-wrapper {
  align-items: flex-start;
}

.botliva-message-sender-name {
  font-size: 11.5px;
  font-weight: 700;
  color: #475467;
  margin-bottom: 3px;
  margin-left: 2px;
  letter-spacing: -0.01em;
  user-select: none;
  line-height: 1.2;
}

/* Bubble Styles */
.botliva-bubble {
  padding: 11px 15px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}

/* Incoming Agent Bubble (Screenshot: Clean white card, subtle border) */
.botliva-bubble.agent {
  background: #ffffff;
  color: var(--botliva-text-dark);
  border: 1px solid var(--botliva-border-subtle);
  border-radius: var(--botliva-radius-bubble) var(--botliva-radius-bubble) var(--botliva-radius-bubble) 4px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

/* Outgoing User Bubble (Vivid Blue) */
.botliva-bubble.user {
  background: linear-gradient(135deg, var(--botliva-primary) 0%, var(--botliva-primary-hover) 100%);
  color: #ffffff;
  border-radius: var(--botliva-radius-bubble) var(--botliva-radius-bubble) 4px var(--botliva-radius-bubble);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.botliva-bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* Markdown formatting inside message bubbles */
.botliva-bubble-text strong {
  font-weight: 700;
}

.botliva-bubble.user .botliva-bubble-text strong {
  color: #ffffff;
}

.botliva-bubble.agent .botliva-bubble-text strong {
  color: #0f172a;
}

.botliva-bubble-text em {
  font-style: italic;
}

.botliva-msg-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: opacity 0.15s;
}

.botliva-bubble.agent .botliva-msg-link {
  color: var(--botliva-primary);
}

.botliva-msg-link:hover {
  opacity: 0.8;
}

.botliva-inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 4px;
}

.botliva-bubble.agent .botliva-inline-code {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #e2e8f0;
}

.botliva-bubble.user .botliva-inline-code {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.botliva-code-block {
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  overflow-x: auto;
}

.botliva-bubble.agent .botliva-code-block {
  background: #0f172a;
  color: #f8fafc;
}

.botliva-bubble.user .botliva-code-block {
  background: rgba(0, 0, 0, 0.25);
  color: #f8fafc;
}

.botliva-msg-list {
  margin: 4px 0 4px 18px;
  padding: 0;
}

.botliva-msg-list li {
  margin-bottom: 2px;
}

/* In-Chat Email Prompt Bubble & Form */
.botliva-bubble.botliva-email-prompt-bubble {
  border: 1px solid #dbeafe;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
}

.botliva-inchat-email-container {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.botliva-inchat-email-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.botliva-inchat-email-input-wrap {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 3px 4px 3px 10px;
  transition: all 0.18s ease;
}

.botliva-inchat-email-input-wrap:focus-within {
  background: #ffffff;
  border-color: var(--botliva-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.botliva-inchat-email-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 12.5px;
  color: #0f172a;
  outline: none;
  font-family: inherit;
  min-width: 0;
}

.botliva-inchat-email-input::placeholder {
  color: #94a3b8;
}

.botliva-inchat-email-submit {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--botliva-primary);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.botliva-inchat-email-submit:hover:not(:disabled) {
  background: var(--botliva-primary-hover);
  transform: scale(1.05);
}

.botliva-inchat-email-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.botliva-inchat-email-error {
  font-size: 11px;
  color: #ef4444;
  margin-top: 2px;
  padding-left: 2px;
  font-weight: 500;
}

.botliva-inchat-email-success {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.35;
}

.botliva-inchat-email-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #22c55e;
  color: #ffffff;
  flex-shrink: 0;
}


/* Message Meta */
.botliva-message-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 0 4px;
  font-size: 10.5px;
  color: #98a2b3;
}

.botliva-message-edited {
  font-size: 10px;
  color: #98a2b3;
  font-style: italic;
  display: inline-block;
  user-select: none;
}

.botliva-message-status {
  display: flex;
  align-items: center;
  color: var(--botliva-primary);
}

.botliva-message-status-error {
  color: #ef4444;
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
}

/* System Message */
.botliva-system-message {
  text-align: center;
  margin: 6px 0;
}

.botliva-system-message span {
  font-size: 11px;
  color: #667085;
  background: #f2f4f7;
  padding: 3px 12px;
  border-radius: 12px;
}

/* Attachments */
.botliva-bubble.has-only-attachment {
  padding: 4px;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

.botliva-attachments-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.botliva-bubble.has-only-attachment .botliva-attachments-list {
  margin-top: 0;
}

.botliva-attachment-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

.botliva-attachment-img-link {
  display: block;
  text-decoration: none;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.botliva-attachment-img-link:hover {
  transform: scale(1.01);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.12);
}

.botliva-attachment-img-preview {
  max-width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--botliva-border-subtle);
  display: block;
  cursor: pointer;
}

.botliva-attachment-file-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.04);
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  font-size: 12px;
}

.botliva-attachment-file-card:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   5. Quick Replies (Screenshot: Purple Outline Pills Aligned Right)
   ========================================================================== */
.botliva-quick-replies-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin: 4px 0 10px 0;
  width: 100%;
}

.botliva-quick-reply-pill {
  border: 1.5px solid var(--botliva-primary-pill-border);
  background: var(--botliva-primary-light);
  color: var(--botliva-primary-hover);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
  max-width: 90%;
  text-align: right;
  outline: none;
}

.botliva-quick-reply-pill:hover {
  background: #ebdeff;
  border-color: var(--botliva-primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(105, 56, 239, 0.16);
}

.botliva-quick-reply-pill:active {
  transform: scale(0.97);
}

/* ==========================================================================
   6. Typing Indicator
   ========================================================================== */
.typing-indicator-bubble {
  padding: 10px 14px;
}

.botliva-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.botliva-typing-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9b8afb;
  animation: botliva-bounce 1.4s infinite ease-in-out both;
}

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

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

.botliva-typing-preview-text {
  font-style: italic;
  font-size: 12px;
  color: #667085;
}

/* Spin Animation */
@keyframes botliva-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.botliva-spin {
  animation: botliva-spin 0.9s linear infinite;
}

/* ==========================================================================
   7. Input Footer (Screenshot: Attachment clip + Pill Input + Send plane)
   ========================================================================== */
.botliva-input-footer-container {
  background: #ffffff;
  border-top: 1px solid #f2f4f7;
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.botliva-input-footer-container.is-dragover {
  background: var(--botliva-primary-light);
  border-top-color: var(--botliva-primary-border);
}

/* Upload Error Toast */
.botliva-upload-error-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin: 8px 16px 0 16px;
  background: #fef3f2;
  border: 1px solid #fee4e2;
  border-radius: 10px;
  color: #b42318;
  font-size: 12px;
  font-weight: 500;
  animation: botliva-fade-in 0.2s ease-out;
}

.botliva-upload-error-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.botliva-upload-error-text {
  flex: 1;
  line-height: 1.4;
}

.botliva-upload-error-close {
  background: transparent;
  border: none;
  color: #b42318;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
  font-size: 12px;
}

.botliva-upload-error-close:hover {
  opacity: 1;
}

/* Pending Attachment Preview Bar */
.botliva-pending-attachment-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 8px 16px 0 16px;
  background: #f9fafb;
  border: 1px solid var(--botliva-border-subtle);
  border-radius: 12px;
  animation: botliva-fade-in 0.2s ease-out;
}

.botliva-pending-thumb-wrapper {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  background: #eaecf0;
  flex-shrink: 0;
}

.botliva-pending-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.botliva-pending-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.botliva-pending-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.botliva-pending-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--botliva-text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.botliva-pending-size {
  font-size: 11px;
  color: var(--botliva-text-muted);
}

.botliva-pending-remove-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #eaecf0;
  background: #ffffff;
  color: #667085;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 11px;
  flex-shrink: 0;
}

.botliva-pending-remove-btn:hover {
  background: #fee4e2;
  color: #d92d20;
  border-color: #fecdca;
}

.botliva-input-footer {
  padding: 10px 16px 14px 16px;
  background: transparent;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.botliva-attachment-btn {
  background: transparent;
  border: none;
  color: #98a2b3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.botliva-attachment-btn:hover {
  color: var(--botliva-primary);
  background: var(--botliva-primary-light);
}

.botliva-attachment-btn.is-uploading {
  color: var(--botliva-primary);
  pointer-events: none;
}

/* Rounded Pill Container (Attachment clip and Send plane inside pill) */
.botliva-input-pill-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--botliva-bg-input);
  border: 1px solid var(--botliva-border-subtle);
  border-radius: 9999px;
  padding: 4px 6px 4px 6px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  gap: 4px;
}

.botliva-input-pill-wrapper:focus-within {
  background: #ffffff;
  border-color: var(--botliva-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.botliva-input-field {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--botliva-text-dark);
  outline: none;
  padding: 6px 4px;
}

.botliva-input-field::placeholder {
  color: #98a2b3;
  font-size: 13px;
}

/* Send Button inside Pill */
.botliva-send-btn {
  background: transparent;
  border: none;
  color: #98a2b3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.botliva-send-btn.active {
  color: var(--botliva-primary);
}

.botliva-send-btn.active:hover {
  background: var(--botliva-primary-light);
  transform: translateX(1px);
}

/* ==========================================================================
   7. Email Notification Prompt Banner
   ========================================================================== */
.botliva-email-prompt {
  background: linear-gradient(180deg, #f8faff 0%, #eff6ff 100%);
  border: 1px solid var(--botliva-primary-border);
  border-radius: 16px;
  padding: 12px 14px;
  margin: 0 16px 10px 16px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
  animation: botliva-slide-up 0.25s ease-out;
  position: relative;
  flex-shrink: 0;
}

@keyframes botliva-slide-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.botliva-email-prompt-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 9px;
}

.botliva-email-prompt-icon-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--botliva-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(191, 219, 254, 0.6);
}

.botliva-email-prompt-text-group {
  flex: 1;
  min-width: 0;
}

.botliva-email-prompt-title {
  font-size: 13px;
  font-weight: 700;
  color: #1d2939;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.botliva-email-prompt-sub {
  font-size: 11.5px;
  color: #667085;
  margin-top: 2px;
  line-height: 1.35;
}

.botliva-email-prompt-close {
  background: transparent;
  border: none;
  color: #98a2b3;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-top: -2px;
  margin-right: -4px;
  transition: all 0.15s ease;
}

.botliva-email-prompt-close:hover {
  color: #344054;
  background: rgba(0, 0, 0, 0.05);
}

.botliva-email-prompt-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.botliva-email-prompt-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.botliva-email-prompt-input {
  flex: 1;
  height: 34px;
  background: #ffffff;
  border: 1.5px solid #d0d5dd;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 12.5px;
  font-family: inherit;
  color: #101828;
  outline: none;
  transition: all 0.2s ease;
}

.botliva-email-prompt-input:focus {
  border-color: var(--botliva-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.botliva-email-prompt-input::placeholder {
  color: #98a2b3;
  font-size: 12px;
}

.botliva-email-prompt-submit {
  height: 34px;
  background: var(--botliva-primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(105, 56, 239, 0.2);
}

.botliva-email-prompt-submit:hover:not(:disabled) {
  background: var(--botliva-primary-hover);
  transform: translateY(-1px);
}

.botliva-email-prompt-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.botliva-email-prompt-error {
  font-size: 11px;
  color: #d92d20;
  font-weight: 500;
  padding-left: 2px;
}

.botliva-email-prompt-success {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ecfdf3;
  border: 1px solid #a6f4c5;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: #027a48;
  animation: botliva-fade-in 0.2s ease-out;
}

.botliva-email-prompt-success span {
  line-height: 1.35;
}

/* ==========================================================================
   8. Mobile Responsive Layout & Optimizations (Mobile-Friendly)
   ========================================================================== */
@media (max-width: 768px) {
  /* 1. Mobilde büyütme (expand) butonunu tamamen kaldır */
  .botliva-header-expand-btn {
    display: none !important;
  }

  /* 2. Kapalı Durumda Widget Pozisyonu & Tetikleyici Buton */
  .botliva-widget-root {
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    right: max(16px, env(safe-area-inset-right, 16px));
  }

  .botliva-trigger-container {
    margin-top: 0;
  }

  .botliva-trigger-btn {
    width: 56px;
    height: 56px;
  }

  /* 3. Açık Durumda Tam Ekran Native Mobil Deneyimi */
  .botliva-widget-root.is-widget-open {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100% !important;
    height: 100dvh !important;
    z-index: 9999999 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Widget açıkken mobilde alttaki yüzen tetikleyici butonu gizle (çift buton karmaşasını önler) */
  .botliva-widget-root.is-widget-open .botliva-trigger-container,
  .botliva-widget-root:has(.botliva-card-window:not([style*="display: none"])) .botliva-trigger-container {
    display: none !important;
  }

  /* 4. Ana Pencere (Full Screen Mobile Sheet / Window) */
  .botliva-card-window,
  .botliva-card-window.is-expanded {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    z-index: 1000000 !important;
    animation: botliva-slide-up-mobile 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  }

  @keyframes botliva-slide-up-mobile {
    0% {
      opacity: 0;
      transform: translateY(100%);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* 5. Mobil Header (Çentik & Safe Area Uyumlu) */
  .botliva-header {
    padding-top: max(12px, env(safe-area-inset-top, 12px));
    padding-left: max(14px, env(safe-area-inset-left, 14px));
    padding-right: max(14px, env(safe-area-inset-right, 14px));
    padding-bottom: 12px;
    border-radius: 0 !important;
  }

  .botliva-header-avatar-wrap {
    width: 36px;
    height: 36px;
  }

  .botliva-header-avatar {
    width: 36px;
    height: 36px;
  }

  .botliva-header-name {
    font-size: 14px;
  }

  .botliva-header-brand {
    font-size: 12px;
  }

  .botliva-header-subtext {
    font-size: 11px;
  }

  .botliva-header-close-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #f8fafc;
    color: #475467;
  }

  .botliva-header-close-btn:hover {
    background: #f1f5f9;
  }

  /* 6. Mesaj Listesi (Kaydırma ve Mobil Boşluklar) */
  .botliva-message-list {
    padding: 14px 12px;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .botliva-bubble-wrapper {
    max-width: 86%;
  }

  .botliva-bubble {
    font-size: 14px;
    padding: 10px 14px;
  }

  .botliva-attachment-img-preview {
    max-height: 220px;
  }

  /* 7. Hızlı Yanıt Butonları */
  .botliva-quick-replies-container {
    gap: 6px;
    margin: 4px 0 8px 0;
  }

  .botliva-quick-reply-pill {
    font-size: 13px;
    padding: 8px 14px;
    max-width: 95%;
  }

  /* 8. Mobil Alt Giriş Alanı (Home Indicator / Safe Area & iOS Zoom Önleme) */
  .botliva-input-footer-container {
    padding-bottom: max(6px, env(safe-area-inset-bottom, 6px));
  }

  .botliva-input-footer {
    padding: 8px 12px max(10px, env(safe-area-inset-bottom, 10px)) 12px;
  }

  /* iOS Safari auto-zoom engellemek için font-size en az 16px olmalı */
  .botliva-input-field,
  .botliva-inchat-email-input,
  .botliva-email-prompt-input {
    font-size: 16px !important;
  }

  .botliva-attachment-btn,
  .botliva-send-btn {
    width: 36px;
    height: 36px;
  }

  /* 9. Önizleme Bildirim Kartı (Widget kapalıyken) */
  .botliva-unread-preview-card {
    max-width: calc(100vw - 32px);
    right: 0;
  }

  .botliva-unread-preview-card.is-welcome {
    max-width: calc(100vw - 32px);
    min-width: 0;
  }

  .botliva-unread-preview-text {
    max-width: calc(100vw - 120px);
  }

  .botliva-unread-preview-card.is-welcome .botliva-unread-preview-text {
    max-width: calc(100vw - 120px);
    -webkit-line-clamp: 3;
  }

  /* 10. E-posta İstem & Ek Dosya Önizleme Barları */
  .botliva-email-prompt {
    margin: 0 12px 8px 12px;
    padding: 10px 12px;
  }

  .botliva-pending-attachment-bar {
    margin: 8px 12px 0 12px;
  }
}
