/**
 * FAQ Chatbot Widget - Pc Service Gliwice
 * Wersja: 2.1.0 (Vanilla JS & CSS - Zero Zależności)
 * Nowości: Dymek zaczepny (Teaser), Kontekstowe Follow-upy, Kreator Diagnozy, Audio Web API
 */

:root {
  --fc-primary: #be1e2d;
  --fc-primary-hover: #9e1824;
  --fc-primary-light: rgba(190, 30, 45, 0.08);
  --fc-primary-border: rgba(190, 30, 45, 0.22);
  --fc-bg: #ffffff;
  --fc-bg-chat: #f8f9fa;
  --fc-text: #212529;
  --fc-text-muted: #6c757d;
  --fc-bot-bubble-bg: #ffffff;
  --fc-bot-bubble-text: #212529;
  --fc-bot-bubble-border: rgba(0, 0, 0, 0.06);
  --fc-user-bubble-bg: #be1e2d;
  --fc-user-bubble-text: #ffffff;
  --fc-chip-bg: #ffffff;
  --fc-chip-text: #be1e2d;
  --fc-chip-border: rgba(190, 30, 45, 0.25);
  --fc-footer-bg: #ffffff;
  --fc-input-bg: #f8f9fa;
  --fc-input-border: rgba(0, 0, 0, 0.1);
  --fc-border: rgba(0, 0, 0, 0.08);
  --fc-shadow: 0 12px 36px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.08);
  --fc-fab-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  --fc-radius: 16px;
  --fc-transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tryb Ciemny */
@media (prefers-color-scheme: dark) {
  :root {
    --fc-bg: #161618;
    --fc-bg-chat: #101012;
    --fc-text: #e2e2e8;
    --fc-text-muted: #9a9aa2;
    --fc-bot-bubble-bg: #1e1e22;
    --fc-bot-bubble-text: #e8e8ed;
    --fc-bot-bubble-border: rgba(255, 255, 255, 0.08);
    --fc-chip-bg: #1e1e22;
    --fc-chip-text: #ff6b77;
    --fc-chip-border: rgba(190, 30, 45, 0.4);
    --fc-footer-bg: #161618;
    --fc-input-bg: #1e1e22;
    --fc-input-border: rgba(255, 255, 255, 0.1);
    --fc-border: rgba(255, 255, 255, 0.08);
    --fc-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

/* ==========================================================================
   1. Floating Action Button (FAB)
   ========================================================================== */
#faq-chat-fab {
  position: fixed;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  right: calc(20px + env(safe-area-inset-right, 0px));
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--fc-primary);
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: var(--fc-fab-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1050;
  transition: var(--fc-transition);
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

#faq-chat-fab:hover {
  background-color: var(--fc-primary-hover);
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 12px 28px rgba(190, 30, 45, 0.35);
}

#faq-chat-fab:active {
  transform: scale(0.96);
}

#faq-chat-fab:focus-visible {
  box-shadow: 0 0 0 3px rgba(190, 30, 45, 0.4), var(--fc-fab-shadow);
}

/* Ikony w FAB */
.faq-chat-fab-icon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.faq-chat-fab-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.faq-chat-fab-icon--close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

#faq-chat-fab.active .faq-chat-fab-icon--open {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

#faq-chat-fab.active .faq-chat-fab-icon--close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Wskaźnik statusu online/offline na FAB */
.faq-chat-fab-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 14px;
  height: 14px;
  background-color: #28a745;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s ease;
}

.faq-chat-fab-badge::after {
  content: '';
  position: absolute;
  top: -2.5px;
  left: -2.5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #28a745;
  animation: fcFabPulse 2.2s infinite ease-out;
  pointer-events: none;
}

.faq-chat-fab-badge--closed {
  background-color: #f39c12 !important;
  box-shadow: 0 0 8px rgba(243, 156, 18, 0.85) !important;
}

.faq-chat-fab-badge--closed::after {
  border-color: #f39c12 !important;
  animation: fcFabPulseClosed 2.2s infinite ease-out !important;
}

@keyframes fcFabPulse {
  0% { transform: scale(0.9); opacity: 0.9; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes fcFabPulseClosed {
  0% { transform: scale(0.9); opacity: 0.9; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ==========================================================================
   2. Dymek zaczepny (Welcome Teaser Callout)
   ========================================================================== */
#faq-chat-teaser {
  position: fixed;
  bottom: calc(160px + env(safe-area-inset-bottom, 0px));
  right: calc(20px + env(safe-area-inset-right, 0px));
  width: 260px;
  background-color: var(--fc-bg);
  color: var(--fc-text);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--fc-border);
  z-index: 1049;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fcTeaserIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
}

#faq-chat-teaser:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

/* Strzałka wskazująca w stronę przycisku czatu */
#faq-chat-teaser::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 24px;
  width: 14px;
  height: 14px;
  background-color: var(--fc-bg);
  border-right: 1px solid var(--fc-border);
  border-bottom: 1px solid var(--fc-border);
  transform: rotate(45deg);
}

@keyframes fcTeaserIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.faq-chat-teaser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.faq-chat-teaser-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--fc-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.faq-chat-teaser-close {
  background: transparent;
  border: none;
  color: var(--fc-text-muted);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.faq-chat-teaser-close:hover {
  background-color: rgba(0, 0, 0, 0.08);
  color: var(--fc-text);
}

.faq-chat-teaser-body {
  font-size: 0.82rem;
  line-height: 1.38;
}

/* ==========================================================================
   3. Okno czatu (Chat Window)
   ========================================================================== */
#faq-chat-window {
  position: fixed;
  bottom: calc(160px + env(safe-area-inset-bottom, 0px));
  right: calc(20px + env(safe-area-inset-right, 0px));
  width: 375px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 180px);
  background-color: var(--fc-bg);
  border-radius: var(--fc-radius);
  box-shadow: var(--fc-shadow);
  border: 1px solid var(--fc-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: var(--fc-transition);
  font-family: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

/* ==========================================================================
   4. Nagłówek czatu (Header)
   ========================================================================== */
.faq-chat-header {
  background: linear-gradient(135deg, var(--fc-primary) 0%, #9e1824 100%);
  color: #ffffff;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-top-left-radius: var(--fc-radius);
  border-top-right-radius: var(--fc-radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.faq-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.faq-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.faq-chat-avatar svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
}

.faq-chat-title-group {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.faq-chat-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: 0.2px;
}

.faq-chat-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
  margin-top: 2px;
}

.faq-chat-status-dot {
  width: 7px;
  height: 7px;
  background-color: #2ed573;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #2ed573;
  flex-shrink: 0;
}

.faq-chat-status-dot--closed {
  background-color: #f39c12 !important;
  box-shadow: 0 0 6px #f39c12 !important;
}

.faq-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.faq-chat-header-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  outline: none;
}

.faq-chat-header-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.faq-chat-header-btn:hover {
  background-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.faq-chat-header-btn.muted svg {
  opacity: 0.55;
}

/* ==========================================================================
   5. Ciało czatu i wiadomości (Body & Messages)
   ========================================================================== */
.faq-chat-body {
  flex: 1;
  background-color: var(--fc-bg-chat);
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.faq-chat-body::-webkit-scrollbar {
  width: 5px;
}
.faq-chat-body::-webkit-scrollbar-track {
  background: transparent;
}
.faq-chat-body::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
@media (prefers-color-scheme: dark) {
  .faq-chat-body::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
  }
}

.faq-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: fcMsgFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fcMsgFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.faq-chat-msg--bot {
  align-self: flex-start;
}

.faq-chat-msg--user {
  align-self: flex-end;
}

.faq-chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.faq-chat-msg--bot .faq-chat-bubble {
  background-color: var(--fc-bot-bubble-bg);
  color: var(--fc-bot-bubble-text);
  border: 1px solid var(--fc-bot-bubble-border);
  border-bottom-left-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.faq-chat-msg--bot .faq-chat-bubble p {
  margin: 0 0 8px 0;
}

.faq-chat-msg--bot .faq-chat-bubble p:last-child {
  margin-bottom: 0;
}

.faq-chat-msg--bot .faq-chat-bubble strong {
  color: var(--fc-primary);
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .faq-chat-msg--bot .faq-chat-bubble strong {
    color: #ff6b77;
  }
}

.faq-chat-msg--bot .faq-chat-bubble a {
  color: var(--fc-primary);
  text-decoration: underline;
  font-weight: 600;
}

.faq-chat-msg--bot .faq-chat-bubble ul,
.faq-chat-msg--bot .faq-chat-bubble ol {
  margin: 6px 0;
  padding-left: 18px;
}

.faq-chat-msg--bot .faq-chat-bubble li {
  margin-bottom: 4px;
}

.faq-chat-msg--user .faq-chat-bubble {
  background-color: var(--fc-user-bubble-bg);
  color: var(--fc-user-bubble-text);
  border-bottom-right-radius: 3px;
  box-shadow: 0 2px 8px rgba(190, 30, 45, 0.25);
}

.faq-chat-time {
  font-size: 0.68rem;
  color: var(--fc-text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.faq-chat-msg--user .faq-chat-time {
  align-self: flex-end;
}

/* ==========================================================================
   6. Kontekstowe podpowiedzi (Follow-up Action Chips)
   ========================================================================== */
.faq-chat-followups {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--fc-border);
}

.faq-chat-followups-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fc-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.faq-chat-followups-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.faq-chat-followup-chip {
  background-color: var(--fc-chip-bg);
  color: var(--fc-chip-text);
  border: 1px solid var(--fc-chip-border);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.faq-chat-followup-chip:hover {
  background-color: var(--fc-primary);
  color: #ffffff;
  border-color: var(--fc-primary);
  transform: translateY(-1px);
}

/* ==========================================================================
   7. Interaktywny Kreator Diagnozy (Troubleshooting Wizard)
   ========================================================================== */
.faq-chat-wizard-card {
  background: var(--fc-bot-bubble-bg);
  border: 1px solid var(--fc-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.faq-chat-wizard-step {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--fc-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.faq-chat-wizard-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--fc-text);
  margin-bottom: 10px;
}

.faq-chat-wizard-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.faq-chat-wizard-btn {
  background-color: var(--fc-input-bg);
  border: 1px solid var(--fc-border);
  color: var(--fc-text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.faq-chat-wizard-btn:hover {
  background-color: var(--fc-primary);
  color: #ffffff;
  border-color: var(--fc-primary);
  transform: translateX(3px);
  box-shadow: 0 3px 8px rgba(190, 30, 45, 0.25);
}

/* ==========================================================================
   8. Szybkie tematy (Quick Action Chips)
   ========================================================================== */
.faq-chat-chips-wrapper {
  margin-top: 4px;
  animation: fcMsgFadeIn 0.3s ease-out forwards;
}

.faq-chat-chips-label {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fc-text-muted);
  margin-bottom: 6px;
  display: block;
}

.faq-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.faq-chat-chip {
  background-color: var(--fc-chip-bg);
  color: var(--fc-chip-text);
  border: 1px solid var(--fc-chip-border);
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  user-select: none;
}

.faq-chat-chip:hover {
  background-color: var(--fc-primary);
  color: #ffffff;
  border-color: var(--fc-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(190, 30, 45, 0.25);
}

.faq-chat-chip:active {
  transform: translateY(0);
}

.faq-chat-chip--accent {
  background-color: rgba(190, 30, 45, 0.08);
  border-color: var(--fc-primary);
  font-weight: 600;
}

/* ==========================================================================
   9. Dynamiczne Karty Kontaktu i Przyciski Akcji
   ========================================================================== */
.faq-chat-contact-box {
  margin-top: 10px;
  padding: 10px 12px;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
  border: 1px solid var(--fc-border);
}
@media (prefers-color-scheme: dark) {
  .faq-chat-contact-box {
    background-color: rgba(255, 255, 255, 0.04);
  }
}

.faq-chat-contact-status {
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.faq-chat-contact-status--open {
  color: #28a745;
}

.faq-chat-contact-status--closed {
  color: #e67e22;
}

.faq-chat-contact-note {
  font-size: 0.8rem;
  color: var(--fc-text-muted);
  margin-bottom: 8px;
  line-height: 1.35;
}

.faq-chat-call-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background-color: rgba(227, 6, 19, 0.05);
  border-left: 3px solid var(--fc-primary);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 8px 0 10px 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--fc-text);
}

.faq-chat-call-tip a {
  color: var(--fc-primary);
  text-decoration: underline;
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .faq-chat-call-tip {
    background-color: rgba(255, 75, 75, 0.1);
  }
}

.faq-chat-btn-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 8px;
}

/* Nowoczesne Kafelki Akcji Serwisowej (Action Button Tiles) */
.faq-chat-btn-tile {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  text-decoration: none !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
  cursor: pointer;
}

.faq-chat-btn-tile-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.22s ease;
}

.faq-chat-btn-tile-icon svg {
  width: 20px;
  height: 20px;
}

.faq-chat-btn-tile-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.faq-chat-btn-tile-title {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.25;
}

.faq-chat-btn-tile-desc {
  font-size: 0.72rem;
  line-height: 1.2;
  margin-top: 2px;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.faq-chat-btn-tile-arrow {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  transition: transform 0.22s ease;
  opacity: 0.75;
}

.faq-chat-btn-tile-arrow svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.faq-chat-btn-tile:hover .faq-chat-btn-tile-arrow {
  transform: translateX(3px);
  opacity: 1;
}

.faq-chat-btn-tile:hover .faq-chat-btn-tile-icon {
  transform: scale(1.08);
}

/* Wariant Główny (Primary - Czerwień Pc Service / Umów wizytę) */
.faq-chat-btn-tile--primary {
  background: linear-gradient(135deg, #e30613 0%, #b8050f 100%);
  color: #ffffff !important;
  box-shadow: 0 3px 12px rgba(227, 6, 19, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.faq-chat-btn-tile--primary .faq-chat-btn-tile-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.faq-chat-btn-tile--primary .faq-chat-btn-tile-title {
  color: #ffffff;
}

.faq-chat-btn-tile--primary .faq-chat-btn-tile-desc {
  color: rgba(255, 255, 255, 0.9);
}

.faq-chat-btn-tile--primary .faq-chat-btn-tile-arrow {
  color: #ffffff;
}

.faq-chat-btn-tile--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(227, 6, 19, 0.38);
}

/* Wariant Wtórny (Secondary - Formularz kontaktowy / Umówienie alternatywne) */
.faq-chat-btn-tile--secondary {
  background: #ffffff;
  color: var(--fc-text) !important;
  border: 1.5px solid #e1e4e8;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.04);
}

.faq-chat-btn-tile--secondary .faq-chat-btn-tile-icon {
  background: rgba(227, 6, 19, 0.08);
  color: #e30613;
}

.faq-chat-btn-tile--secondary .faq-chat-btn-tile-title {
  color: var(--fc-text);
}

.faq-chat-btn-tile--secondary .faq-chat-btn-tile-desc {
  color: var(--fc-text-muted);
}

.faq-chat-btn-tile--secondary .faq-chat-btn-tile-arrow {
  color: var(--fc-text-muted);
}

.faq-chat-btn-tile--secondary:hover {
  border-color: #e30613;
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(227, 6, 19, 0.12);
}

@media (prefers-color-scheme: dark) {
  .faq-chat-btn-tile--secondary {
    background: #25262a;
    border-color: #383a40;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.25);
  }
  .faq-chat-btn-tile--secondary .faq-chat-btn-tile-icon {
    background: rgba(255, 75, 75, 0.15);
    color: #ff5252;
  }
  .faq-chat-btn-tile--secondary:hover {
    border-color: #ff5252;
    background: #2c2d33;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.35);
  }
}

/* Wariant Połączenia Telefonicznego (Call - Zadzwoń do serwisu) */
.faq-chat-btn-tile--call {
  background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
  color: #ffffff !important;
  box-shadow: 0 3px 12px rgba(40, 167, 69, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.faq-chat-btn-tile--call .faq-chat-btn-tile-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.faq-chat-btn-tile--call .faq-chat-btn-tile-title {
  color: #ffffff;
}

.faq-chat-btn-tile--call .faq-chat-btn-tile-desc {
  color: rgba(255, 255, 255, 0.9);
}

.faq-chat-btn-tile--call .faq-chat-btn-tile-arrow {
  color: #ffffff;
}

.faq-chat-btn-tile--call:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(40, 167, 69, 0.38);
}

/* Zachowanie kompatybilności wstecznej */
.faq-chat-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--fc-primary);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.84rem;
  padding: 9px 14px;
  border-radius: 8px;
  text-decoration: none !important;
  box-shadow: 0 3px 10px rgba(190, 30, 45, 0.3);
  transition: all 0.2s ease;
  width: 100%;
}

.faq-chat-action-btn:hover {
  background-color: var(--fc-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(190, 30, 45, 0.4);
}

.faq-chat-action-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.faq-chat-action-btn--secondary {
  background-color: #1a1a1a !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2) !important;
}

.faq-chat-action-btn--secondary:hover {
  background-color: #333333 !important;
}

@media (prefers-color-scheme: dark) {
  .faq-chat-action-btn--secondary {
    background-color: #2b2b30 !important;
  }
  .faq-chat-action-btn--secondary:hover {
    background-color: #383840 !important;
  }
}

.faq-chat-contact-sub {
  font-size: 0.74rem;
  color: var(--fc-text-muted);
  margin-top: 6px;
  text-align: center;
}

/* ==========================================================================
   10. Wskaźnik pisania (Typing Indicator)
   ========================================================================== */
.faq-chat-typing {
  display: none;
  align-self: flex-start;
  background-color: var(--fc-bot-bubble-bg);
  border: 1px solid var(--fc-bot-bubble-border);
  padding: 10px 14px;
  border-radius: 14px;
  border-bottom-left-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  gap: 4px;
  align-items: center;
}

.faq-chat-typing.active {
  display: inline-flex;
}

.faq-chat-dot {
  width: 6px;
  height: 6px;
  background-color: var(--fc-text-muted);
  border-radius: 50%;
  animation: fcDotBounce 1.2s infinite ease-in-out;
  opacity: 0.7;
}

.faq-chat-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.faq-chat-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes fcDotBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

/* ==========================================================================
   11. Pasek wprowadzania (Footer Input Area)
   ========================================================================== */
.faq-chat-footer {
  background-color: var(--fc-footer-bg);
  border-top: 1px solid var(--fc-border);
  padding: 10px 12px 8px 12px;
  flex-shrink: 0;
}

.faq-chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.faq-chat-input {
  flex: 1;
  background-color: var(--fc-input-bg);
  border: 1px solid var(--fc-input-border);
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 0.86rem;
  color: var(--fc-text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.faq-chat-input::placeholder {
  color: var(--fc-text-muted);
  opacity: 0.85;
}

.faq-chat-input:focus {
  border-color: var(--fc-primary);
  background-color: var(--fc-bg);
  box-shadow: 0 0 0 3px rgba(190, 30, 45, 0.12);
}

.faq-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--fc-primary);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  outline: none;
}

.faq-chat-send svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  transform: translateX(1px);
}

.faq-chat-send:hover {
  background-color: var(--fc-primary-hover);
  transform: scale(1.06);
}

.faq-chat-send:active {
  transform: scale(0.94);
}

.faq-chat-send:disabled {
  background-color: #d1d5db;
  cursor: not-allowed;
  transform: none;
  opacity: 0.6;
}

@media (prefers-color-scheme: dark) {
  .faq-chat-send:disabled {
    background-color: #374151;
  }
}

.faq-chat-footnote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--fc-text-muted);
  margin-top: 6px;
  user-select: none;
}

.faq-chat-footnote-dot {
  width: 4px;
  height: 4px;
  background-color: var(--fc-text-muted);
  border-radius: 50%;
  opacity: 0.5;
}

/* ==========================================================================
   12. Responsywność (Mobile Breakpoints)
   ========================================================================== */
@media (max-width: 768px) {
  #faq-chat-fab {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
    width: 50px;
    height: 50px;
  }

  .faq-chat-fab-icon {
    width: 22px;
    height: 22px;
  }

  #faq-chat-teaser {
    bottom: calc(140px + env(safe-area-inset-bottom, 0px));
    right: 20px;
    width: 230px;
    padding: 10px 12px;
  }

  #faq-chat-teaser::after {
    right: 18px;
  }

  #faq-chat-window {
    bottom: calc(140px + env(safe-area-inset-bottom, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
    max-height: calc(100vh - 160px);
  }
}

@media (max-width: 480px) {
  #faq-chat-window {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: calc(140px + env(safe-area-inset-bottom, 0px));
    height: 490px;
    max-height: calc(100vh - 155px);
  }

  .faq-chat-bubble {
    font-size: 0.84rem;
    padding: 8px 12px;
  }

  .faq-chat-chip {
    font-size: 0.74rem;
    padding: 4px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #faq-chat-fab,
  #faq-chat-window,
  #faq-chat-teaser,
  .faq-chat-fab-icon,
  .faq-chat-msg,
  .faq-chat-chip,
  .faq-chat-send {
    transition: none !important;
    animation: none !important;
  }
}
