/* Widget czatu AI (Kasia) - ciemny motyw z gradientem, akcenty brandowe (zielen). */
.chat-widget{position:fixed;right:20px;bottom:20px;z-index:900;font-family:inherit}

.chat-launcher{
  width:60px;height:60px;border-radius:50%;border:0;cursor:pointer;
  background:linear-gradient(135deg,var(--green,#16a34a),var(--green-dark,#15803d));
  color:#fff;display:flex;align-items:center;justify-content:center;
  box-shadow:0 8px 24px rgba(0,0,0,.4);transition:transform .15s,box-shadow .15s;
}
.chat-launcher:hover{transform:translateY(-2px);box-shadow:0 10px 28px rgba(22,163,74,.45)}
.chat-launcher svg{width:27px;height:27px;display:block}
/* Chmurka-zachęta nad launcherem (gdy czat schowany) */
.chat-teaser{position:fixed;right:20px;bottom:92px;max-width:238px;background:#fff;color:#0f1b2d;border:1px solid var(--line);border-radius:16px;border-bottom-right-radius:5px;padding:12px 30px 12px 15px;font-size:.9rem;line-height:1.35;font-weight:500;box-shadow:0 16px 38px -12px rgba(15,27,45,.36);z-index:899;cursor:pointer;animation:teaser-pop .32s cubic-bezier(.2,.8,.3,1.2)}
.chat-teaser[hidden]{display:none}
.chat-teaser-x{position:absolute;top:5px;right:7px;width:20px;height:20px;border:0;background:transparent;color:#9aa7bd;font-size:1.15rem;line-height:1;cursor:pointer;padding:0}
.chat-teaser-x:hover{color:#0f1b2d}
@keyframes teaser-pop{from{opacity:0;transform:translateY(10px) scale(.92)}to{opacity:1;transform:none}}
@media(max-width:560px){.chat-teaser{right:14px;bottom:78px;max-width:210px;font-size:.86rem}}

.chat-panel{
  position:fixed;right:20px;bottom:90px;width:min(360px,calc(100vw - 32px));
  height:520px;max-height:calc(100vh - 110px);max-height:calc(100dvh - 110px);
  background:#ffffff;border:1px solid var(--line);
  border-radius:16px;box-shadow:0 24px 70px rgba(15,27,45,.18);display:flex;flex-direction:column;overflow:hidden;
  transform-origin:bottom right;
  transition:transform .3s cubic-bezier(.2,.8,.2,1), opacity .24s ease;
  will-change:transform,opacity;color:#0f1b2d;
}
.chat-panel[hidden]{display:none}
/* zwijanie/rozwijanie: pomniejszanie okna do rogu (launchera) - jak minimalizacja */
.chat-panel.minimized{transform:scale(.04);opacity:0;pointer-events:none}

/* Naglowek zawsze widoczny gdy panel otwarty (nie kurczy sie, nie przewija) */
.chat-head{flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:13px 14px;
  background:linear-gradient(135deg,var(--green,#16a34a) 0%,var(--green-dark,#15803d) 55%,#0e3a23 100%);color:#fff}
.chat-head-id{display:flex;align-items:center;gap:10px;min-width:0}
.chat-avatar{width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,.2);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:1.05rem}
.chat-head-txt{display:flex;flex-direction:column;line-height:1.2;min-width:0}
.chat-head-txt strong{font-size:.98rem}
.chat-status{font-size:.74rem;opacity:.85;display:flex;align-items:center;gap:5px}
.chat-status::before{content:"";width:7px;height:7px;border-radius:50%;background:#4ade80;box-shadow:0 0 0 3px rgba(74,222,128,.25)}
.chat-head-actions{display:flex;align-items:center;gap:2px;flex:0 0 auto}
.chat-close,.chat-new{background:transparent;border:0;color:#fff;cursor:pointer;padding:4px;border-radius:8px;display:flex}
.chat-close svg,.chat-new svg{width:20px;height:20px;display:block}
.chat-close:hover,.chat-new:hover{background:rgba(255,255,255,.18)}
.chat-new svg{width:18px;height:18px}

.chat-body{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:10px;
  background:linear-gradient(170deg,#eef6f1 0%,#f4f6fa 40%,#ffffff 100%)}
.chat-body::-webkit-scrollbar{width:8px}
.chat-body::-webkit-scrollbar-thumb{background:rgba(15,27,45,.15);border-radius:8px}
.chat-msg{max-width:85%;padding:10px 13px;border-radius:14px;font-size:.9rem;line-height:1.45}
.chat-msg.bot{align-self:flex-start;background:#ffffff;border:1px solid var(--line);border-bottom-left-radius:4px;color:#0f1b2d;white-space:pre-wrap}
.chat-msg.user{align-self:flex-end;background:linear-gradient(135deg,var(--green,#16a34a),var(--green-dark,#15803d));color:#fff;border-bottom-right-radius:4px;white-space:pre-wrap}
.chat-err-link{display:inline-block;margin-top:6px;color:var(--green,#16a34a);font-weight:700;text-decoration:underline}
.chat-link{color:var(--green,#16a34a);font-weight:600;text-decoration:underline}
/* Klikalna karta auta w czacie (rekomendacja) */
.chat-car{align-self:flex-start;max-width:90%;display:flex;gap:10px;align-items:center;background:#ffffff;border:1px solid var(--line);border-radius:12px;padding:8px;text-decoration:none;color:#0f1b2d;transition:border-color .12s,box-shadow .12s}
.chat-car:hover{border-color:var(--green,#16a34a);box-shadow:0 4px 16px rgba(15,27,45,.12);text-decoration:none}
.chat-car-thumb{flex:0 0 auto;width:74px;height:56px;border-radius:8px;overflow:hidden;background:#eef1f6;display:flex;align-items:center;justify-content:center;color:#5b6573;font-size:.8rem}
.chat-car-thumb img,.chat-car-thumb video{width:100%;height:100%;object-fit:cover;display:block}
.chat-car-info{display:flex;flex-direction:column;gap:3px;min-width:0}
.chat-car-title{font-weight:700;font-size:.9rem;line-height:1.25}
.chat-car-price{font-size:.82rem;color:#5b6573;font-weight:600}

.chat-typing{display:flex;gap:5px;align-items:center}
.chat-typing span{width:7px;height:7px;border-radius:50%;background:#6b7280;display:inline-block;animation:chatdot 1s infinite ease-in-out}
.chat-typing span:nth-child(2){animation-delay:.15s}
.chat-typing span:nth-child(3){animation-delay:.3s}
@keyframes chatdot{0%,80%,100%{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}

.chat-input{flex:0 0 auto;display:flex;align-items:center;gap:8px;padding:10px;border-top:1px solid var(--line);background:#ffffff}
.chat-input input{flex:1;min-width:0;border:1px solid var(--line);border-radius:999px;padding:10px 14px;font-size:.92rem;font-family:inherit;outline:none;background:#f4f6fa;color:#0f1b2d}
.chat-input input::placeholder{color:#6b7280}
.chat-input input:focus{border-color:var(--green,#16a34a)}
.chat-send{flex:0 0 auto;width:42px;height:42px;border-radius:50%;border:0;background:linear-gradient(135deg,var(--green,#16a34a),var(--green-dark,#15803d));color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer}
.chat-send svg{width:19px;height:19px;display:block}
.chat-send:disabled,.chat-input input:disabled{opacity:.55;cursor:not-allowed}

@media(max-width:560px){
  .chat-widget{right:14px;bottom:14px}
  .chat-launcher{width:54px;height:54px}
  .chat-panel{right:14px;bottom:78px;width:calc(100vw - 28px);max-height:calc(100vh - 96px);max-height:calc(100dvh - 96px)}
}

@media(max-width:760px){
  body:has(.detail-cta-bar) .chat-widget{bottom:82px}
  body:has(.detail-cta-bar) .chat-teaser{bottom:154px}
}

/* Szerokie ekrany (>=1800px): czat domyslnie otwarty (JS), ale mozna go zwinac
   przyciskiem - z animacja pomniejszania (launcher otwiera z powrotem). */
