/**
 * CHAT RZ — Client Widget styles.
 *
 * Mobile-first, prefiksowane wszystkie selectory żeby nie kolidować z
 * existing site styles. Bez external dependencies (no Tailwind, no fonts).
 *
 * Layout breakpoints:
 *   - mobile (default): 85dvh sticky-bottom sheet (1.0.134 — top 15% strony widoczny)
 *   - desktop (>=769px + pointer:fine): 440×560 floating panel bottom-right
 *
 * 1.0.133 — ChatGPT-like theme rewrite (visitor side widget).
 * 1.0.134 — neutralized name input + graphite send button + monochrome bubbles
 *           (preset → osobne pola `chat_bubble_visitor`/`chat_bubble_agent`) +
 *           mobile 85dvh + textarea rows=1 + avatars z initials + dynamic header
 *           z operator name + status dot.
 */

.chatrz-widget {
    --chatrz-primary: var(--botrz-bubble-idle-3, #10A37F);
    --chatrz-primary-hover: var(--botrz-bubble-idle-2, #34D399);
    --chatrz-bg: #ffffff;
    --chatrz-bg-soft: #FAFAF9;
    --chatrz-text: #1F2937;
    --chatrz-text-muted: #6B7280;
    --chatrz-border: rgba(0, 0, 0, 0.06);
    --chatrz-border-strong: rgba(0, 0, 0, 0.10);
    /* 1.0.134 — nowe pola preset (chat_bubble_visitor/chat_bubble_agent) injektowane
       jako CSS vars w :root przez WidgetFrontend. Fallback do neutralnych ChatGPT-like. */
    --chatrz-visitor-bg: #E5E5E5;
    --chatrz-visitor-text: #1F2937;
    --chatrz-agent-bg: #F7F7F8;
    --chatrz-agent-text: #1F2937;
    --chatrz-system-text: #6B7280;
    --chatrz-error-bg: #FEF2F2;
    --chatrz-error-text: #B91C1C;
    --chatrz-send-bg: #1F2937;
    --chatrz-send-bg-hover: #111827;
    --chatrz-shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.04);
    --chatrz-shadow-panel: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    --chatrz-shadow-panel-mobile: 0 -8px 24px rgba(0, 0, 0, 0.08);
    --chatrz-radius-msg: 18px;
    --chatrz-radius-input: 20px;
    --chatrz-radius-panel: 16px;
    --chatrz-status-online: #10A37F;
    --chatrz-status-offline: #9CA3AF;

    /* 1.0.146 — widget root NIE pinuje (no position fixed) żeby NIE tworzyć containing
       block na iOS Safari. `.chatrz-panel` ma own position:fixed = pin do viewport
       bezpośrednio. Root is DOM-only container z 0×0 size. */
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--chatrz-text);
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.chatrz-widget *,
.chatrz-widget *::before,
.chatrz-widget *::after {
    box-sizing: border-box;
}

/* Bubble (collapsed state) — fallback gdy BOTRZ niedostępne. */
.chatrz-bubble {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background-color: var(--chatrz-primary);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--chatrz-shadow-panel);
    transition: background-color 0.15s ease, transform 0.15s ease;
    padding: 0;
}

.chatrz-bubble:hover,
.chatrz-bubble:focus {
    background-color: var(--chatrz-primary-hover);
    transform: scale(1.05);
    outline: none;
}

.chatrz-bubble:focus-visible {
    box-shadow: var(--chatrz-shadow-panel), 0 0 0 3px rgba(16, 163, 127, 0.4);
}

.chatrz-widget--expanded .chatrz-bubble {
    display: none;
}

/* MOBILE-FIRST: panel sticky-bottom — wysokość/pozycja sterowane PRZEZ JS (inline style)
   żeby ominąć iOS Safari quirks z vh/dvh/inset/position:fixed gdy strona ma scroll-x.
   1.0.149 — radically different approach: JS ustawia `style.top` + `style.height` w px
   bazując na `window.visualViewport.height` (real visible viewport height — uwzględnia
   keyboard, browser chrome). Recompute on resize/orientation change.
   CSS fallback `bottom: 0; height: 85vh` dla case JS-fail (rzadkie, defensive). */
.chatrz-panel {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 85vh; /* fallback gdy JS nie zadziała */
    max-height: 85vh;
    background-color: var(--chatrz-bg);
    border-radius: 16px 16px 0 0;
    box-shadow: var(--chatrz-shadow-panel-mobile);
    overflow: hidden;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999999;
    box-sizing: border-box;
}

.chatrz-widget--expanded .chatrz-panel {
    display: flex;
    transform: translateY(0);
}

.chatrz-widget--collapsed .chatrz-panel {
    display: none;
}

/* 1.0.145 — big hammer fix: gdy widget expanded, wymuś body overflow-x: hidden żeby
   strona nie była scrollable horizontal (theme z wide-size > viewport może rozszerzać).
   iOS Safari w takim przypadku pin-uje fixed do layout viewport zamiast visual viewport.
   Klasa `chatrz-widget-expanded` dodawana na body przez widget.js w _openPanel(),
   removed w _closePanel(). */
body.chatrz-widget-expanded {
    overflow-x: hidden !important;
    /* prevent rubber-band / overscroll horizontal */
    overscroll-behavior-x: none;
}
html.chatrz-widget-expanded {
    overflow-x: hidden !important;
}

/* DESKTOP: floating panel bottom-right 440×560.
   1.0.146 — pinned do bottom-right viewport (NIE wewnątrz widget root jak 1.0.143). */
@media (min-width: 769px) and (pointer: fine) {
    .chatrz-panel {
        position: fixed;
        top: auto;
        right: 20px;
        bottom: 20px;
        left: auto;
        width: 440px;
        max-width: 440px;
        height: 560px;
        max-height: calc(100vh - 40px);
        border-radius: var(--chatrz-radius-panel);
        box-shadow: var(--chatrz-shadow-panel);
        transform: translateY(20px);
        opacity: 0;
        transition: transform 220ms ease, opacity 220ms ease;
        background-color: rgba(255, 255, 255, 0.92);
        -webkit-backdrop-filter: blur(12px) saturate(140%);
        backdrop-filter: blur(12px) saturate(140%);
    }
    .chatrz-widget--expanded .chatrz-panel {
        transform: translateY(0);
        opacity: 1;
    }
    @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
        .chatrz-panel { background-color: var(--chatrz-bg); }
    }
}

@media (prefers-reduced-motion: reduce) {
    .chatrz-panel { transition: none; }
}

/* Header — neutralny + status dot + dynamic operator name. */
.chatrz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background-color: var(--chatrz-bg);
    color: var(--chatrz-text);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 52px;
    border-bottom: 1px solid var(--chatrz-border);
    gap: 8px;
}
@media (min-width: 769px) and (pointer: fine) {
    .chatrz-header {
        padding: 14px 18px;
        min-height: auto;
        background-color: transparent;
    }
}

/* Title row: status dot + name. */
.chatrz-title {
    font-size: 15px;
    font-weight: 500;
    margin: 0;
    color: var(--chatrz-text);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
@media (min-width: 769px) and (pointer: fine) {
    .chatrz-title { font-size: 14px; }
}

.chatrz-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--chatrz-status-offline);
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}
.chatrz-status-dot--online { background-color: var(--chatrz-status-online); }
.chatrz-status-dot--offline { background-color: var(--chatrz-status-offline); }

.chatrz-title-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 1.0.135 — wersja widget w nagłówku: small + prawej + subtle gray (debug dla admin
   po update — szybkie sprawdzenie czy cache odświeżony). Push prawej przez margin-left:auto. */
.chatrz-version {
    font-size: 10px;
    font-weight: 400;
    color: var(--chatrz-text-muted);
    opacity: 0.55;
    margin-left: auto;
    padding-right: 4px;
    letter-spacing: 0;
    flex-shrink: 0;
    user-select: none;
}

/* Close — outline icon, ghost. */
.chatrz-close {
    background: transparent;
    border: none;
    color: var(--chatrz-text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}
@media (min-width: 769px) and (pointer: fine) {
    .chatrz-close { width: 32px; height: 32px; font-size: 20px; }
}

.chatrz-close:hover,
.chatrz-close:focus {
    background-color: rgba(0, 0, 0, 0.04);
    color: var(--chatrz-text);
    outline: none;
}

/* Body / messages — smooth scroll, większy whitespace. */
.chatrz-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chatrz-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background-color: var(--chatrz-bg);
    overscroll-behavior: contain;
}
@media (min-width: 769px) and (pointer: fine) {
    .chatrz-messages {
        padding: 18px 14px;
        background-color: transparent;
    }
}

/* Message row — flex z avatar + bubble column. */
.chatrz-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 88%;
    animation: chatrz-msg-fade 200ms ease;
}
@keyframes chatrz-msg-fade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .chatrz-message { animation: none; }
}

/* Avatar — 24px mobile / 28px desktop. Visitor pastel-hash, Operator graphite. */
.chatrz-avatar {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--chatrz-text);
    line-height: 1;
    user-select: none;
    text-transform: uppercase;
}
@media (min-width: 769px) and (pointer: fine) {
    .chatrz-avatar { width: 28px; height: 28px; font-size: 11px; }
}

/* Grouped message — placeholder space (same size as avatar) zamiast avatar circle. */
.chatrz-message--grouped .chatrz-avatar {
    visibility: hidden;
}

/* Visitor: avatar po prawej. */
.chatrz-message--visitor {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* Agent: avatar po lewej (default flex-direction row). */
.chatrz-message--agent {
    align-self: flex-start;
}

/* Operator avatar = graphite (spójne z send button). */
.chatrz-message--agent .chatrz-avatar {
    background-color: var(--chatrz-send-bg);
    color: #ffffff;
}

/* Bubble column (bubble + optional time below). */
.chatrz-message-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
}

.chatrz-message-bubble {
    padding: 10px 14px;
    border-radius: var(--chatrz-radius-msg);
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: var(--chatrz-shadow-soft);
}

.chatrz-message--visitor .chatrz-message-bubble {
    background-color: var(--chatrz-visitor-bg);
    color: var(--chatrz-visitor-text);
}

.chatrz-message--agent .chatrz-message-bubble {
    background-color: var(--chatrz-agent-bg);
    color: var(--chatrz-agent-text);
}

/* 1.0.134 — author name nad bubble removed (user explicit: tylko avatar). */
.chatrz-message-author {
    display: none !important;
}

.chatrz-message-time {
    font-size: 10px;
    color: var(--chatrz-text-muted);
    opacity: 0.6;
    margin-top: 2px;
    padding: 0 4px;
}
.chatrz-message--visitor .chatrz-message-time { text-align: right; }

/* 1.0.160 visitor-side read receipts: tick przy visitor message
   - default szary ✓ (delivered = wpisana w widget)
   - .chatrz-message--seen niebieski ✓✓ (operator zobaczył przez mark-read) */
.chatrz-message-tick {
    display: inline-block;
    margin-left: 4px;
    color: #9ca3af;
    font-weight: 600;
    letter-spacing: -2px;
}
.chatrz-message--seen .chatrz-message-tick {
    color: #1e88e5;
}
.chatrz-message--seen .chatrz-message-tick::after {
    content: '✓';
}

.chatrz-message--system {
    align-self: center;
    max-width: 100%;
    gap: 0;
}
.chatrz-message--system .chatrz-avatar { display: none; }
.chatrz-message--system .chatrz-message-bubble {
    background-color: transparent;
    color: var(--chatrz-system-text);
    font-size: 12px;
    font-style: italic;
    padding: 4px 8px;
    box-shadow: none;
}
.chatrz-message--system .chatrz-message-time { display: none; }

/* "Łączymy z operatorem..." indicator. */
.chatrz-connecting-indicator {
    align-self: center;
    margin: 4px 0;
    padding: 6px 14px;
    background-color: rgba(0, 0, 0, 0.04);
    color: var(--chatrz-system-text);
    font-size: 12px;
    border-radius: 14px;
    animation: chatrz-pulse 1.8s ease-in-out infinite;
}
@keyframes chatrz-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .chatrz-connecting-indicator { animation: none; opacity: 0.85; }
}
.chatrz-connecting-indicator--waiting {
    background-color: rgba(245, 158, 11, 0.10);
    color: #92400e;
}
.chatrz-connecting-indicator--stale {
    background-color: rgba(220, 38, 38, 0.08);
    color: #991b1b;
    animation: none;
    border: 1px solid rgba(220, 38, 38, 0.2);
}
/* 2.0.43 — komunikat nieobecności (święto/poza godzinami) NIE pulsuje jak „łączę" —
   to stan końcowy „zostaw wiadomość", nie oczekiwanie na połączenie. Zielona ramka. */
.chatrz-connecting-indicator--offline {
    animation: none;
    background-color: rgba(16, 163, 127, 0.08);
    color: #0f5132;
    border: 1px solid rgba(16, 163, 127, 0.25);
}

.chatrz-message--pending .chatrz-message-bubble {
    opacity: 0.6;
}

.chatrz-message--failed .chatrz-message-bubble {
    background-color: var(--chatrz-error-bg);
    color: var(--chatrz-error-text);
    border: 1px solid var(--chatrz-error-text);
}

/* Error banner */
.chatrz-error {
    padding: 0 16px;
    background-color: var(--chatrz-error-bg);
    color: var(--chatrz-error-text);
    font-size: 12px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.2s ease, padding 0.2s ease;
}

.chatrz-error--visible {
    padding: 8px 16px;
    max-height: 60px;
}

/* 1.0.134 — Name row neutralizowane: białe tło, subtle border, label nad inputem,
   szary asterisk. CSS override inline styles (specificity przez `.chatrz-widget`).
   1.0.140 — two-step submit: arrow button obok inputa + fade-out gdy name zatwierdzone. */
.chatrz-widget .chatrz-name-row {
    padding: 12px 16px !important;
    border-top: 1px solid var(--chatrz-border) !important;
    background: var(--chatrz-bg) !important;
    overflow: hidden;
    transition: opacity 0.25s ease, max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s ease, border 0.25s ease;
    max-height: 240px;
    opacity: 1;
}
.chatrz-widget .chatrz-name-row--submitted {
    opacity: 0 !important;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-top-color: transparent !important;
    pointer-events: none;
}
.chatrz-widget .chatrz-name-row label {
    display: block !important;
    font-size: 12px !important;
    color: var(--chatrz-text-muted) !important;
    margin-bottom: 6px !important;
    font-weight: 500 !important;
}
.chatrz-widget .chatrz-name-row label span {
    color: var(--chatrz-text-muted) !important;
    font-weight: 400 !important;
}
.chatrz-widget .chatrz-name-input-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}
.chatrz-widget .chatrz-name-input {
    flex: 1 !important;
    padding: 10px 12px !important;
    border: 1px solid var(--chatrz-border) !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    background-color: var(--chatrz-bg) !important;
    color: var(--chatrz-text) !important;
    box-sizing: border-box !important;
    outline: none !important;
    box-shadow: var(--chatrz-shadow-soft) !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}
.chatrz-widget .chatrz-name-input:focus {
    border-color: var(--chatrz-border-strong) !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06), var(--chatrz-shadow-soft) !important;
}
.chatrz-widget .chatrz-name-hint {
    margin: 6px 0 0 !important;
    font-size: 11px !important;
    color: var(--chatrz-text-muted) !important;
}
/* 1.0.140 — arrow submit button (identyczny styling jak send button) */
.chatrz-widget .chatrz-name-submit {
    background-color: var(--chatrz-send-bg);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    padding: 0;
    width: 36px;
    height: 36px;
    cursor: pointer;
    flex: 0 0 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}
.chatrz-widget .chatrz-name-submit svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}
.chatrz-widget .chatrz-name-submit:hover:not(:disabled),
.chatrz-widget .chatrz-name-submit:focus:not(:disabled) {
    background-color: var(--chatrz-send-bg-hover);
    outline: none;
}
.chatrz-widget .chatrz-name-submit:focus-visible {
    box-shadow: 0 0 0 3px rgba(31, 41, 55, 0.25);
}
.chatrz-widget .chatrz-name-submit:disabled {
    background-color: var(--chatrz-border-strong);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Form — sticky bottom. 1.0.142 tight padding + overflow guard dla iPhone SE / Android 360px. */
.chatrz-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    background-color: var(--chatrz-bg);
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 2;
    align-items: flex-end;
    border-top: 1px solid var(--chatrz-border);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}
@media (min-width: 769px) and (pointer: fine) {
    .chatrz-form {
        padding: 12px 16px;
        background-color: transparent;
    }
}

/* Input — 1.0.142 match name input (font 14px, padding 10/12) + defensive flex.
   1.0.143 — usunięte `width: 100%` (powodowało overflow w flex container — send button
   wychodził poza). Plus 1.0.143: `min-width: 60px` żeby textarea miała sensowny minimum
   nawet gdy maksymalnie skompresowana.
   font-size 14px na mobile = ten sam styl jak name input (Radek 1.0.142: konsystencja). */
.chatrz-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid var(--chatrz-border);
    border-radius: var(--chatrz-radius-input);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    background-color: var(--chatrz-bg);
    color: var(--chatrz-text);
    min-height: 40px;
    max-height: 120px;
    box-shadow: var(--chatrz-shadow-soft);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}
@media (min-width: 769px) and (pointer: fine) {
    .chatrz-input {
        padding: 10px 14px;
        min-height: 40px;
    }
}

.chatrz-input::placeholder {
    color: var(--chatrz-text-muted);
    opacity: 0.7;
}

.chatrz-input:focus {
    border-color: var(--chatrz-border-strong);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06), var(--chatrz-shadow-soft);
}

.chatrz-input:disabled {
    background-color: var(--chatrz-bg-soft);
    cursor: not-allowed;
}

/* Send — graphite fixed (1.0.134, NIE z presetu). Biała strzałka SVG.
   1.0.142 — 36×36 wszędzie (mobile + desktop) — konsystencja z .chatrz-name-submit,
   eliminuje overflow na małych telefonach (iPhone SE 320px / Android 360px). */
.chatrz-send {
    background-color: var(--chatrz-send-bg);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    padding: 0;
    width: 36px;
    height: 36px;
    cursor: pointer;
    flex: 0 0 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.chatrz-send svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* 1.0.152 — Messenger-style toggle: thumb (pusty input) ↔ arrow (jest tekst).
   Domyślnie thumb widoczny, arrow ukryty. JS toggluje klasy chatrz-send--thumb/--arrow. */
.chatrz-send__icon {
    display: none;
}
.chatrz-send.chatrz-send--thumb .chatrz-send__icon--thumb {
    display: block;
}
.chatrz-send.chatrz-send--arrow .chatrz-send__icon--arrow {
    display: block;
}

.chatrz-send:hover:not(:disabled),
.chatrz-send:focus:not(:disabled) {
    background-color: var(--chatrz-send-bg-hover);
    outline: none;
}

.chatrz-send:focus-visible {
    box-shadow: 0 0 0 3px rgba(31, 41, 55, 0.25);
}

.chatrz-send:disabled {
    background-color: var(--chatrz-border-strong);
    cursor: not-allowed;
    opacity: 0.5;
}

@media (prefers-reduced-motion: reduce) {
    .chatrz-bubble,
    .chatrz-error,
    .chatrz-input,
    .chatrz-send,
    .chatrz-status-dot {
        transition: none;
    }
    .chatrz-bubble:hover,
    .chatrz-bubble:focus {
        transform: none;
    }
}

/* 2.0.27 — link „opisowy" w treści wiadomości operatora.
   Styling: kolor dziedziczy z tekstu bubble, podkreślenie kropkowane (subtelne ale klikalne).
   Hover: pełne podkreślenie + akcent koloru. Visited: bez różnicy (klient nie widzi historii).
   Operator wstawia przez markdown: [Suche oko](https://drzielinska.pl/suche-oko/) */
.chatrz-message-bubble a.chatrz-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: text-decoration-style 0.12s ease;
}
.chatrz-message-bubble a.chatrz-link:hover,
.chatrz-message-bubble a.chatrz-link:focus {
    text-decoration-style: solid;
    text-decoration-color: currentColor;
}
.chatrz-message-bubble a.chatrz-link:focus {
    outline: 2px solid rgba(0,120,210,0.4);
    outline-offset: 1px;
    border-radius: 2px;
}

/* 2.0.27 — CTA chip buttons (Quick Reply). Operator wstawia {cta:Tak|Nie} w wiadomość/szablon,
   widget renderuje rząd buttonów pod bubble. Klik → wysyła label jako visitor message,
   wszystkie chipy z tej wiadomości się dezaktywują (jednorazowy wybór). */
.chatrz-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.chatrz-cta-chip {
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    color: #1d2327;
    border: 1px solid #2271b1;
    border-radius: 16px;
    padding: 5px 12px;
    font-size: 13px;
    line-height: 1.3;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s ease, color 0.12s ease, transform 0.08s ease;
}
.chatrz-cta-chip:hover:not(:disabled) {
    background: #2271b1;
    color: #fff;
}
.chatrz-cta-chip:active:not(:disabled) {
    transform: scale(0.97);
}
.chatrz-cta-chip:focus-visible {
    outline: 2px solid rgba(34,113,177,0.6);
    outline-offset: 1px;
}
.chatrz-cta-chip:disabled {
    cursor: default;
    opacity: 0.55;
    background: #f0f0f1;
    color: #50575e;
    border-color: #c3c4c7;
}
.chatrz-cta-chip.chatrz-cta-chip--selected {
    background: #2271b1;
    color: #fff;
    border-color: #1a5a8a;
    opacity: 1;
}

/* 2.0.31 — interactive templates: input row pod bubble (text/tel/email/date type) */
.chatrz-q-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
}
.chatrz-q-input {
    flex: 1 1 140px;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
}
.chatrz-q-input:focus {
    outline: 2px solid rgba(34,113,177,0.4);
    outline-offset: 1px;
    border-color: #2271b1;
}
.chatrz-q-input:disabled {
    background: #f0f0f1;
    color: #50575e;
}
.chatrz-q-submit {
    appearance: none;
    -webkit-appearance: none;
    background: #2271b1;
    color: #fff;
    border: 1px solid #1a5a8a;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}
.chatrz-q-submit:hover:not(:disabled) { background: #1a5a8a; }
.chatrz-q-submit:disabled { opacity: 0.55; cursor: default; }
.chatrz-q-error {
    flex: 1 0 100%;
    color: #b32d2e;
    font-size: 12px;
    margin-top: 2px;
}
