/* webstronni.pl chat widget — standalone, scoped .wsn-chat- */

.wsn-chat-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-primary, #5B4FE9);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(91, 79, 233, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform 0.2s, box-shadow 0.2s;
}

.wsn-chat-button:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(91, 79, 233, 0.5);
}

.wsn-chat-button svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.wsn-chat-button.wsn-chat-pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid var(--color-primary, #5B4FE9);
  animation: wsn-chat-pulse-anim 1.4s ease-out 1;
}

@keyframes wsn-chat-pulse-anim {
  0% { transform: scale(0.95); opacity: 0.7; }
  100% { transform: scale(1.4); opacity: 0; }
}

.wsn-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  height: 520px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(26, 23, 51, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: #1A1733;
  transform-origin: bottom right;
  animation: wsn-chat-open 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.wsn-chat-panel.wsn-chat-open {
  display: flex;
}

@keyframes wsn-chat-open {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.wsn-chat-header {
  background: linear-gradient(135deg, #5B4FE9, #FF6B6B);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.wsn-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wsn-chat-avatar svg { width: 20px; height: 20px; fill: white; }

.wsn-chat-header-text { flex: 1; }
.wsn-chat-title { font-weight: 600; font-size: 14px; line-height: 1.2; }
.wsn-chat-status {
  font-size: 12px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.wsn-chat-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ADE80;
}

.wsn-chat-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}
.wsn-chat-close:hover { background: rgba(255, 255, 255, 0.2); }

.wsn-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FAFAFA;
}

.wsn-chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.wsn-chat-msg-assistant {
  align-self: flex-start;
  background: #F3F2FF;
  color: #1A1733;
  border-radius: 16px 16px 16px 4px;
}

.wsn-chat-msg-user {
  align-self: flex-end;
  background: var(--color-primary, #5B4FE9);
  color: white;
  border-radius: 16px 16px 4px 16px;
}

.wsn-chat-msg-system {
  align-self: center;
  background: #FFF4F4;
  color: #B91C1C;
  border-radius: 8px;
  font-size: 13px;
  padding: 8px 12px;
}

.wsn-chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: #F3F2FF;
  border-radius: 16px 16px 16px 4px;
}

.wsn-chat-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5B4FE9;
  animation: wsn-chat-typing-dot 1.2s infinite;
}
.wsn-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.wsn-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wsn-chat-typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.wsn-chat-cta {
  margin: 4px 0;
  padding: 12px 16px;
  background: linear-gradient(135deg, #5B4FE9, #FF6B6B);
  border-radius: 12px;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.wsn-chat-cta button {
  background: white;
  color: #5B4FE9;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.15s;
}
.wsn-chat-cta button:hover { transform: translateY(-1px); }

.wsn-chat-input-area {
  border-top: 1px solid #E8E6F8;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: white;
}

.wsn-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.wsn-chat-input {
  flex: 1;
  border: 1px solid #E8E6F8;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 90px;
  min-height: 38px;
  transition: border-color 0.15s;
}
.wsn-chat-input:focus { border-color: var(--color-primary, #5B4FE9); outline: none; }
.wsn-chat-input:focus-visible { outline: 2px solid var(--color-primary, #5B4FE9); outline-offset: 2px; }
.wsn-chat-input:disabled { background: #F3F2FF; cursor: not-allowed; }

.wsn-chat-send {
  background: var(--color-primary, #5B4FE9);
  color: white;
  border: none;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}
.wsn-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.wsn-chat-send svg { width: 18px; height: 18px; fill: white; }

.wsn-chat-meta {
  font-size: 11px;
  color: #5E5B7A;
  display: flex;
  justify-content: space-between;
}

@media (max-width: 768px) {
  .wsn-chat-panel {
    width: 100vw;
    height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  .wsn-chat-button { bottom: 16px; right: 16px; }
}
