/* =====================================================================
   Widget czatu na zywo (strona uzytkownika). Pigulka w kolorze akcentu
   w prawym dolnym rogu; po klik. rozwija sie karta rozmowy. Widoczny
   tylko gdy admin jest dostepny. Osobny plik - korzysta ze zmiennych
   motywu (jasny/ciemny) i --accent.
   ===================================================================== */

.czat-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  font-size: 15px;
}

/* Pigulka uruchamiajaca */
.czat-launcher {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.05rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .15s ease, box-shadow .15s ease, opacity .2s ease;
}
.czat-launcher:hover { transform: translateY(-2px); }
.czat-launcher svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }
.czat-launcher .czat-kropka {
  width: .55rem; height: .55rem; border-radius: 50%;
  background: #46e08a; box-shadow: 0 0 0 3px color-mix(in srgb, #46e08a 35%, transparent);
}
.czat-launcher .czat-odznaka {
  display: inline-grid; place-items: center;
  min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem;
  border-radius: 999px; background: #fff; color: var(--accent-strong);
  font-size: .78rem; font-weight: 800; line-height: 1;
}

/* Ukrycie calego widgetu, gdy admin offline */
.czat-widget[hidden] { display: none; }

/* Karta rozmowy */
.czat-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(360px, calc(100vw - 36px));
  height: min(500px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: czat-in .18s ease;
}
@keyframes czat-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.czat-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1rem;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #fff;
}
.czat-head strong { font-size: .98rem; line-height: 1.1; }
.czat-head small { display: block; font-size: .74rem; opacity: .9; margin-top: 1px; }
.czat-head .czat-status-kropka {
  width: .5rem; height: .5rem; border-radius: 50%; background: #46e08a; flex: none;
}
.czat-head .czat-head-txt { flex: 1; min-width: 0; }
.czat-head button {
  border: none; background: rgba(255,255,255,.18); color: #fff;
  width: 1.9rem; height: 1.9rem; border-radius: 999px; cursor: pointer;
  font-size: 1.2rem; line-height: 1; display: grid; place-items: center;
  transition: background .15s ease;
}
.czat-head button:hover { background: rgba(255,255,255,.32); }

.czat-wiadomosci {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  background: var(--bg);
}
.czat-info {
  text-align: center;
  color: var(--text-muted);
  font-size: .82rem;
  margin: auto 0;
  padding: 1rem;
  line-height: 1.5;
}
.czat-bomba {
  align-self: center;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: .78rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  margin: .2rem 0;
}
.czat-msg {
  max-width: 82%;
  padding: .55rem .8rem;
  border-radius: 14px;
  line-height: 1.4;
  font-size: .9rem;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.czat-msg.user {
  align-self: flex-end;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.czat-msg.admin {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.czat-forma {
  display: flex;
  gap: .5rem;
  padding: .7rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.czat-forma textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .55rem .7rem;
  font: inherit;
  font-size: .9rem;
  background: var(--bg);
  color: var(--text);
  max-height: 96px;
}
.czat-forma textarea:focus { outline: none; border-color: var(--accent); }
.czat-forma button {
  border: none;
  border-radius: 12px;
  padding: 0 .9rem;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.czat-forma button:disabled { opacity: .5; cursor: default; }
.czat-forma button svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }

.czat-blad {
  color: #e0566f;
  font-size: .8rem;
  padding: 0 .7rem .6rem;
  background: var(--surface);
}

@media (max-width: 480px) {
  .czat-widget { right: 12px; bottom: 12px; }
  .czat-panel { height: min(70vh, calc(100vh - 90px)); }
}
