/* =========================================================================
 * Click 360 – Szybki kontakt
 * Pływający przycisk (dół, prawa strona) + panel w stylu okna czatu.
 * Na telefonie panel wysuwa się od dołu jako „bottom sheet”.
 * Kolory: --c3qc-accent i --c3qc-accent-dark są ustawiane z PHP (USTAWIENIA).
 * ========================================================================= */

.c3qc {
  --c3qc-accent: #0085a1;
  --c3qc-accent-dark: #006b82;
  --c3qc-accent-soft: rgba(0, 133, 161, 0.08);
  --c3qc-bg: #ffffff;
  --c3qc-text: #1d1d1f;
  --c3qc-muted: #5f6b72;
  --c3qc-border: #e9eef1;
  --c3qc-radius: 18px;
  --c3qc-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  --c3qc-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --c3qc-duration: 0.32s;
  --c3qc-width: 400px;
  --c3qc-offset: 24px;
  --c3qc-z: 9990;

  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
}

.c3qc *,
.c3qc *::before,
.c3qc *::after {
  box-sizing: border-box;
}

.c3qc svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* -------------------------------------------------------------------------
 * Pływający przycisk (FAB)
 * ---------------------------------------------------------------------- */

.c3qc-fab {
  position: fixed;
  right: var(--c3qc-offset);
  bottom: calc(var(--c3qc-offset) + env(safe-area-inset-bottom, 0px));
  z-index: var(--c3qc-z);

  display: inline-flex;
  align-items: center;
  gap: 10px;

  height: 56px;
  margin: 0;
  padding: 0 22px 0 16px;
  border: 0;
  border-radius: 999px;

  background: var(--c3qc-accent);
  color: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);

  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;

  transition:
    background-color 0.25s ease,
    transform var(--c3qc-duration) var(--c3qc-ease),
    opacity var(--c3qc-duration) var(--c3qc-ease),
    box-shadow 0.25s ease;
}

.c3qc--left .c3qc-fab {
  right: auto;
  left: var(--c3qc-offset);
}

.c3qc-fab:hover,
.c3qc-fab:focus-visible {
  background: var(--c3qc-accent-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
}

.c3qc-fab:focus-visible {
  outline: 2px solid var(--c3qc-accent);
  outline-offset: 3px;
}

.c3qc-fab__icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
}

/* Puls – rozchodzący się pierścień w kolorze akcentu (osobny pseudo-element,
   żeby nie kolidował z transformacjami przycisku na hover / przy otwarciu) */
.c3qc-fab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 var(--c3qc-accent);
  opacity: 0.7;
  pointer-events: none;
  animation: c3qc-pulse 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.c3qc-fab {
  position: fixed; /* potrzebne jako kontekst dla ::before */
}

.c3qc-fab:hover::before,
.c3qc-fab:focus-visible::before,
.c3qc.is-open .c3qc-fab::before {
  animation-play-state: paused;
  opacity: 0;
}

@keyframes c3qc-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--c3qc-accent);
    opacity: 0.7;
  }
  70% {
    box-shadow: 0 0 0 14px var(--c3qc-accent);
    opacity: 0;
  }
  100% {
    box-shadow: 0 0 0 0 var(--c3qc-accent);
    opacity: 0;
  }
}

.c3qc.is-open .c3qc-fab {
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  pointer-events: none;
}

/* -------------------------------------------------------------------------
 * Panel (desktop – okno nad przyciskiem)
 * ---------------------------------------------------------------------- */

.c3qc-panel {
  position: fixed;
  right: var(--c3qc-offset);
  bottom: calc(var(--c3qc-offset) + env(safe-area-inset-bottom, 0px));
  z-index: calc(var(--c3qc-z) + 2);

  display: flex;
  flex-direction: column;
  width: min(var(--c3qc-width), calc(100vw - 2 * var(--c3qc-offset)));
  max-height: calc(100vh - 2 * var(--c3qc-offset));
  max-height: calc(100dvh - 2 * var(--c3qc-offset));

  background: var(--c3qc-bg);
  color: var(--c3qc-text);
  border-radius: var(--c3qc-radius);
  box-shadow: var(--c3qc-shadow);
  overflow: hidden;

  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  transform-origin: bottom right;
  transition:
    transform var(--c3qc-duration) var(--c3qc-ease),
    opacity var(--c3qc-duration) var(--c3qc-ease),
    visibility 0s linear var(--c3qc-duration);
}

.c3qc--left .c3qc-panel {
  right: auto;
  left: var(--c3qc-offset);
  transform-origin: bottom left;
}

.c3qc.is-open .c3qc-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition:
    transform var(--c3qc-duration) var(--c3qc-ease),
    opacity var(--c3qc-duration) var(--c3qc-ease),
    visibility 0s linear 0s;
}

/* Nagłówek w kolorze akcentu */
.c3qc-panel__header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 18px 22px;
  background: var(--c3qc-accent);
  color: #fff;
}

.c3qc-panel__title {
  margin: 0 0 4px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
}

.c3qc-panel__subtitle {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
}

.c3qc-panel__close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: -6px -6px 0 0;
  padding: 8px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.c3qc-panel__close:hover,
.c3qc-panel__close:focus-visible {
  background: rgba(255, 255, 255, 0.3);
  outline: none;
}

/* Telefon i e-mail – „pigułki” pod nagłówkiem */
.c3qc-panel__links {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--c3qc-border);
}

.c3qc-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: var(--c3qc-accent-soft);
  color: var(--c3qc-accent);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.c3qc-link:hover,
.c3qc-link:focus-visible {
  background: var(--c3qc-accent);
  color: #fff;
  text-decoration: none;
  outline: none;
}

.c3qc-link__icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

/* Treść (formularz) – przewija się, gdy jest długa */
.c3qc-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 22px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.c3qc-panel__placeholder {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--c3qc-accent);
  border-radius: 10px;
  font-size: 13px;
  color: var(--c3qc-muted);
}

/* -------------------------------------------------------------------------
 * Formularz Contact Form 7 w wąskim panelu (reguły ogólne, bez zależności
 * od stylów motywu)
 * ---------------------------------------------------------------------- */

.c3qc-panel .wpcf7 form {
  margin: 0;
}

.c3qc-panel .wpcf7 form > p,
.c3qc-panel .wpcf7 form > div {
  margin: 0 0 10px;
}

.c3qc-panel .wpcf7 br {
  display: none;
}

.c3qc-panel .wpcf7 input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
.c3qc-panel .wpcf7 textarea,
.c3qc-panel .wpcf7 select {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  font-size: 14px;
}

.c3qc-panel .wpcf7 textarea {
  min-height: 110px;
  max-height: 180px;
  resize: vertical;
}

.c3qc-panel .wpcf7 input[type="submit"],
.c3qc-panel .wpcf7 button[type="submit"] {
  display: block;
  width: 100%;
  cursor: pointer;
}

.c3qc-panel .wpcf7 .wpcf7-list-item {
  margin-left: 0;
}

.c3qc-panel .wpcf7 .wpcf7-acceptance,
.c3qc-panel .wpcf7 .wpcf7-acceptance + p,
.c3qc-panel .wpcf7 small {
  font-size: 12px;
  line-height: 1.45;
  color: var(--c3qc-muted);
}

.c3qc-panel .wpcf7 .wpcf7-spinner {
  display: block;
  margin: 8px auto 0;
}

.c3qc-panel .wpcf7 .wpcf7-response-output {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-size: 13px;
  border-radius: 10px;
}

/* -------------------------------------------------------------------------
 * Tło przyciemniające – używane tylko na telefonie
 * ---------------------------------------------------------------------- */

.c3qc-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--c3qc-z) + 1);
  display: none;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity var(--c3qc-duration) ease;
}

/* -------------------------------------------------------------------------
 * Telefon / mały ekran – przycisk jako kółko, panel od dołu
 * ---------------------------------------------------------------------- */

@media (max-width: 768px) {
  .c3qc {
    --c3qc-offset: 16px;
  }

  .c3qc-fab {
    width: 56px;
    padding: 0;
    justify-content: center;
  }

  .c3qc-fab__label {
    display: none;
  }

  .c3qc-backdrop {
    display: block;
    pointer-events: none;
  }

  .c3qc.is-open .c3qc-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .c3qc-panel,
  .c3qc--left .c3qc-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: var(--c3qc-radius) var(--c3qc-radius) 0 0;
    transform: translateY(100%);
    transform-origin: bottom center;
  }

  .c3qc.is-open .c3qc-panel {
    transform: translateY(0);
  }

  .c3qc-panel__body {
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }
}

/* blokada przewijania strony, gdy panel jest otwarty na telefonie */
html.c3qc-lock,
html.c3qc-lock body {
  overflow: hidden;
}

/* -------------------------------------------------------------------------
 * Dostępność – bez animacji na życzenie użytkownika
 * ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .c3qc-fab,
  .c3qc-panel,
  .c3qc-backdrop,
  .c3qc-link {
    transition: none;
  }

  .c3qc-fab::before {
    display: none;
    animation: none;
  }
}
