/* CyfrowyStrażak.pl - Chat widget */
#cs-chat-root,
#cs-chat-root * {
  box-sizing: border-box;
}

#cs-chat-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: #e5e7eb;
}

.cs-chat-button {
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(135deg, #ef4444, #f97316 45%, #2563eb);
  color: #fff;
  box-shadow: 0 18px 50px rgba(239, 68, 68, .35), 0 8px 22px rgba(0, 0, 0, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, filter .18s ease;
}

.cs-chat-button:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
}

.cs-chat-button svg {
  width: 29px;
  height: 29px;
}

.cs-chat-window {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(390px, calc(100vw - 28px));
  height: min(640px, calc(100vh - 110px));
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 24px;
  overflow: hidden;
  background: #0d1117;
  box-shadow: 0 26px 80px rgba(0, 0, 0, .58);
  display: none;
}

#cs-chat-root.cs-open .cs-chat-window {
  display: flex;
  flex-direction: column;
}

.cs-chat-header {
  position: relative;
  padding: 16px 16px 14px;
  background: linear-gradient(135deg, rgba(239, 68, 68, .22), rgba(37, 99, 235, .14)), #111827;
  border-bottom: 1px solid rgba(148, 163, 184, .14);
}

.cs-chat-topbar {
  height: 4px;
  background: linear-gradient(90deg, #ef4444, #f97316, #3b82f6, #ef4444);
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
}

.cs-chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cs-chat-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(239, 68, 68, .14);
  border: 1px solid rgba(239, 68, 68, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.cs-chat-logo img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.cs-chat-title strong {
  display: block;
  font-size: 15px;
  color: #fff;
  line-height: 1.15;
}

.cs-chat-title span {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
}

.cs-chat-close {
  position: absolute;
  right: 12px;
  top: 14px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, .16);
  background: rgba(15, 23, 42, .55);
  color: #cbd5e1;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
}

.cs-chat-close:hover {
  background: rgba(239, 68, 68, .16);
  color: #fff;
}

.cs-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  background:
    radial-gradient(circle at 18% 0%, rgba(239, 68, 68, .08), transparent 24%),
    radial-gradient(circle at 88% 12%, rgba(37, 99, 235, .08), transparent 22%),
    #0b1020;
}

.cs-chat-msg {
  display: flex;
  margin: 0 0 12px;
}

.cs-chat-msg.user {
  justify-content: flex-end;
}

.cs-chat-bubble {
  max-width: 86%;
  border-radius: 18px;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.52;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.cs-chat-msg.assistant .cs-chat-bubble {
  background: rgba(30, 41, 59, .94);
  border: 1px solid rgba(148, 163, 184, .14);
  color: #dbeafe;
  border-top-left-radius: 7px;
}

.cs-chat-msg.user .cs-chat-bubble {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-top-right-radius: 7px;
}

.cs-chat-suggestions {
  padding: 0 14px 12px;
  background: #0b1020;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cs-chat-suggestion {
  border: 1px solid rgba(96, 165, 250, .25);
  background: rgba(37, 99, 235, .09);
  color: #bfdbfe;
  border-radius: 999px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

.cs-chat-suggestion:hover {
  background: rgba(37, 99, 235, .2);
}

.cs-chat-form {
  border-top: 1px solid rgba(148, 163, 184, .14);
  background: #0d1117;
  padding: 12px;
  display: flex;
  gap: 9px;
}

.cs-chat-input {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 110px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, .18);
  background: #111827;
  color: #fff;
  outline: 0;
  padding: 12px 13px;
  font-size: 13px;
  line-height: 1.35;
}

.cs-chat-input:focus {
  border-color: rgba(59, 130, 246, .66);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}

.cs-chat-send {
  width: 46px;
  height: 44px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 16px;
  background: #ef4444;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cs-chat-send:hover {
  background: #f97316;
}

.cs-chat-send:disabled,
.cs-chat-input:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.cs-chat-typing {
  opacity: .75;
}

.cs-chat-typing .cs-chat-bubble::after {
  content: '...';
  animation: csBlink 1.1s infinite;
}

@keyframes csBlink {
  0%, 100% { opacity: .25; }
  50% { opacity: 1; }
}

@media (max-width: 520px) {
  #cs-chat-root {
    right: 12px;
    bottom: 12px;
  }

  .cs-chat-window {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 86px;
    width: auto;
    height: min(650px, calc(100vh - 104px));
    border-radius: 20px;
  }

  .cs-chat-button {
    width: 58px;
    height: 58px;
  }
}
