/* Self-contained widget layer. Some subpages do not load van-car.min.css. */
#vc-chat,
#vc-chat * {
  box-sizing: border-box;
}

#vc-chat {
  position: fixed;
  right: 28px;
  bottom: 28px;
  left: auto;
  z-index: 60;
  font-family: Inter, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* Pływająca słuchawka nad chatbotem — czerwono-czarna, spójna z navbarem */
#vc-chat .vc-chat__phone {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #18181c 0%, #0c0c0e 100%);
  border: 1px solid rgba(255, 18, 48, 0.62);
  color: #ff1230;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 18, 48, 0.12);
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
  animation: vcChatPhonePulse 2.6s ease-in-out infinite;
}
#vc-chat .vc-chat__phone svg {
  width: 23px;
  height: 23px;
  animation: vcChatPhoneBreathe 2.6s ease-in-out infinite;
}
#vc-chat .vc-chat__phone:hover {
  background: linear-gradient(135deg, #ff1230 0%, #b90018 100%);
  border-color: rgba(255, 18, 48, 0.95);
  color: #fff;
  transform: translateY(-2px);
  animation-play-state: paused;
}
#vc-chat .vc-chat__phone:hover svg { animation-play-state: paused; }
#vc-chat .vc-chat__phone::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 18, 48, 0.45);
  animation: vcChatPhonePing 2.8s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}
@keyframes vcChatPhonePing {
  0%   { transform: scale(1);    opacity: 0.6; }
  70%  { transform: scale(1.45); opacity: 0.1; }
  100% { transform: scale(1.6);  opacity: 0; }
}
@keyframes vcChatPhonePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.07); }
}
@keyframes vcChatPhoneBreathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.16); }
}
@media (prefers-reduced-motion: reduce) {
  #vc-chat .vc-chat__phone::after { animation: none; opacity: 0.4; }
  #vc-chat .vc-chat__phone,
  #vc-chat .vc-chat__phone svg { animation: none; }
}

#vc-chat .vc-chat__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 182px;
  padding: 11px 18px 11px 14px;
  border: 1px solid rgba(143, 177, 255, 0.26);
  border-radius: 50px;
  background: linear-gradient(135deg, rgba(11, 18, 36, 0.98), rgba(20, 32, 58, 0.98));
  color: #f5f7ff;
  box-shadow: 0 10px 28px rgba(4, 10, 24, 0.42);
  cursor: pointer;
  font: 700 0.875rem/1.2 inherit;
}

#vc-chat .vc-chat__trigger:focus-visible,
#vc-chat button:focus-visible,
#vc-chat a:focus-visible,
#vc-chat input:focus-visible {
  outline: 2px solid #e8d4a8;
  outline-offset: 3px;
}

#vc-chat .vc-chat__trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid rgba(200, 169, 110, 0.18);
  border-radius: 50%;
  background: rgba(200, 169, 110, 0.12);
  color: #e8d4a8;
}

#vc-chat .vc-chat__trigger-copy {
  display: grid;
  gap: 2px;
  text-align: left;
}

#vc-chat .vc-chat__trigger-copy strong {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#vc-chat .vc-chat__trigger-copy small {
  font-size: 11px;
  font-weight: 500;
}

#vc-chat .vc-chat__window {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  left: auto;
  display: flex;
  width: 320px;
  height: min(460px, calc(100dvh - 120px));
  max-height: calc(100dvh - 120px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(200, 169, 110, 0.25);
  border-radius: 14px;
  background: #080808;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#vc-chat .vc-chat__window.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

#vc-chat .vc-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(200, 169, 110, 0.15);
  background: #0f0f0f;
}

#vc-chat .vc-chat__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f3eee3;
  font-size: 0.875rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#vc-chat .vc-chat__badge {
  min-height: 22px;
  padding: 4px 8px;
  border: 1px solid rgba(136, 171, 238, 0.2);
  border-radius: 999px;
  background: rgba(32, 46, 78, 0.45);
  color: rgba(225, 235, 255, 0.72);
  font-size: 0.62rem;
  font-weight: 500;
}

#vc-chat .vc-chat__close {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  font-size: 1rem;
}

#vc-chat .vc-chat__messages {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 14px 14px 8px;
}

#vc-chat .vc-chat__msg {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
}

#vc-chat .vc-chat__msg a {
  color: #e8d4a8;
}

#vc-chat .vc-chat__msg--bot {
  align-self: flex-start;
  border: 1px solid rgba(200, 169, 110, 0.14);
  border-radius: 4px 12px 12px;
  background: rgba(200, 169, 110, 0.08);
  color: rgba(255, 255, 255, 0.88);
}

#vc-chat .vc-chat__msg--user {
  align-self: flex-end;
  border-radius: 12px 4px 12px 12px;
  background: rgba(200, 169, 110, 0.18);
  color: #e8d4a8;
}

#vc-chat .vc-chat__quick {
  display: flex;
  max-height: 92px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
  overflow-y: auto;
  padding: 8px 12px 4px;
  border-top: 1px solid rgba(200, 169, 110, 0.1);
}

#vc-chat .vc-chat__quick-btn,
#vc-chat .vc-chat__suggestion {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid rgba(200, 169, 110, 0.24);
  border-radius: 999px;
  background: rgba(200, 169, 110, 0.08);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font: 600 0.68rem/1.2 inherit;
}

#vc-chat .vc-chat__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 0 0 auto;
  gap: 7px;
  padding: 8px 12px 0;
}

#vc-chat .vc-chat__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 8px;
  border: 1px solid rgba(200, 169, 110, 0.26);
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

#vc-chat .vc-chat__action--primary {
  border-color: rgba(8, 102, 255, 0.72);
  background: rgba(8, 102, 255, 0.2);
  color: #c7dcff;
}

#vc-chat .vc-chat__form {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(200, 169, 110, 0.12);
}

#vc-chat .vc-chat__input {
  min-width: 0;
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(200, 169, 110, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font: 0.82rem/1.3 inherit;
}

#vc-chat .vc-chat__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid rgba(200, 169, 110, 0.3);
  border-radius: 8px;
  background: rgba(200, 169, 110, 0.15);
  color: #e8d4a8;
  cursor: pointer;
}

.vc-chat__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.vc-chat__suggestion {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid rgba(200, 169, 110, 0.28);
  border-radius: 999px;
  background: rgba(200, 169, 110, 0.1);
  color: #e8d4a8;
  cursor: pointer;
  font: 600 0.68rem/1.2 inherit;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.vc-chat__suggestion:hover,
.vc-chat__suggestion:focus-visible {
  border-color: rgba(200, 169, 110, 0.7);
  background: rgba(200, 169, 110, 0.2);
  color: #fff;
}

@media (max-width: 768px) {
  #vc-chat.vc-chat--hero-gated {
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(100% + 24px));
  }

  #vc-chat {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: 56px;
    grid-template-rows: 56px 56px;
    align-items: end;
    gap: 10px;
    max-width: 56px;
  }

  #vc-chat .vc-chat__phone {
    grid-column: 1;
    grid-row: 1;
    width: 56px;
    height: 56px;
    margin: 0;
  }

  #vc-chat .vc-chat__trigger {
    grid-column: 1;
    grid-row: 2;
    justify-content: center;
    width: 56px;
    min-width: 0;
    height: 56px;
    padding: 0;
    border-radius: 50%;
  }

  #vc-chat .vc-chat__trigger-copy {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  #vc-chat .vc-chat__window {
    width: min(342px, calc(100vw - 32px));
    height: min(540px, calc(100dvh - 100px));
    max-height: calc(100dvh - 100px);
  }

  .vc-chat__quick {
    max-height: 112px;
  }

  .vc-chat__quick-btn,
  .vc-chat__suggestion,
  .vc-chat__action,
  .vc-chat__send,
  .vc-chat__close {
    min-height: 44px;
  }

  .vc-chat__quick-btn,
  .vc-chat__suggestion {
    padding: 8px 11px;
  }

  .vc-chat__close {
    min-width: 44px;
    margin: -10px -10px -10px 0;
  }

  .vc-chat__send {
    min-width: 44px;
    padding: 8px;
  }
}

@media (max-width: 360px) {
  #vc-chat {
    grid-template-columns: 48px;
    grid-template-rows: 48px 48px;
    gap: 8px;
    max-width: 48px;
    right: 12px;
  }

  #vc-chat .vc-chat__phone {
    width: 48px;
    height: 48px;
  }

  #vc-chat .vc-chat__trigger {
    width: 48px;
    height: 48px;
    min-width: 0;
    padding: 0;
  }
}

@media (max-width: 768px) {
  body #vc-chat .vc-chat__trigger {
    width: 56px !important;
    min-width: 0 !important;
    max-width: 56px !important;
    height: 56px !important;
    padding: 0 !important;
  }

  body.page-blog #vc-chat .vc-chat__trigger,
  body.page-realizacje #vc-chat .vc-chat__trigger,
  body.page-tracking #vc-chat .vc-chat__trigger,
  body.subpage--blog #vc-chat .vc-chat__trigger,
  body.subpage--realizacje #vc-chat .vc-chat__trigger,
  body.tracking-page #vc-chat .vc-chat__trigger {
    width: 56px !important;
    min-width: 0 !important;
    max-width: 56px !important;
    height: 56px !important;
    padding: 0 !important;
  }
}

@media (max-width: 360px) {
  body #vc-chat .vc-chat__trigger {
    width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
  }

  body.page-blog #vc-chat .vc-chat__trigger,
  body.page-realizacje #vc-chat .vc-chat__trigger,
  body.page-tracking #vc-chat .vc-chat__trigger,
  body.subpage--blog #vc-chat .vc-chat__trigger,
  body.subpage--realizacje #vc-chat .vc-chat__trigger,
  body.tracking-page #vc-chat .vc-chat__trigger {
    width: 48px !important;
    min-width: 0 !important;
    max-width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
  }
}

@media (max-width: 900px) {
  body.page-kalkulator #vc-chat {
    display: none;
  }
}
