/* ==========================================================
   Smart Contact Widget — Frontend Styles
   Modern Glassmorphism + Fluid Animations
========================================================== */

:root {
  --scw-color:       #2563eb;
  --scw-color-dark:  #1d4ed8;
  --scw-color-light: #dbeafe;
  --scw-wa-green:    #25d366;
  --scw-wa-dark:     #128c7e;
  --scw-phone-teal:  #0d9488;
  --scw-mail-indigo: #6366f1;
  --scw-radius:      16px;
  --scw-shadow:      0 25px 60px rgba(0,0,0,.22), 0 8px 20px rgba(0,0,0,.14);
  --scw-glass:       rgba(255,255,255,.92);
  --scw-blur:        blur(20px);
  --scw-transition:  cubic-bezier(.34,1.56,.64,1);
  --scw-easing:      cubic-bezier(.4,0,.2,1);
  --scw-font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---------------------------------------------------------
   Launcher button (floating)
--------------------------------------------------------- */
#scw-root { position: fixed; z-index: 99990; }

.scw-launcher {
  position: fixed;
  z-index: 99990;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* Przywrócony fokus dla dostępności klawiatury — ukrywamy domyślny outline,
   ale pokazujemy wyraźny ring przy nawigacji klawiaturą */
.scw-launcher:focus-visible .scw-launcher-circle {
  outline: 3px solid var(--scw-color);
  outline-offset: 3px;
}
.scw-launcher.scw-pos-left { right: auto; left: 24px; flex-direction: row-reverse; }

/* Pulsing ring */
.scw-launcher-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: var(--scw-color);
  opacity: .18;
  animation: scw-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes scw-pulse {
  0%, 100% { transform: scale(1); opacity: .18; }
  50%       { transform: scale(1.35); opacity: 0; }
}

/* Main circle */
.scw-launcher-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--scw-color);
  box-shadow: 0 6px 24px rgba(37,99,235,.45), 0 2px 8px rgba(37,99,235,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s var(--scw-transition), box-shadow .3s var(--scw-easing);
  position: relative;
  flex-shrink: 0;
}
.scw-launcher:hover .scw-launcher-circle,
.scw-launcher:focus .scw-launcher-circle {
  transform: scale(1.1);
  box-shadow: 0 10px 32px rgba(37,99,235,.55), 0 4px 12px rgba(37,99,235,.35);
}

/* wskaźnik focusu dla użytkowników klawiatury (Dostępność) */
.scw-launcher:focus-visible .scw-launcher-circle {
  outline: 3px solid var(--scw-color);
  outline-offset: 4px;
}


.scw-launcher.is-open .scw-launcher-circle {
  background: #ef4444;
  box-shadow: 0 6px 24px rgba(239,68,68,.4);
}

.scw-launcher-icon {
  width: 26px; height: 26px;
  fill: #fff;
  transition: transform .4s var(--scw-transition), opacity .2s;
}
.scw-launcher-icon-open  { position: absolute; opacity: 0; transform: rotate(-90deg) scale(.5); }
.scw-launcher.is-open .scw-launcher-icon-main { opacity: 0; transform: rotate(90deg) scale(.5); }
.scw-launcher.is-open .scw-launcher-icon-open { opacity: 1; transform: rotate(0) scale(1); }

/* Label pill */
.scw-launcher-label {
  background: var(--scw-color);
  color: #fff;
  font: 600 13px/1 var(--scw-font);
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
  white-space: nowrap;
  transition: transform .3s var(--scw-transition), opacity .3s;
  pointer-events: none;
}
.scw-launcher.is-open .scw-launcher-label {
  opacity: 0;
  transform: translateX(6px);
}

/* ---------------------------------------------------------
   Popup
--------------------------------------------------------- */
.scw-popup {
  position: fixed;
  z-index: 99989;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--scw-glass);
  backdrop-filter: var(--scw-blur);
  -webkit-backdrop-filter: var(--scw-blur);
  border-radius: var(--scw-radius);
  box-shadow: var(--scw-shadow);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s var(--scw-easing), visibility .25s, transform .3s var(--scw-transition);
  font-family: var(--scw-font);
}

/* Popup positions */
.scw-popup.scw-pos-corner-right { bottom: 96px; right: 24px; transform-origin: bottom right; transform: scale(.92) translateY(12px); }
.scw-popup.scw-pos-corner-left  { bottom: 96px; left:  24px; transform-origin: bottom left;  transform: scale(.92) translateY(12px); }
.scw-popup.scw-pos-center       { top: 50%; left: 50%; transform: translate(-50%,-46%); transform-origin: center; }
.scw-popup.scw-pos-side-right   { right: 0; top: 0; bottom: 0; height: 100%; width: 360px; max-width: 100vw; border-radius: var(--scw-radius) 0 0 var(--scw-radius); transform: translateX(110%); }
.scw-popup.scw-pos-side-left    { left:  0; top: 0; bottom: 0; height: 100%; width: 360px; max-width: 100vw; border-radius: 0 var(--scw-radius) var(--scw-radius) 0; transform: translateX(-110%); }

.scw-popup.is-open {
  opacity: 1;
  visibility: visible;
}
.scw-popup.is-open.scw-pos-corner-right,
.scw-popup.is-open.scw-pos-corner-left  { transform: scale(1) translateY(0); }
.scw-popup.is-open.scw-pos-center       { transform: translate(-50%,-50%); }
.scw-popup.is-open.scw-pos-side-right,
.scw-popup.is-open.scw-pos-side-left    { transform: translateX(0); }

/* Overlay for center / side */
.scw-overlay {
  position: fixed; inset: 0; z-index: 99988;
  background: rgba(0,0,0,.35);
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.scw-overlay.is-open { opacity: 1; visibility: visible; }

/* Header */
.scw-popup-header {
  background: linear-gradient(135deg, var(--scw-color) 0%, var(--scw-color-dark) 100%);
  padding: 20px 20px 0;
  color: #fff;
}
.scw-popup-header h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff;
}

/* Tab bar */
.scw-tabs {
  display: flex;
  gap: 4px;
  padding: 0 0 0 0;
}
.scw-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px 12px;
  cursor: pointer;
  border: none;
  background: rgba(255,255,255,.15);
  border-radius: 10px 10px 0 0;
  color: rgba(255,255,255,.75);
  font: 600 11px/1 var(--scw-font);
  transition: background .2s, color .2s;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.scw-tab:hover  { background: rgba(255,255,255,.22); color: #fff; }
.scw-tab.active { background: rgba(255,255,255,.97); color: var(--scw-color); box-shadow: 0 -2px 12px rgba(0,0,0,.08); }

.scw-tab-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.scw-tab-icon svg { width: 22px; height: 22px; fill: currentColor; }

/* Panel area */
.scw-panels { background: #fff; }
.scw-panel {
  display: none;
  padding: 20px;
  animation: scw-fadein .2s var(--scw-easing);
}
.scw-panel.active { display: block; }
@keyframes scw-fadein { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ---------------------------------------------------------
   WhatsApp / Phone panels
--------------------------------------------------------- */
.scw-channel-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0 0;
}
.scw-channel-icon-big {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.scw-channel-icon-big svg { width: 34px; height: 34px; fill: #fff; }
.scw-icon-wa    { background: linear-gradient(135deg, #25d366, #128c7e); box-shadow: 0 6px 20px rgba(37,211,102,.4); }
.scw-icon-phone { background: linear-gradient(135deg, #0d9488, #0f766e); box-shadow: 0 6px 20px rgba(13,148,136,.4); }
.scw-icon-mail  { background: linear-gradient(135deg, #6366f1, #4f46e5); box-shadow: 0 6px 20px rgba(99,102,241,.4); }

.scw-channel-title { font: 700 17px/1.2 var(--scw-font); color: #111; margin-bottom: 6px; }
.scw-channel-desc  { font: 400 13px/1.5 var(--scw-font); color: #6b7280; margin-bottom: 20px; }

.scw-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 13px 20px;
  border: none; border-radius: 12px;
  font: 700 14px/1 var(--scw-font);
  cursor: pointer;
  transition: transform .2s var(--scw-transition), box-shadow .2s;
  color: #fff;
  text-decoration: none;
  box-sizing: border-box;
}
.scw-btn:hover { transform: translateY(-2px); }
.scw-btn:active { transform: translateY(0); }
.scw-btn svg { width: 18px; height: 18px; fill: #fff; flex-shrink: 0; }

.scw-btn-wa    { background: linear-gradient(135deg, #25d366, #128c7e); box-shadow: 0 4px 14px rgba(37,211,102,.4); }
.scw-btn-phone { background: linear-gradient(135deg, #0d9488, #0f766e); box-shadow: 0 4px 14px rgba(13,148,136,.4); }
.scw-btn-send  { background: linear-gradient(135deg, #6366f1, #4f46e5); box-shadow: 0 4px 14px rgba(99,102,241,.4); }
.scw-btn-callback { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 14px rgba(245,158,11,.4); }

.scw-divider {
  display: flex; align-items: center; gap: 10px;
  color: #9ca3af; font-size: 12px; margin: 14px 0;
}
.scw-divider::before, .scw-divider::after {
  content: ''; flex: 1; height: 1px; background: #e5e7eb;
}

.scw-phone-direct {
  background: #f9fafb;
  border-radius: 10px;
  padding: 12px 16px;
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  margin-top: 8px;
}
.scw-phone-direct strong { display: block; font-size: 18px; color: #111; letter-spacing: .02em; margin-top: 4px; }

/* ---------------------------------------------------------
   Email form
--------------------------------------------------------- */
.scw-form { display: flex; flex-direction: column; gap: 10px; }

.scw-field {
  display: flex; flex-direction: column; gap: 4px;
}
.scw-field label { font: 600 12px/1 var(--scw-font); color: #374151; text-transform: uppercase; letter-spacing: .04em; }

.scw-input,
.scw-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font: 400 14px/1.4 var(--scw-font);
  color: #111;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
  outline: none;
  -webkit-appearance: none;
}
.scw-input:focus,
.scw-textarea:focus {
  border-color: var(--scw-color);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.scw-textarea { resize: vertical; min-height: 80px; }

/* Captcha */
.scw-captcha {
  display: flex; align-items: center; gap: 10px;
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color .2s;
  user-select: none;
}
.scw-captcha:hover { border-color: var(--scw-color); }
.scw-captcha.checked { border-color: #22c55e; background: #f0fdf4; }

.scw-captcha-box {
  width: 22px; height: 22px;
  border: 2px solid #d1d5db;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0;
}
.scw-captcha.checked .scw-captcha-box {
  background: #22c55e; border-color: #22c55e;
}
.scw-captcha-box svg { width: 14px; height: 14px; fill: #fff; opacity: 0; transition: opacity .2s; }
.scw-captcha.checked .scw-captcha-box svg { opacity: 1; }
.scw-captcha-label { font: 400 13px/1 var(--scw-font); color: #374151; }

/* Math captcha */
.scw-math-row { display: flex; align-items: center; gap: 10px; }
.scw-math-question { font: 600 14px/1 var(--scw-font); color: #374151; white-space: nowrap; }
.scw-math-input { width: 70px !important; text-align: center; }

/* Messages */
.scw-message {
  padding: 10px 14px;
  border-radius: 10px;
  font: 400 13px/1.4 var(--scw-font);
  display: none;
}
.scw-message.show { display: block; }
.scw-message.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.scw-message.error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* Optional fields toggle */
.scw-optional-toggle {
  font: 400 12px/1 var(--scw-font);
  color: var(--scw-color);
  cursor: pointer;
  background: none; border: none;
  padding: 2px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  align-self: flex-start;
}
.scw-optional-fields { display: none; flex-direction: column; gap: 10px; }
.scw-optional-fields.show { display: flex; }

/* ---------------------------------------------------------
   Loader spinner
--------------------------------------------------------- */
.scw-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: scw-spin .7s linear infinite;
  display: none;
}
.scw-loading .scw-spinner { display: block; }
.scw-loading .scw-btn-text { opacity: 0; }

@keyframes scw-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------
   Footer
--------------------------------------------------------- */
.scw-popup-footer {
  background: #f9fafb;
  border-top: 1px solid #f0f0f0;
  padding: 10px 20px;
  text-align: center;
  font: 400 11px/1 var(--scw-font);
  color: #9ca3af;
}

/* ---------------------------------------------------------
   Responsive
--------------------------------------------------------- */
@media (max-width: 420px) {
  .scw-launcher { bottom: 16px; right: 16px; }
  .scw-launcher.scw-pos-left { left: 16px; right: auto; }
  .scw-popup { width: calc(100vw - 24px); }
  .scw-popup.scw-pos-corner-right { right: 12px; }
  .scw-popup.scw-pos-corner-left  { left:  12px; }
  .scw-popup.scw-pos-side-right,
  .scw-popup.scw-pos-side-left    { width: 100vw; }
}

/* ---------------------------------------------------------
   Dark-mode (basic)
--------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  .scw-popup { background: rgba(18,18,28,.92); border-color: rgba(255,255,255,.1); }
  .scw-panels { background: rgba(18,18,28,1); }
  .scw-channel-title { color: #f3f4f6; }
  .scw-channel-desc  { color: #9ca3af; }
  .scw-input, .scw-textarea { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); color: #f3f4f6; }
  .scw-input:focus, .scw-textarea:focus { border-color: var(--scw-color); }
  .scw-captcha { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1); }
  .scw-captcha-label { color: #d1d5db; }
  .scw-phone-direct { background: rgba(255,255,255,.05); }
  .scw-phone-direct strong { color: #f3f4f6; }
  .scw-popup-footer { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
  .scw-field label { color: #9ca3af; }
}

/* -------------------------------------------------------
   Honeypot – must be invisible to humans, never to bots
   Using !important to ensure no theme overrides it
------------------------------------------------------- */
.scw-honeypot {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* -------------------------------------------------------
   GDPR / RODO consent row
------------------------------------------------------- */
.scw-gdpr-row {
  margin: 10px 0;
}

.scw-gdpr-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: #6b7280;
  cursor: pointer;
}

.scw-gdpr-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--scw-color, #2563eb);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.scw-gdpr-label a {
  color: var(--scw-color, #2563eb);
  text-decoration: underline;
}

.scw-gdpr-label a:hover {
  text-decoration: none;
}

.scw-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 6px;
  line-height: 1.2;
  text-align: left;
  letter-spacing: 0.02em;
}
.scw-field {
  margin-bottom: 16px;
}

/* ---------------------------------------------------------
   Obsługa widoczności (Responsive / Cache fix)
--------------------------------------------------------- */
/* Ukryj na urządzeniach mobilnych (ekrany mniejsze niż 768px) */
@media (max-width: 767px) {
  #scw-root.scw-hide-mobile {
    display: none !important;
  }
}

/* Ukryj na komputerach i dużych tabletach (ekrany od 768px w górę) */
@media (min-width: 768px) {
  #scw-root.scw-hide-desktop {
    display: none !important;
  }
}

/* --- Poprawka: Ograniczenie wysokości widgetu i scrollowanie --- */
.scw-popup,
.scw-window,
.scw-container,
.scw-panel-wrap {
    /* Widget nie będzie wyższy niż ekran minus 120 pikseli zapasu (na przycisk i margines górny) */
    max-height: calc(100vh - 120px) !important; 
    
    /* Włączenie pionowego przewijania, jeśli treść przekracza max-height */
    overflow-y: auto !important; 
    
    /* Płynne przewijanie na urządzeniach mobilnych */
    -webkit-overflow-scrolling: touch; 
}

/* (Opcjonalnie) Ostylowanie paska przewijania, aby wyglądał nowocześnie i nie zajmował dużo miejsca */
.scw-popup::-webkit-scrollbar,
.scw-window::-webkit-scrollbar,
.scw-container::-webkit-scrollbar,
.scw-panel-wrap::-webkit-scrollbar {
    width: 6px;
}

.scw-popup::-webkit-scrollbar-track,
.scw-window::-webkit-scrollbar-track,
.scw-container::-webkit-scrollbar-track,
.scw-panel-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.scw-popup::-webkit-scrollbar-thumb,
.scw-window::-webkit-scrollbar-thumb,
.scw-container::-webkit-scrollbar-thumb,
.scw-panel-wrap::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

/* Wymuszenie zachowania scrolla wewnątrz samych paneli (zakładek) dla lepszego efektu */
.scw-panel {
    max-height: 100%;
}