/* ========================================================
   toKobido AI Chatbot Widget Styles
   ======================================================== */

:root {
  --tkb-gold: #c5a059;
  --tkb-gold-light: #e6c88b;
  --tkb-olive: #3d4a3e;
  --tkb-olive-dark: #263027;
  --tkb-bg-light: #fcfbf9;
  --tkb-card-bg: #ffffff;
  --tkb-text-dark: #2c2c2c;
  --tkb-text-muted: #6e6e6e;
  --tkb-radius: 18px;
  --tkb-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);
}

/* Floating Launch Button */
.tkb-chat-launcher {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tkb-olive) 0%, var(--tkb-olive-dark) 100%);
  border: 2px solid var(--tkb-gold);
  box-shadow: 0 8px 24px rgba(61, 74, 62, 0.35);
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  outline: none;
}

.tkb-chat-launcher:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 28px rgba(197, 160, 89, 0.45);
}

.tkb-chat-launcher svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
  transition: transform 0.2s ease;
}

/* Badge / Notification dot */
.tkb-launcher-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background-color: var(--tkb-gold);
  border: 2px solid #ffffff;
  border-radius: 50%;
  animation: tkbPulse 2s infinite;
}

@keyframes tkbPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(197, 160, 89, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(197, 160, 89, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(197, 160, 89, 0); }
}

/* Chat Container Window */
.tkb-chat-window {
  position: fixed;
  bottom: 96px;
  left: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background-color: var(--tkb-bg-light);
  border-radius: var(--tkb-radius);
  box-shadow: var(--tkb-shadow);
  border: 1px solid rgba(197, 160, 89, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000000 !important;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), pointer-events 0.25s;
  font-family: inherit;
}

.tkb-chat-window.tkb-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Ukryj przycisk Booksy gdy czat jest otwarty, aby nie zasłaniał pola i przycisku wysyłania */
body.tkb-chat-open .floating-booksy-container,
body:has(.tkb-chat-window.tkb-active) .floating-booksy-container {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transform: translateY(20px) scale(0.8) !important;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s !important;
}

/* Chat Header */
.tkb-chat-header {
  background: linear-gradient(135deg, var(--tkb-olive) 0%, var(--tkb-olive-dark) 100%);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--tkb-gold);
}

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

.tkb-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--tkb-gold);
  object-fit: cover;
  background-color: #ffffff;
}

.tkb-header-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.3px;
}

.tkb-header-status {
  font-size: 12px;
  color: #d1dfd2;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.tkb-status-dot {
  width: 8px;
  height: 8px;
  background-color: #4ade80;
  border-radius: 50%;
  display: inline-block;
}

.tkb-close-btn,
.tkb-header-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, transform 0.15s;
  text-decoration: none;
}

.tkb-close-btn:hover,
.tkb-header-btn:hover {
  background-color: rgba(255, 255, 255, 0.18);
  transform: scale(1.08);
}

.tkb-header-call {
  color: var(--tkb-gold-light);
}

.tkb-header-call:hover {
  background-color: rgba(197, 160, 89, 0.25);
  color: #ffffff;
}

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

.tkb-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

/* Bot Message */
.tkb-msg-bot {
  align-self: flex-start;
  background-color: #ffffff;
  color: var(--tkb-text-dark);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tkb-msg-bot a {
  color: #967027;
  font-weight: 600;
  text-decoration: underline;
}

.tkb-msg-bot a:hover {
  color: #6b4d12;
}

.tkb-msg-bot ul, .tkb-msg-bot ol {
  margin: 6px 0;
  padding-left: 20px;
}

.tkb-msg-bot li {
  margin-bottom: 4px;
}

/* User Message */
.tkb-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--tkb-olive) 0%, var(--tkb-olive-dark) 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* Quick Starter Chips */
.tkb-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tkb-chip-btn {
  background-color: #ffffff;
  border: 1px solid var(--tkb-gold);
  color: var(--tkb-olive-dark);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.tkb-chip-btn:hover {
  background-color: var(--tkb-gold);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Typing Indicator Animation */
.tkb-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background-color: #ffffff;
  border-radius: 14px;
  width: fit-content;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

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

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

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

/* Chat Input Footer */
.tkb-chat-footer {
  padding: 12px 14px;
  background-color: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.tkb-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #f7f6f2;
  border: 1px solid rgba(197, 160, 89, 0.4);
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
  transition: border-color 0.2s;
}

.tkb-input-container:focus-within {
  border-color: var(--tkb-gold);
  box-shadow: 0 0 0 2px rgba(197, 160, 89, 0.2);
}

.tkb-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  outline: none;
  color: var(--tkb-text-dark);
  padding: 6px 0;
  font-family: inherit;
}

.tkb-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tkb-olive);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.15s;
}

.tkb-send-btn:hover {
  background-color: var(--tkb-gold);
  transform: scale(1.05);
}

.tkb-send-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.tkb-footer-note {
  font-size: 10px;
  color: var(--tkb-text-muted);
  text-align: center;
  margin-top: 6px;
}

/* Direct Action Buttons / CTA Chips */
.tkb-action-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(197, 160, 89, 0.35);
}

.tkb-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--tkb-olive) 0%, var(--tkb-olive-dark) 100%);
  color: #ffffff !important;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--tkb-gold);
  text-decoration: none !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.tkb-action-chip:hover {
  background: linear-gradient(135deg, var(--tkb-gold) 0%, #aa853c 100%);
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.4);
}

/* Session Continuity Divider */
.tkb-session-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 12px 0;
  color: var(--tkb-text-muted);
  font-size: 11px;
}

.tkb-session-divider::before,
.tkb-session-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.12);
}

.tkb-session-divider span {
  padding: 0 10px;
  background: transparent;
}

/* Proactive Greeting / Teaser Bubble */
.tkb-teaser-bubble {
  position: fixed;
  bottom: 96px;
  left: 24px;
  max-width: 280px;
  background-color: #ffffff;
  border: 1.5px solid var(--tkb-gold);
  border-radius: 14px;
  padding: 12px 32px 12px 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  z-index: 99998;
  cursor: pointer;
  animation: tkbTeaserIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: opacity 0.2s, transform 0.2s;
}

.tkb-teaser-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(197, 160, 89, 0.3);
}

.tkb-teaser-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 24px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #ffffff;
}

.tkb-teaser-bubble::before {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 23px;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid var(--tkb-gold);
}

.tkb-teaser-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--tkb-text-dark);
  font-weight: 500;
}

.tkb-teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--tkb-text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.tkb-teaser-close:hover {
  color: var(--tkb-text-dark);
}

@keyframes tkbTeaserIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Mobile responsive full screen on small screens */
@media (max-width: 480px) {
  .tkb-chat-launcher {
    bottom: 20px;
    left: 20px;
  }
  .tkb-teaser-bubble {
    bottom: 90px;
    left: 16px;
    max-width: calc(100vw - 32px);
  }
  .tkb-chat-window {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    border: none;
    z-index: 10000000 !important;
  }
  .tkb-chat-footer {
    padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
  }
}
