/* ============================================================
   KYNTHOR CHATBOT WIDGET — STYLES
   Dopasowane do kolorystyki strony kynthor.pl
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --kynthor-primary: #0d2f6e;
  --kynthor-primary-hover: #0a2458;
  --kynthor-primary-light: #132040;
  --kynthor-gold: #d4af37;
  --kynthor-gold-dark: #b8952e;
  --kynthor-bg: #0e1324;
  --kynthor-bg-secondary: #161d30;
  --kynthor-text: #e8e8e8;
  --kynthor-text-light: #a8a8a8;
  --kynthor-border: rgba(212, 175, 55, 0.15);
  --kynthor-border-strong: rgba(212, 175, 55, 0.3);
  --kynthor-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  --kynthor-radius: 14px;
  --kynthor-font: 'Inter', "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---------- Toggle Button ---------- */
#kynthor-chat-toggle {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4af37 0%, #f4d03f 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.35);
  z-index: 99998;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#kynthor-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(212, 175, 55, 0.5);
}

#kynthor-chat-toggle svg {
  width: 26px;
  height: 26px;
  fill: #0a0e1a;
  transition: transform 0.25s ease;
}

#kynthor-chat-toggle.kynthor-open svg {
  transform: rotate(90deg) scale(0.9);
}

/* ---------- Chat Window ---------- */
#kynthor-chat-window {
  position: fixed;
  bottom: 164px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: var(--kynthor-bg);
  border-radius: var(--kynthor-radius);
  box-shadow: var(--kynthor-shadow);
  display: flex;
  flex-direction: column;
  z-index: 99999;
  overflow: hidden;
  border: 1px solid var(--kynthor-border-strong);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#kynthor-chat-window.kynthor-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- Header ---------- */
#kynthor-chat-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 18px 18px;
  background: var(--kynthor-bg);
  border-bottom: 1px solid var(--kynthor-border-strong);
  flex-shrink: 0;
}

#kynthor-chat-header-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

#kynthor-chat-header-name {
  font-family: var(--kynthor-font);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #d4af37 0%, #f4d03f 50%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#kynthor-chat-header-status {
  font-family: var(--kynthor-font);
  font-size: 11px;
  color: var(--kynthor-text-light);
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#kynthor-chat-close {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--kynthor-text-light);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-family: var(--kynthor-font);
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

#kynthor-chat-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--kynthor-text);
}

/* ---------- Messages ---------- */
#kynthor-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#kynthor-chat-messages::-webkit-scrollbar {
  width: 5px;
}

#kynthor-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#kynthor-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.2);
  border-radius: 10px;
}

.kynthor-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  font-family: var(--kynthor-font);
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  animation: kynthor-msg-in 0.2s ease;
}

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

.kynthor-msg-user {
  align-self: flex-end;
  background: var(--kynthor-primary);
  color: #e8e8e8;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom-right-radius: 4px;
}

.kynthor-msg-bot {
  align-self: flex-start;
  background: var(--kynthor-bg-secondary);
  color: var(--kynthor-text);
  border: 1px solid var(--kynthor-border);
  border-bottom-left-radius: 4px;
}

/* ---------- Typing indicator ---------- */
.kynthor-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  align-self: flex-start;
  background: var(--kynthor-bg-secondary);
  border: 1px solid var(--kynthor-border);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

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

.kynthor-typing-dot:nth-child(1) {
  animation-delay: 0s;
}

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

.kynthor-typing-dot:nth-child(3) {
  animation-delay: 0.32s;
}

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

/* ---------- Input area ---------- */
#kynthor-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--kynthor-border-strong);
  background: var(--kynthor-bg);
  flex-shrink: 0;
}

#kynthor-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--kynthor-border-strong);
  border-radius: 10px;
  font-family: var(--kynthor-font);
  font-size: 14px;
  color: var(--kynthor-text);
  background: var(--kynthor-bg-secondary);
  outline: none;
  transition: border-color 0.15s ease;
  resize: none;
}

#kynthor-chat-input::placeholder {
  color: var(--kynthor-text-light);
}

#kynthor-chat-input:focus {
  border-color: var(--kynthor-gold-dark);
}

#kynthor-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #d4af37 0%, #f4d03f 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}

#kynthor-chat-send:hover {
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

#kynthor-chat-send:active {
  transform: scale(0.94);
}

#kynthor-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#kynthor-chat-send svg {
  width: 18px;
  height: 18px;
  fill: #0a0e1a;
}

/* ---------- Welcome message ---------- */
.kynthor-welcome {
  text-align: center;
  padding: 20px 16px 8px;
  font-family: var(--kynthor-font);
  font-size: 13px;
  color: var(--kynthor-text-light);
  line-height: 1.5;
}

/* ---------- Mobile ≤767px ---------- */
@media (max-width: 767px) {
  /* Przycisk chatbota: prawy dolny róg, obok sticky CTA */
  #kynthor-chat-toggle {
    bottom: 6px;
    right: 8px;
    width: 48px;
    height: 48px;
    z-index: 1001;
  }

  #kynthor-chat-toggle svg {
    width: 22px;
    height: 22px;
  }

  /* Okno czatu: pełny ekran na mobile */
  #kynthor-chat-window {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }

  #kynthor-chat-toggle.kynthor-open {
    display: none;
  }
}

/* ---------- Mobile ≤480px ---------- */
@media (max-width: 480px) {
  #kynthor-chat-toggle {
    bottom: 4px;
    right: 6px;
    width: 44px;
    height: 44px;
  }

  #kynthor-chat-toggle svg {
    width: 20px;
    height: 20px;
  }
}
