/* ═══════════════════════════════════════════════════════════════
   LIVECHAT WIDGET — premium magenta bubble + chat panel
═══════════════════════════════════════════════════════════════ */

.lc-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99990;
  font-family: var(--f-ui);
}

/* Ukryj widget czatu gdy otwarte mobilne menu (body.drawer-open) —
   inaczej bąbel czatu nachodzi na drawer nawigacji. */
body.drawer-open .lc-widget {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}

/* ─── FLOATING BUBBLE (zwinięty stan) ─── */
.lc-bubble.lc-hidden { display: none !important; }
.lc-bubble {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 12px 14px;
  background: linear-gradient(135deg, var(--mag) 0%, var(--mag-d) 100%);
  color: var(--white);
  border: none;
  border-radius: 999px;
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  box-shadow:
    0 6px 16px rgba(223, 59, 163, 0.32),
    0 12px 32px rgba(0, 0, 0, 0.12);
  transition:
    transform .25s var(--spring),
    box-shadow .25s var(--eo),
    opacity .25s var(--eo);
  position: relative;
  will-change: transform;
}
.lc-bubble:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 10px 24px rgba(223, 59, 163, 0.42),
    0 16px 40px rgba(0, 0, 0, 0.14);
}
.lc-bubble:active { transform: translateY(-1px) scale(0.98); }
.lc-bubble:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--mag);
}

.lc-bubble-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: var(--white);
}

.lc-bubble-status {
  position: absolute;
  top: 8px;
  left: 38px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border: 2.5px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: lcPulse 2s infinite var(--eo);
}
@keyframes lcPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

.lc-bubble-label { letter-spacing: 0.01em; }

/* Ukryj label na bardzo małym ekranie */
@media (max-width: 480px) {
  .lc-bubble {
    padding: 10px;
    border-radius: 50%;
  }
  .lc-bubble-label { display: none; }
  .lc-bubble-avatar { width: 30px; height: 30px; }
  .lc-bubble-status { left: 32px; top: 6px; }
}

/* Podnieś bąbel nad mobile bottom bar — bar pokazuje się ≤768px,
   więc widget musi się podnosić w tym samym zakresie (nie tylko ≤480px),
   inaczej na telefonach 481–768px bąbel nachodzi na pasek. */
@media (max-width: 768px) {
  .lc-widget {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    right: 16px;
  }
  /* Kolor teal na mobile — odróżnia bąbel od magentowego paska CTA
     „Umów wizytę" na dole (inaczej wszystko zlewa się w jeden róż). */
  .lc-bubble {
    background: linear-gradient(135deg, var(--teal, #0CB8B6) 0%, #0a9c9a 100%);
    box-shadow:
      0 6px 16px rgba(12, 184, 182, 0.34),
      0 12px 32px rgba(0, 0, 0, 0.12);
  }
  .lc-bubble:hover {
    box-shadow:
      0 10px 24px rgba(12, 184, 182, 0.44),
      0 16px 40px rgba(0, 0, 0, 0.14);
  }
}

/* ─── PANEL ROZWINIĘTY ─── */
/* hidden attribute musi wygrać z display:flex poniżej */
.lc-panel[hidden] { display: none !important; }
.lc-panel {
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 100px);
  background: var(--white);
  border-radius: 20px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.18),
    0 8px 20px rgba(223, 59, 163, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: absolute;
  bottom: 0;
  right: 0;
  transform-origin: bottom right;
  animation: lcPanelIn .35s var(--spring);
}
@keyframes lcPanelIn {
  from { opacity: 0; transform: translateY(20px) scale(.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.lc-panel.lc-closing {
  animation: lcPanelOut .2s var(--eo) forwards;
}
@keyframes lcPanelOut {
  to { opacity: 0; transform: translateY(16px) scale(.95); }
}

@media (max-width: 768px) {
  .lc-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 100px - env(safe-area-inset-bottom, 0px));
    bottom: 64px;
    right: -8px;
    border-radius: 16px;
  }
}

/* ─── HEAD ─── */
.lc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--mag) 0%, var(--mag-d) 100%);
  color: var(--white);
  border-radius: 20px 20px 0 0;
}
.lc-head-avatar {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}
.lc-head-avatar svg { display: block; }
.lc-head-status {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: #22c55e;
  border: 2px solid var(--white);
  border-radius: 50%;
}
.lc-head-info { flex: 1; min-width: 0; }
.lc-head-name {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.2;
  margin-bottom: 2px;
  letter-spacing: -0.005em;
}
.lc-head-meta {
  font-size: 12px;
  opacity: 0.92;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.lc-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.7);
}
.lc-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 8px;
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s var(--eo);
}
.lc-close:hover { background: rgba(255, 255, 255, 0.28); }
.lc-close:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

/* ─── BODY (wiadomości) ─── */
.lc-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  background:
    radial-gradient(circle at 20% 0%, var(--mag-w) 0%, transparent 40%),
    var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}
.lc-body::-webkit-scrollbar { width: 5px; }
.lc-body::-webkit-scrollbar-track { background: transparent; }
.lc-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 5px; }

.lc-msg {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: lcMsgIn .35s var(--spring);
}
@keyframes lcMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lc-msg-bot { align-self: flex-start; }
.lc-msg-user { align-self: flex-end; }

.lc-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.lc-msg-bot .lc-msg-bubble {
  background: var(--white);
  color: var(--ink);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.lc-msg-user .lc-msg-bubble {
  background: linear-gradient(135deg, var(--mag) 0%, var(--mag-d) 100%);
  color: var(--white);
  border-bottom-right-radius: 4px;
}
.lc-msg-time {
  font-size: 10.5px;
  color: var(--gray);
  padding: 0 4px;
}
.lc-msg-user .lc-msg-time { text-align: right; }

/* Linki w bot bubble */
.lc-msg-bot .lc-msg-bubble a {
  color: var(--mag);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(223, 59, 163, 0.35);
  text-underline-offset: 2px;
}
.lc-msg-bot .lc-msg-bubble a:hover { color: var(--mag-d); }

/* Typing indicator */
.lc-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--white);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  width: max-content;
  animation: lcMsgIn .25s var(--spring);
}
.lc-typing span {
  width: 7px;
  height: 7px;
  background: var(--mag);
  border-radius: 50%;
  animation: lcTypingDot 1.2s infinite var(--eo);
  opacity: 0.4;
}
.lc-typing span:nth-child(2) { animation-delay: .15s; }
.lc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes lcTypingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ─── QUICK REPLIES ─── */
.lc-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  background: var(--bg);
}
.lc-quick-reply {
  background: var(--white);
  border: 1.5px solid var(--mag);
  color: var(--mag);
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s var(--eo);
  animation: lcMsgIn .3s var(--spring);
}
.lc-quick-reply:hover {
  background: var(--mag);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(223, 59, 163, 0.25);
}
.lc-quick-reply:focus-visible {
  outline: 2px solid var(--mag-d);
  outline-offset: 2px;
}

/* ─── FORM ─── */
.lc-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--white);
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}
.lc-input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  font-family: var(--f-ui);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--bg);
  transition: border-color .15s var(--eo), background .15s var(--eo);
}
.lc-input:focus {
  outline: none;
  border-color: var(--mag);
  background: var(--white);
}
.lc-input::placeholder { color: var(--gray); }

.lc-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--mag) 0%, var(--mag-d) 100%);
  color: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s var(--spring), box-shadow .15s var(--eo);
  box-shadow: 0 4px 12px rgba(223, 59, 163, 0.28);
}
.lc-send:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(223, 59, 163, 0.4);
}
.lc-send:active { transform: scale(0.95); }
.lc-send:focus-visible { outline: 2px solid var(--mag-d); outline-offset: 3px; }
.lc-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.lc-send svg { transform: translateX(1px) translateY(-1px); }

/* ─── FOOT ─── */
.lc-foot {
  padding: 8px 16px 12px;
  background: var(--white);
  font-size: 11px;
  color: var(--gray);
  text-align: center;
}
.lc-foot a {
  color: var(--mag);
  font-weight: 600;
  text-decoration: none;
}
.lc-foot a:hover { text-decoration: underline; }

/* ─── REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {
  .lc-bubble, .lc-panel, .lc-msg, .lc-typing span, .lc-bubble-status,
  .lc-send, .lc-quick-reply {
    animation: none !important;
    transition: opacity .1s ease !important;
  }
  .lc-bubble:hover, .lc-send:hover, .lc-quick-reply:hover {
    transform: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   MENU KONTAKTOWE — 4 opcje (czat / telefon / email / umów wizytę)
═══════════════════════════════════════════════════════════════ */

.lc-bubble-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
  flex-shrink: 0;
}
.lc-bubble-status {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #cbd5e1;
  border: 2px solid #fff;
}
.lc-bubble-status.is-open { background: #22c55e; }

/* ─── Panel menu ─── */
.lc-menu {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px -12px rgba(15,23,42,0.32), 0 0 0 1px rgba(223,59,163,0.08);
  overflow: hidden;
  animation: lc-menu-in 0.22s cubic-bezier(0.16,1,0.3,1);
}
@keyframes lc-menu-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lc-menu-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 16px;
  background: linear-gradient(135deg, var(--mag, #DF3BA3) 0%, #C1268A 100%);
  color: #fff;
}
.lc-menu-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.lc-menu-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12.5px;
  opacity: 0.92;
}
.lc-online-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
}
.lc-online-dot.is-open { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,0.3); }
.lc-menu-head-info { flex: 1; }
.lc-menu-close {
  background: rgba(255,255,255,0.16);
  border: 0;
  width: 30px; height: 30px;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.lc-menu-close:hover { background: rgba(255,255,255,0.3); }

/* ─── Opcje ─── */
.lc-menu-options { padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.lc-opt {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px 12px;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.lc-opt:hover {
  background: #fdf2f9;
  border-color: rgba(223,59,163,0.18);
}
.lc-opt:active { transform: scale(0.985); }
.lc-opt-ic {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 11px;
  font-size: 21px;
  flex-shrink: 0;
}
.lc-opt--chat .lc-opt-ic { background: #fdf0fa; color: var(--mag, #DF3BA3); }
.lc-opt--call .lc-opt-ic { background: #e6faf9; color: var(--teal, #0CB8B6); }
.lc-opt--mail .lc-opt-ic { background: #eef2ff; color: #6366f1; }
.lc-opt--book .lc-opt-ic { background: var(--mag, #DF3BA3); color: #fff; }
.lc-opt-txt { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.lc-opt-title { font-size: 14.5px; font-weight: 600; color: #1e1923; }
.lc-opt-desc {
  font-size: 12.5px;
  color: #8a7682;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-opt-arrow { color: #cbb8c4; font-size: 20px; flex-shrink: 0; transition: transform 0.15s; }
.lc-opt:hover .lc-opt-arrow { transform: translateX(2px); color: var(--mag, #DF3BA3); }

.lc-menu-foot {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 18px;
  background: #faf7f9;
  border-top: 1px solid #f0e8ed;
  font-size: 12px;
  color: #8a7682;
}
.lc-menu-foot-row {
  display: flex;
  align-items: center;
  gap: 7px;
}
.lc-menu-foot-row i { color: var(--mag, #DF3BA3); flex-shrink: 0; }

@media (max-width: 480px) {
  /* UWAGA: nie ustawiaj tu .lc-widget bottom — pozycję nad mobilnym
     paskiem kontaktu definiuje reguła @media (max-width:768px) wyżej. */
  .lc-menu { width: calc(100vw - 32px); }
}
@media (prefers-reduced-motion: reduce) {
  .lc-menu { animation: none; }
}
