/* Funeral AI Chat - Frontend Styles */
/* Markdown (marked.js) rendering improvements */
.funeral-ai-chat-message .markdown-paragraph {
    margin: 0.35em 0 0.85em;
    line-height: 1.55;
}
.funeral-ai-chat-message .markdown-heading {
    margin: 0.8em 0 0.4em;
    font-weight: 700;
    line-height: 1.25;
}
.funeral-ai-chat-message .markdown-h1 {
    font-size: 1.25rem;
}
.funeral-ai-chat-message .markdown-h2 {
    font-size: 1.15rem;
}
.funeral-ai-chat-message .markdown-h3 {
    font-size: 1.05rem;
}
.funeral-ai-chat-message .markdown-quote {
    border-left: 3px solid #e5e7eb;
    padding: 6px 12px;
    margin: 8px 0;
    background: #fafafa;
    border-radius: 6px;
    color: #444;
}
.funeral-ai-chat-message .markdown-code-block {
    background: #f6f8fa;
    padding: 10px 12px;
    border-radius: 6px;
    font-family:
        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", monospace;
    font-size: 12px;
    overflow: auto;
}
.funeral-ai-chat-message .markdown-inline-code {
    background: #f1f3f5;
    padding: 0 4px;
    border-radius: 4px;
    font-family:
        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", monospace;
    font-size: 12px;
}
.funeral-ai-chat-message .markdown-separator {
    border: 0;
    border-top: 1px solid #e9ecef;
    margin: 12px 0;
}
/* Lists */
.funeral-ai-chat-message .markdown-list {
    margin: 0.35em 0 0.9em;
    padding-left: 1.25em;
}
.funeral-ai-chat-message .markdown-list .markdown-list {
    margin: 0.2em 0 0.6em;
}
.funeral-ai-chat-message .markdown-list-item {
    margin: 0.2em 0;
    list-style-position: outside;
}
.funeral-ai-chat-message .markdown-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.6em 0 1em;
}
.funeral-ai-chat-message .markdown-table th,
.funeral-ai-chat-message .markdown-table td {
    border: 1px solid #e9ecef;
    padding: 6px 8px;
    text-align: left;
}
.funeral-ai-chat-message .markdown-table thead th {
    background: #f8f9fa;
    font-weight: 600;
}
.funeral-ai-chat-message .funeral-ai-chat-message-content a.external-link,
.funeral-ai-chat-message .funeral-ai-chat-message-content a.email-link,
/* Send button loading (three animated dots) */
@keyframes fac-dot {
    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}
#funeral-ai-chat-form button.loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#funeral-ai-chat-form button.loading > div {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}
#funeral-ai-chat-form button.loading > div span {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    animation: fac-dot 1s infinite ease-in-out;
}
#funeral-ai-chat-form button.loading > div span:nth-child(2) {
    animation-delay: 0.15s;
}
#funeral-ai-chat-form button.loading > div span:nth-child(3) {
    animation-delay: 0.3s;
}

.funeral-ai-chat-widget {
    position: fixed;
    z-index: 999999;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
        Cantarell, sans-serif;
}

/* Pozycjonowanie bubble */
.funeral-ai-chat-widget.position-bottom-right {
    bottom: 30px;
    right: 30px;
}

.funeral-ai-chat-widget.position-bottom-left {
    bottom: 30px;
    left: 30px;
}

.funeral-ai-chat-widget.position-top-right {
    top: 30px;
    right: 30px;
}

.funeral-ai-chat-widget.position-top-left {
    top: 30px;
    left: 30px;
}

/* Mniejsze marginesy dla tabletów */
@media (max-width: 768px) {
    .funeral-ai-chat-widget.position-bottom-right {
        bottom: 20px;
        right: 20px;
    }

    .funeral-ai-chat-widget.position-bottom-left {
        bottom: 20px;
        left: 20px;
    }

    .funeral-ai-chat-widget.position-bottom-center {
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
    }

    .funeral-ai-chat-widget.position-top-right {
        top: 20px;
        right: 20px;
    }

    .funeral-ai-chat-widget.position-top-left {
        top: 20px;
        left: 20px;
    }
}

/* Jeszcze mniejsze marginesy dla mobilek */
@media (max-width: 480px) {
    .funeral-ai-chat-widget.position-bottom-right {
        bottom: 15px;
        right: 15px;
    }

    .funeral-ai-chat-widget.position-bottom-left {
        bottom: 15px;
        left: 15px;
    }

    .funeral-ai-chat-widget.position-bottom-center {
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
    }

    .funeral-ai-chat-widget.position-top-right {
        top: 15px;
        right: 15px;
    }

    .funeral-ai-chat-widget.position-top-left {
        top: 15px;
        left: 15px;
    }
}

/* Minimalne marginesy dla bardzo małych ekranów */
@media (max-width: 360px) {
    .funeral-ai-chat-widget.position-bottom-right {
        bottom: 10px;
        right: 10px;
    }

    .funeral-ai-chat-widget.position-bottom-left {
        bottom: 10px;
        left: 10px;
    }

    .funeral-ai-chat-widget.position-bottom-center {
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
    }

    .funeral-ai-chat-widget.position-top-right {
        top: 10px;
        right: 10px;
    }

    .funeral-ai-chat-widget.position-top-left {
        top: 10px;
        left: 10px;
    }
}

/* Mobile full-width pill */
@media (max-width: 768px) {
    .funeral-ai-chat-widget.fac-mobile-bar {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        transform: none !important;
        display: flex;
        justify-content: center;
        padding: 0 18px 18px;
        box-sizing: border-box;
    }

    .funeral-ai-chat-widget.fac-mobile-bar.position-bottom-left,
    .funeral-ai-chat-widget.fac-mobile-bar.position-bottom-right,
    .funeral-ai-chat-widget.fac-mobile-bar.position-bottom-center {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        transform: none !important;
    }

    .funeral-ai-chat-widget.fac-mobile-bar .funeral-ai-chat-bubble {
        width: 100% !important;
        max-width: 560px;
        border-radius: 18px !important;
        min-height: 64px;
        height: auto !important;
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    .funeral-ai-chat-widget.fac-mobile-bar
        .funeral-ai-chat-bubble.has-animated-text {
        border-radius: 18px !important;
        padding: 0 20px !important;
    }

    .funeral-ai-chat-widget.fac-mobile-bar .funeral-ai-chat-tooltip {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

body.fac-chat-fullscreen-open {
    overflow: hidden;
}

@media (min-width: 769px) {
    .funeral-ai-chat-widget.fac-desktop-fullscreen {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: clamp(20px, 5vw, 60px);
        padding-right: clamp(64px, 6vw, 96px);
        padding-left: clamp(96px, 8vw, 140px);
        --fac-fullscreen-top-gap: clamp(28px, 2vw, 40px);
        --fac-fullscreen-bottom-gap: clamp(28px, 2vw, 40px);
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(9, 16, 28, 0.55);
        backdrop-filter: blur(4px);
        z-index: 2147483647 !important;
    }

    .funeral-ai-chat-widget.fac-desktop-fullscreen .funeral-ai-chat-window {
        position: relative !important;
        width: 100% !important;
        height: calc(
            100% -
                (
                    var(--fac-fullscreen-top-gap) +
                        var(--fac-fullscreen-bottom-gap)
                )
        ) !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: clamp(18px, 2.4vw, 26px) !important;
        box-shadow: 0 28px 100px rgba(10, 18, 32, 0.5);
        transform: none !important;
        margin-top: var(--fac-fullscreen-top-gap);
        margin-bottom: var(--fac-fullscreen-bottom-gap);
    }

    .funeral-ai-chat-widget.fac-desktop-fullscreen .funeral-ai-chat-bubble {
        position: fixed;
        right: auto !important;
        bottom: var(--fac-fullscreen-bottom-gap);
        transform: none;
        z-index: 2147483647;
        background: linear-gradient(
            135deg,
            var(--bubble-color, var(--bubble-bg-color, #2c3e50)),
            var(--bubble-secondary-color, rgba(44, 62, 80, 0.85))
        ) !important;
    }

    .funeral-ai-chat-widget.fac-desktop-fullscreen
        .funeral-ai-chat-window.show {
        opacity: 1;
    }

    .funeral-ai-chat-widget.fac-desktop-fullscreen
        .funeral-ai-chat-input-container {
        display: flex;
        justify-content: center;
        padding: clamp(18px, 2.6vw, 28px) clamp(20px, 3vw, 48px);
    }

    .funeral-ai-chat-widget.fac-desktop-fullscreen .funeral-ai-chat-form {
        width: 100%;
        max-width: min(960px, calc(100% - clamp(96px, 8vw, 160px)));
        margin: 0 auto;
        gap: clamp(10px, 1vw, 16px);
    }

    .funeral-ai-chat-widget.fac-desktop-fullscreen .funeral-ai-chat-input {
        margin-right: clamp(10px, 1vw, 16px);
        padding: clamp(12px, 1.2vw, 18px) clamp(18px, 2vw, 26px);
        font-size: clamp(15px, 1.2vw, 18px);
        flex: 1;
    }

    .funeral-ai-chat-widget.fac-desktop-fullscreen .funeral-ai-chat-send {
        width: clamp(52px, 3.6vw, 64px);
        height: clamp(52px, 3.6vw, 64px);
        font-size: clamp(16px, 1.4vw, 22px);
    }
}

/* Chat Bubble */
.funeral-ai-chat-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        var(--bubble-bg-color, #2c3e50),
        var(--accent-color, #3498db)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    animation: subtlePulse 3s ease-in-out infinite;

    /* CSS Custom Properties dla dynamicznych wartości */
    --bubble-border-radius: 50%;
    --bubble-color: var(--bubble-bg-color, #2c3e50);
    --ripple-color: rgba(44, 62, 80, 0.3);
    --fac-glow-primary: rgba(52, 152, 219, 0.8);
    --fac-glow-secondary: rgba(104, 211, 174, 0.6);
}

/* Bubble icon colors */
.funeral-ai-chat-bubble .bubble-icon svg,
.funeral-ai-chat-bubble .bubble-icon svg path {
    fill: var(--bubble-text-color, #ffffff) !important;
}

/* Pastylka z animowanymi pytaniami - nowy styl */
.funeral-ai-chat-bubble.has-animated-text {
    width: min(320px, calc(100vw - 60px)) !important;
    height: 60px !important;
    border-radius: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 0 20px !important;
    overflow: hidden !important;
    position: relative !important;
    transition: all 0.3s ease !important;
}

/* Ukryj tooltip gdy pastylka jest aktywna - ale tylko jeśli nie jest bottom-center */
.funeral-ai-chat-bubble.has-animated-text:not(.position-bottom-center)
    ~ .funeral-ai-chat-tooltip {
    display: none !important;
}

/* Gdy chat jest otwarty - przejście do okrągłego bubble */
.funeral-ai-chat-bubble.has-animated-text.chat-open {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    justify-content: center !important;
    align-items: center !important;
    background: linear-gradient(
        135deg,
        var(--bubble-color, var(--bubble-bg-color, #2c3e50)),
        var(--bubble-secondary-color, rgba(44, 62, 80, 0.85))
    ) !important;
}

/* Ukryj animowane pytania gdy chat otwarty */
.funeral-ai-chat-bubble.has-animated-text.chat-open .animated-questions {
    display: none !important;
}

/* Ukryj awatar/ikonę po lewej gdy chat otwarty */
.funeral-ai-chat-bubble.has-animated-text.chat-open .pill-avatar,
.funeral-ai-chat-bubble.has-animated-text.chat-open .pill-icon {
    display: none !important;
}

.funeral-ai-chat-bubble.has-animated-text.chat-open .bubble-icon {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
}

/* Responsywność dla pastylki */
@media (max-width: 480px) {
    .funeral-ai-chat-bubble.has-animated-text {
        width: clamp(160px, 60vw, 200px) !important;
        height: 55px !important;
        padding: 0 14px !important;
    }

    .funeral-ai-chat-bubble.has-animated-text.chat-open {
        width: 55px !important;
        height: 55px !important;
    }

    .funeral-ai-chat-bubble.has-animated-text .animated-questions {
        margin-left: 8px;
    }

    .funeral-ai-chat-bubble.has-animated-text .pill-avatar {
        margin-right: 12px;
    }

    .funeral-ai-chat-bubble.has-animated-text .question-text {
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .funeral-ai-chat-bubble.has-animated-text {
        width: clamp(150px, 70vw, 190px) !important;
        height: 50px !important;
        padding: 0 12px !important;
    }

    .funeral-ai-chat-bubble.has-animated-text.chat-open {
        width: 50px !important;
        height: 50px !important;
    }

    .funeral-ai-chat-bubble.has-animated-text .animated-questions {
        margin-left: 6px;
    }

    .funeral-ai-chat-bubble.has-animated-text .pill-avatar {
        margin-right: 10px;
    }

    .funeral-ai-chat-bubble.has-animated-text .question-text {
        font-size: 11px;
    }
}

.funeral-ai-chat-bubble.has-animated-text .bubble-icon.chat-icon,
.funeral-ai-chat-bubble.has-animated-text .pill-icon {
    flex-shrink: 0;
    z-index: 3;
    order: 1;
    margin-right: 15px;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
}

.funeral-ai-chat-bubble.has-animated-text .bubble-icon.chat-icon svg,
.funeral-ai-chat-bubble.has-animated-text .pill-icon svg {
    width: 24px;
    height: 24px;
}

/* Awatar w pastylce - po lewej stronie */
.funeral-ai-chat-bubble.has-animated-text.has-avatar {
    background: linear-gradient(
        135deg,
        var(--bubble-bg-color, #2c3e50),
        var(--accent-color, #3498db)
    );
    padding: 0 20px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.funeral-ai-chat-bubble.has-animated-text.has-icon {
    background: linear-gradient(
        135deg,
        var(--bubble-bg-color, #2c3e50),
        var(--accent-color, #3498db)
    );
    padding: 0 20px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.funeral-ai-chat-bubble.has-animated-text.chat-open.has-avatar,
.funeral-ai-chat-bubble.has-animated-text.chat-open.has-icon {
    padding: 0 !important;
}

.funeral-ai-chat-bubble.has-animated-text .bubble-avatar {
    width: auto;
    height: auto;
    justify-content: flex-start;
}

.funeral-ai-chat-bubble.has-animated-text .pill-avatar {
    flex-shrink: 0;
    z-index: 3;
    position: relative;
    margin-right: 15px;
    order: 1;
}

.funeral-ai-chat-bubble.has-animated-text .pill-avatar .avatar-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: block;
}

.funeral-ai-chat-bubble.has-animated-text .pill-avatar .online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #4caf50;
    border: 2px solid white;
    border-radius: 50%;
    z-index: 4;
}

/* Animowane pytania w pastylce - po prawej stronie */
.funeral-ai-chat-bubble.has-animated-text .animated-questions {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 36px;
    height: auto;
    z-index: 2;
    text-align: left;
    margin-left: 10px;
    order: 2;
    display: flex;
    align-items: center;
}

.funeral-ai-chat-bubble.has-animated-text .question-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    color: black;
    font-size: 13px;
    font-weight: 500;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    line-height: 1.25;
    padding-right: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.funeral-ai-chat-bubble.has-animated-text .question-text.active {
    opacity: 1;
    transform: translateY(0);
}

.funeral-ai-chat-bubble.has-animated-text .question-text.exiting {
    opacity: 0;
    transform: translateY(-20px);
}

/* Animacja pulsowania dla pastylki */
.funeral-ai-chat-bubble.has-animated-text::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent);
    border-radius: 30px;
    animation: pillShimmer 3s ease-in-out infinite;
    z-index: 1;
}

@keyframes bubblePulse {
    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 0.8;
    }
}

@keyframes textFade {
    0%,
    75%,
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    15%,
    60% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes pillShimmer {
    0%,
    100% {
        opacity: 0.3;
        transform: translateX(-100%);
    }
    50% {
        opacity: 0.6;
        transform: translateX(100%);
    }
}

@keyframes questionSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes questionSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
}

/* Ładny pulsujący efekt fali */
.funeral-ai-chat-bubble::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent);
    border-radius: var(--bubble-border-radius);
    overflow: hidden;
    z-index: 1;
}

.funeral-ai-chat-bubble::after {
    content: "";
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 2px solid var(--ripple-color);
    border-radius: var(--bubble-border-radius);
    animation: rippleEffect 2.5s ease-out infinite;
    z-index: 0;
}

/* Efekt fali pulsującej - teraz używa dynamicznego border-radius */
@keyframes rippleEffect {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
        border-width: 1px;
    }

    50% {
        opacity: 0.4;
        border-width: 2px;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
        border-width: 0px;
    }
}

@keyframes facGlowShimmer {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Minimalny glow border bez modyfikowania wewnętrznego layoutu pastylki */
.funeral-ai-chat-bubble.has-glow-border {
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.25),
        0 0 26px rgba(93, 173, 226, 0.25);
}

.funeral-ai-chat-bubble.has-glow-border::after {
    inset: -2px;
    border-radius: var(--bubble-border-radius);
    border: 2px solid transparent;
    background: linear-gradient(
            130deg,
            rgba(255, 255, 255, 0.75),
            rgba(255, 255, 255, 0.35)
        )
        border-box;
    box-shadow:
        0 0 18px rgba(255, 255, 255, 0.35),
        0 0 28px rgba(93, 173, 226, 0.35);
    animation: facGlowShimmer 4.5s ease infinite;
    pointer-events: none;
    z-index: 0;
}

.funeral-ai-chat-bubble.has-glow-border::before {
    z-index: 1;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.18), transparent);
}

@supports (mask: linear-gradient(#000 0 0)) or
    (-webkit-mask: linear-gradient(#000 0 0)) {
    .funeral-ai-chat-bubble.has-glow-border::after {
        filter: none;
        opacity: 0.9;
        padding: 3px;
        box-sizing: border-box;
        mask:
            linear-gradient(#000 0 0) content-box,
            linear-gradient(#000 0 0);
        mask-composite: exclude;
        -webkit-mask:
            linear-gradient(#000 0 0) content-box,
            linear-gradient(#000 0 0);
        -webkit-mask-composite: xor;
    }
}

/* Subtelny puls głównego przycisku */
@keyframes subtlePulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }

    50% {
        transform: scale(1.03);
        box-shadow: 0 8px 30px rgba(44, 62, 80, 0.3);
    }
}

.funeral-ai-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.25);
    animation: none;
    /* Zatrzymanie animacji podczas hover */
}

.funeral-ai-chat-bubble:hover::after {
    animation: rippleHover 1s ease-out infinite;
    /* Szybszy efekt podczas hover */
}

/* Efekt fali podczas hover */
@keyframes rippleHover {
    0% {
        transform: scale(0.9);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.funeral-ai-chat-bubble:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Doskonałe wyrównanie ikony */
.bubble-icon {
    transition: all 0.3s ease;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #ffffff;
}

.bubble-icon svg {
    width: 24px;
    height: 24px;
    display: block;
    margin: 0 auto;
    fill: #ffffff;
}

.bubble-icon svg path {
    fill: #ffffff;
}

.funeral-ai-chat-bubble.active .chat-icon {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(90deg);
}

.funeral-ai-chat-bubble.active .close-icon {
    display: block !important;
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg);
}

.funeral-ai-chat-bubble.active .bubble-avatar {
    display: none !important;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--notification-badge-bg, #e74c3c);
    color: var(--notification-badge-text, #ffffff);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    border: 2px solid #ffffff;
    z-index: 10;
    animation: notificationPulse 2s ease-in-out infinite;
}

/* Badge pokazuje się dopiero gdy JavaScript jest gotowy */
.notification-badge.show {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

/* Badge z animacją wejścia */
.notification-badge.animate-in {
    animation: badgeSlideIn 0.4s ease-out forwards;
}

@keyframes badgeSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(-10px);
    }

    50% {
        transform: scale(1.1) translateY(-2px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes notificationPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Tooltip z lepszym kontrastem */
.funeral-ai-chat-tooltip {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: 100%;
    transform: translateX(-50%) translateY(-6px);
    margin-bottom: 8px;
    background: var(--tooltip-bg, rgba(44, 62, 80, 0.95));
    color: var(--tooltip-text, #ffffff);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    max-width: 260px;
    min-width: 180px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000001;
    animation: tooltipSlideIn 0.5s ease-out 3s forwards;
    white-space: normal;
    word-wrap: break-word;
    hyphens: auto;
}

@media (max-width: 768px) {
    .funeral-ai-chat-tooltip {
        max-width: 220px;
        min-width: 160px;
        font-size: 12px;
        padding: 10px 14px;
        right: 75px;
    }
}

@media (max-width: 480px) {
    .funeral-ai-chat-tooltip {
        max-width: 200px;
        min-width: 140px;
        font-size: 11px;
        padding: 8px 12px;
        right: 65px;
        line-height: 1.3;
    }
}

@media (max-width: 360px) {
    .funeral-ai-chat-tooltip {
        max-width: 180px;
        min-width: 120px;
        font-size: 10px;
        padding: 6px 10px;
        right: 55px;
    }
}

.funeral-ai-chat-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

.funeral-ai-chat-tooltip.hide {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-1px);
}

.funeral-ai-chat-bubble.has-animated-text ~ .funeral-ai-chat-tooltip {
    max-width: 320px;
    min-width: 220px;
    padding: 14px 20px;
    margin-bottom: 6px;
    transform: translateX(-50%) translateY(-4px);
}

.funeral-ai-chat-bubble.has-animated-text ~ .funeral-ai-chat-tooltip.show {
    transform: translateX(-50%) translateY(-2px);
}

.funeral-ai-chat-bubble.has-animated-text ~ .funeral-ai-chat-tooltip.hide {
    transform: translateX(-50%) translateY(0);
}

.tooltip-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    color: var(--tooltip-text, #ffffff);
}

.tooltip-icon {
    font-size: 18px;
    animation: tooltipIconBounce 2s infinite;
}

@keyframes tooltipIconBounce {
    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-4px);
    }

    60% {
        transform: translateY(-2px);
    }
}

.tooltip-arrow {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid var(--tooltip-bg, rgba(44, 62, 80, 0.95));
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
}

@keyframes tooltipSlideIn {
    0% {
        opacity: 0;
        visibility: hidden;
        transform: translateY(50%) translateX(20px);
    }

    100% {
        opacity: 1;
        visibility: visible;
        transform: translateY(50%) translateX(-5px);
    }
}

/* Responsywność tooltipa */
@media (max-width: 768px) {
    .funeral-ai-chat-tooltip {
        display: none;
    }
}

/* Pozycjonowanie dla różnych pozycji bubble */
.position-bottom-left .funeral-ai-chat-tooltip {
    left: 85px;
    right: auto;
}

.position-bottom-left .tooltip-arrow {
    left: -8px;
    right: auto;
    border-right-color: var(--tooltip-bg, rgba(44, 62, 80, 0.95));
    border-left-color: transparent;
}

.position-top-right .funeral-ai-chat-tooltip,
.position-top-left .funeral-ai-chat-tooltip {
    bottom: auto;
    top: 50%;
}

.position-top-left .funeral-ai-chat-tooltip {
    left: 85px;
    right: auto;
}

.position-top-left .tooltip-arrow {
    left: -8px;
    right: auto;
    border-right-color: var(--tooltip-bg, rgba(44, 62, 80, 0.95));
    border-left-color: transparent;
}

/* Center positions */
.position-center-right .funeral-ai-chat-tooltip {
    right: 85px;
    bottom: 50%;
    transform: translateY(50%);
}

.position-center-left .funeral-ai-chat-tooltip {
    left: 85px;
    right: auto;
    bottom: 50%;
    transform: translateY(50%);
}

.position-center-left .tooltip-arrow {
    left: -8px;
    right: auto;
    border-right-color: var(--tooltip-bg, rgba(44, 62, 80, 0.95));
    border-left-color: transparent;
}

/* Pozycjonowanie tooltip - zawsze nad pastylką i wyśrodkowany względem jej szerokości */
.funeral-ai-chat-widget.position-bottom-right .funeral-ai-chat-tooltip,
.funeral-ai-chat-widget.position-bottom-left .funeral-ai-chat-tooltip,
.funeral-ai-chat-widget.position-bottom-center .funeral-ai-chat-tooltip,
.funeral-ai-chat-widget.position-top-right .funeral-ai-chat-tooltip,
.funeral-ai-chat-widget.position-top-left .funeral-ai-chat-tooltip,
.funeral-ai-chat-widget.position-center-right .funeral-ai-chat-tooltip,
.funeral-ai-chat-widget.position-center-left .funeral-ai-chat-tooltip {
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: 100% !important;
    transform: translateX(-50%) translateY(-16px) !important;
    margin-bottom: 16px !important;
}

.funeral-ai-chat-widget.position-bottom-right .tooltip-arrow,
.funeral-ai-chat-widget.position-bottom-left .tooltip-arrow,
.funeral-ai-chat-widget.position-bottom-center .tooltip-arrow,
.funeral-ai-chat-widget.position-top-right .tooltip-arrow,
.funeral-ai-chat-widget.position-top-left .tooltip-arrow,
.funeral-ai-chat-widget.position-center-right .tooltip-arrow,
.funeral-ai-chat-widget.position-center-left .tooltip-arrow {
    top: 100% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    border-top-color: var(--tooltip-bg, rgba(44, 62, 80, 0.95)) !important;
    border-bottom-color: transparent !important;
    border-left-color: transparent !important;
    border-right-color: transparent !important;
}

/* Responsywne pozycjonowanie dla mobile */
@media (max-width: 768px) {
    .position-bottom-left .funeral-ai-chat-tooltip,
    .position-top-left .funeral-ai-chat-tooltip,
    .position-center-left .funeral-ai-chat-tooltip {
        left: 75px;
    }

    .position-center-right .funeral-ai-chat-tooltip {
        right: 75px;
    }

    .position-bottom-center .funeral-ai-chat-tooltip {
        transform: translateX(-50%) translateY(-15px);
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .position-bottom-left .funeral-ai-chat-tooltip,
    .position-top-left .funeral-ai-chat-tooltip,
    .position-center-left .funeral-ai-chat-tooltip {
        left: 65px;
    }

    .position-center-right .funeral-ai-chat-tooltip {
        right: 65px;
    }

    .position-bottom-center .funeral-ai-chat-tooltip {
        transform: translateX(-50%) translateY(-12px);
        margin-bottom: 12px;
    }
}

@media (max-width: 360px) {
    .position-bottom-left .funeral-ai-chat-tooltip,
    .position-top-left .funeral-ai-chat-tooltip,
    .position-center-left .funeral-ai-chat-tooltip {
        left: 55px;
    }

    .position-center-right .funeral-ai-chat-tooltip {
        right: 55px;
    }

    .position-bottom-center .funeral-ai-chat-tooltip {
        transform: translateX(-50%) translateY(-10px);
        margin-bottom: 10px;
    }
}

/* Ensure tooltip stays within viewport */
@media (max-width: 380px) {
    .funeral-ai-chat-tooltip {
        right: 10px !important;
        left: 10px !important;
        max-width: calc(100vw - 80px);
        transform: translateY(50%) translateX(0) !important;
    }

    .tooltip-arrow {
        display: none;
    }
}

/* Message Avatar - lepsze zintegrowanie z kolorami dymków */
.funeral-ai-chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--user-avatar-bg, #3498db);
    color: var(--user-avatar-text, #ffffff);
    border: 2px solid var(--user-avatar-border, rgba(52, 152, 219, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.funeral-ai-chat-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.funeral-ai-chat-message-avatar span {
    font-size: 16px;
    line-height: 1;
}

.funeral-ai-chat-message.assistant .funeral-ai-chat-message-avatar {
    background: var(--assistant-avatar-bg, #ecf0f1);
    color: var(--assistant-avatar-text, #2c3e50);
    border: 2px solid var(--assistant-avatar-border, rgba(236, 240, 241, 0.5));
}

.funeral-ai-chat-message.user .funeral-ai-chat-message-avatar {
    background: var(--user-avatar-bg, #3498db);
    color: var(--user-avatar-text, #ffffff);
    border: 2px solid var(--user-avatar-border, rgba(52, 152, 219, 0.3));
}

/* Chat Window */
.funeral-ai-chat-window {
    position: fixed;
    width: 350px;
    height: 500px;
    background: var(--chat-window-bg, #ffffff);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 999998;
    overflow: hidden;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
}

/* Opcjonalne style dla neutralnego wyglądu - bez wyraźnych bordera */
.funeral-ai-chat-window.neutral-style {
    border: none;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Opcjonalne style dla miękkich cieni */
.funeral-ai-chat-window.soft-shadow {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Opcjonalne style dla braku granic */
.funeral-ai-chat-window.no-border {
    border: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.funeral-ai-chat-window.show {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Special positioning for bottom positions - open upward */
.funeral-ai-chat-widget.position-bottom-right .funeral-ai-chat-window,
.funeral-ai-chat-widget.position-bottom-left .funeral-ai-chat-window,
.funeral-ai-chat-widget.position-bottom-center .funeral-ai-chat-window {
    bottom: var(--fac-window-offset, 0px) !important;
    top: auto !important;
}

.funeral-ai-chat-widget.position-bottom-center .funeral-ai-chat-window {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
}

.funeral-ai-chat-widget.position-bottom-left .funeral-ai-chat-window {
    left: 0 !important;
    right: auto !important;
}

.funeral-ai-chat-widget.position-bottom-right .funeral-ai-chat-window {
    right: 0 !important;
    left: auto !important;
}

/* Special positioning for top positions - open downward */
.funeral-ai-chat-widget.position-top-right .funeral-ai-chat-window,
.funeral-ai-chat-widget.position-top-left .funeral-ai-chat-window {
    top: 80px !important;
    bottom: auto !important;
}

.funeral-ai-chat-widget.position-top-left .funeral-ai-chat-window {
    left: 0 !important;
    right: auto !important;
}

.funeral-ai-chat-widget.position-top-right .funeral-ai-chat-window {
    right: 0 !important;
    left: auto !important;
}

/* Special positioning for center positions - open to the side */
.funeral-ai-chat-widget.position-center-right .funeral-ai-chat-window,
.funeral-ai-chat-widget.position-center-left .funeral-ai-chat-window {
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
}

.funeral-ai-chat-widget.position-center-left .funeral-ai-chat-window {
    left: 0 !important;
    right: auto !important;
}

.funeral-ai-chat-widget.position-center-right .funeral-ai-chat-window {
    right: 0 !important;
    left: auto !important;
}

/* Responsive positioning */
@media (max-width: 768px) {
    .funeral-ai-chat-window {
        position: fixed;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        z-index: 1000000;
        transform: none !important;
        margin: 0 !important;
    }

    .funeral-ai-chat-widget.position-bottom-left .funeral-ai-chat-window,
    .funeral-ai-chat-widget.position-top-left .funeral-ai-chat-window {
        left: 0;
        right: 0;
    }

    /* Mobile: bottom-center opens fullscreen */
    .funeral-ai-chat-widget.position-bottom-center .funeral-ai-chat-window {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        transform: none !important;
        width: 100% !important;
        height: 100% !important;
    }
}

/* Chat Header */
.funeral-ai-chat-header {
    background: var(
        --chat-header-bg,
        linear-gradient(135deg, #2c3e50, #3498db)
    );
    color: var(--chat-header-text, #ffffff);
    padding: 16px 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .funeral-ai-chat-header {
        border-radius: 0 !important;
    }
}

.funeral-ai-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--chat-header-text, #ffffff);
}

/* Header Title Container with Logo */
.funeral-ai-chat-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

/* Company Logo in Header */
.funeral-ai-chat-header-logo {
    max-height: 32px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    border-radius: 4px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    transition: all 0.2s ease;
}

.funeral-ai-chat-header-logo.logo-left {
    order: -1;
}

.funeral-ai-chat-header-logo.logo-right {
    order: 1;
}

/* Responsive logo sizes */
@media (max-width: 768px) {
    .funeral-ai-chat-header-logo {
        max-height: 28px;
        max-width: 100px;
    }

    .funeral-ai-chat-header-title {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .funeral-ai-chat-header-logo {
        max-height: 24px;
        max-width: 80px;
    }

    .funeral-ai-chat-header-title {
        gap: 6px;
    }
}

/* Header Actions Container */
.funeral-ai-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.funeral-ai-chat-fullscreen-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: 6px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: var(--menu-icon-color, var(--header-text-color, #ffffff));
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
}

.funeral-ai-chat-fullscreen-toggle svg {
    fill: currentColor;
}

.funeral-ai-chat-fullscreen-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.funeral-ai-chat-fullscreen-toggle .fac-exit-icon {
    display: inline-flex;
}

.funeral-ai-chat-fullscreen-toggle .fac-enter-icon {
    display: none;
}

.funeral-ai-chat-fullscreen-toggle.is-active .fac-enter-icon {
    display: inline-flex;
}

.funeral-ai-chat-fullscreen-toggle.is-active .fac-exit-icon {
    display: none;
}

@media (min-width: 769px) {
    .funeral-ai-chat-fullscreen-toggle {
        display: inline-flex;
    }
}

/* Menu Dropdown - Three Dots */
.funeral-ai-chat-menu-dropdown {
    position: relative;
}

.funeral-ai-chat-menu-trigger,
.funeral-ai-chat-minimize {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 6px;
    color: var(--menu-icon-color, var(--header-text-color, #ffffff));
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

/* Accent color dla ikon w menu */
.funeral-ai-chat-menu-trigger svg,
.funeral-ai-chat-minimize svg {
    fill: var(--menu-icon-color, var(--header-text-color, #ffffff)) !important;
}

.funeral-ai-chat-menu-trigger:hover,
.funeral-ai-chat-minimize:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.funeral-ai-chat-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 1000003;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.funeral-ai-chat-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.funeral-ai-chat-menu ul {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.funeral-ai-chat-menu li {
    margin: 0;
}

.funeral-ai-chat-menu-item {
    width: 100%;
    background: transparent;
    border: none;
    padding: 10px 16px;
    text-align: left;
    color: var(--chat-header-text, #333);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    line-height: 1.4;
}

.funeral-ai-chat-menu-item:hover {
    background-color: var(--accent-color, #e9ecef);
    color: var(--chat-header-text, #2c3e50);
}

.funeral-ai-chat-menu-item:focus {
    outline: none;
    background: #e9ecef;
}

.funeral-ai-chat-menu-item svg {
    flex-shrink: 0;
    fill: currentColor !important;
}

.funeral-ai-chat-menu-item:hover svg {
    fill: currentColor !important;
}

/* Messages Container */
.funeral-ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--chat-messages-bg, #f8f9fa);
    scroll-behavior: smooth;
}

.funeral-ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.funeral-ai-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.funeral-ai-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.funeral-ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message Styles - lepsze kolory i kontrast */
.funeral-ai-chat-message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    animation: messageSlideIn 0.3s ease-out;
    gap: 8px;
}

.funeral-ai-chat-message.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.funeral-ai-chat-message.assistant {
    flex-direction: row;
    justify-content: flex-start;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.funeral-ai-chat-message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

.funeral-ai-chat-message.user .funeral-ai-chat-message-wrapper {
    align-items: flex-end;
}

.funeral-ai-chat-message.assistant .funeral-ai-chat-message-wrapper {
    align-items: flex-start;
}

.funeral-ai-chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    min-height: 18px;
}

.funeral-ai-chat-message.user .funeral-ai-chat-message-header {
    flex-direction: row-reverse;
}

.funeral-ai-chat-message-name {
    font-size: 12px;
    font-weight: 600;
    margin: 0;
    color: var(--user-name-color, #2c3e50);
    opacity: 0.8;
    line-height: 18px;
    display: flex;
    align-items: center;
}

.funeral-ai-chat-message-time {
    font-size: 11px;
    color: var(--user-time-color, rgba(44, 62, 80, 0.7));
    margin: 0;
    margin-left: 8px;
    flex-shrink: 0;
    line-height: 18px;
    display: flex;
    align-items: center;
}

.funeral-ai-chat-message.user .funeral-ai-chat-message-time {
    margin-left: 0;
    margin-right: 8px;
}

.funeral-ai-chat-message-content {
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    min-height: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.funeral-ai-chat-message.user .funeral-ai-chat-message-content {
    background: linear-gradient(
        var(--gradient-direction, 135deg),
        var(--user-gradient-start, var(--user-bg-color, #3498db)),
        var(--user-gradient-end, var(--user-bg-color, #2980b9))
    );
    color: var(--user-text-color, #ffffff);
    border-bottom-right-radius: 8px;
}

.funeral-ai-chat-message.assistant .funeral-ai-chat-message-content {
    background: linear-gradient(
        var(--gradient-direction, 135deg),
        var(--assistant-gradient-start, var(--assistant-bg-color, #f8f9fa)),
        var(--assistant-gradient-end, var(--assistant-bg-color, #e9ecef))
    );
    color: var(--assistant-text-color, #2c3e50);
    border-bottom-left-radius: 8px;
}

/* Typing Indicator - minimalistyczna wersja bez brzydkiego tła */
.funeral-ai-chat-typing {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.funeral-ai-chat-typing .funeral-ai-chat-message-avatar {
    opacity: 0.7;
    transition: opacity 0.3s ease;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #999;
}

.funeral-ai-chat-typing .funeral-ai-chat-message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.funeral-ai-chat-typing .funeral-ai-chat-message-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    gap: 6px;
    background: transparent !important;
}

.funeral-ai-chat-typing .funeral-ai-chat-message-name {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    background: transparent !important;
}

.funeral-ai-chat-typing .funeral-ai-chat-message-content {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.05) !important;
    border: none !important;
    border-radius: 20px !important;
    width: fit-content;
    box-shadow: none !important;
    margin: 0 !important;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: typingDotMinimal 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDotMinimal {
    0%,
    80%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Blocked input podczas oczekiwania na odpowiedź */
.funeral-ai-chat-input-container.waiting {
    opacity: 0.7;
    pointer-events: none;
}

.funeral-ai-chat-input:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.funeral-ai-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.funeral-ai-chat-send:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Input Container */
.funeral-ai-chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e1e5e9;
}

.funeral-ai-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.funeral-ai-chat-input {
    flex: 1;
    border: 1px solid var(--chat-input-border, #e0e0e0);
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    font-family: inherit;
    background: var(--chat-input-bg, #ffffff);
    color: var(--chat-input-text, #333);
    outline: none;
    transition: all 0.3s ease;
    margin-right: 12px;
    resize: none;
    max-height: 100px;
}
.funeral-ai-chat-input::placeholder {
    font-family: inherit;
}

.funeral-ai-chat-input:focus {
    border-color: var(--accent-color, #3498db) !important;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1) !important;
}

.funeral-ai-chat-input::placeholder {
    color: var(--chat-input-text, rgba(0, 0, 0, 0.5));
    opacity: 0.6;
}

.funeral-ai-chat-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--chat-send-button-bg);
    color: var(--bubble-text-color, #ffffff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.funeral-ai-chat-send:hover {
    background: var(--accent-color) !important;
    opacity: 0.9;
}

.funeral-ai-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading state */
.funeral-ai-chat-send.loading {
    /* animation: spin 1s linear infinite; */
    opacity: 0.7;
    cursor: not-allowed;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Error message */
.funeral-ai-chat-error {
    background: #fee;
    color: #c33;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    margin: 8px 20px;
    border: 1px solid #fcc;
}

/* Success message */
.funeral-ai-chat-success {
    background: #efe;
    color: #363;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    margin: 8px 20px;
    border: 1px solid #cfc;
}

/* Dark mode support - tylko dla defaultowych kolorów, nie nadpisuje schematów */
@media (prefers-color-scheme: dark) {
    .funeral-ai-chat-window:not([data-color-scheme]),
    .funeral-ai-chat-window[data-color-scheme=""] {
        background: #2d3748;
        color: #e2e8f0;
    }

    .funeral-ai-chat-window:not([data-color-scheme]) .funeral-ai-chat-messages,
    .funeral-ai-chat-window[data-color-scheme=""] .funeral-ai-chat-messages {
        background: #1a202c;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-message.assistant
        .funeral-ai-chat-message-content,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-message.assistant
        .funeral-ai-chat-message-content {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #2d3748;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-input-container,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-input-container {
        background: #2d3748;
        border-color: #4a5568;
    }

    .funeral-ai-chat-window:not([data-color-scheme]) .funeral-ai-chat-input,
    .funeral-ai-chat-window[data-color-scheme=""] .funeral-ai-chat-input {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-input::placeholder,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-input::placeholder {
        color: #a0aec0;
    }

    .funeral-ai-chat-window:not([data-color-scheme]) .funeral-ai-chat-typing,
    .funeral-ai-chat-window[data-color-scheme=""] .funeral-ai-chat-typing {
        background: #2d3748;
        border-color: #4a5568;
    }

    /* Dark mode - lepsze kolory nazw użytkowników tylko dla defaultu */
    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-message-name,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-message-name {
        color: #e2e8f0;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-message.user
        .funeral-ai-chat-message-name,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-message.user
        .funeral-ai-chat-message-name {
        color: #63b3ed;
        font-weight: 700;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-message.assistant
        .funeral-ai-chat-message-name,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-message.assistant
        .funeral-ai-chat-message-name {
        color: #f7fafc;
        font-weight: 700;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-typing
        .funeral-ai-chat-message-name,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-typing
        .funeral-ai-chat-message-name {
        color: #f7fafc;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-message-time,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-message-time {
        color: #a0aec0;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-message.user
        .funeral-ai-chat-message-time,
    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-typing
        .funeral-ai-chat-message-time,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-message.user
        .funeral-ai-chat-message-time,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-typing
        .funeral-ai-chat-message-time {
        color: rgba(99, 179, 237, 0.8);
    }

    .funeral-ai-chat-window:not([data-color-scheme]) .funeral-ai-chat-header,
    .funeral-ai-chat-window[data-color-scheme=""] .funeral-ai-chat-header {
        background: #1a202c;
        color: #e2e8f0;
    }

    .funeral-ai-chat-window:not([data-color-scheme]) .funeral-ai-chat-header h3,
    .funeral-ai-chat-window[data-color-scheme=""] .funeral-ai-chat-header h3 {
        color: #f7fafc;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-menu-trigger,
    .funeral-ai-chat-window:not([data-color-scheme]) .funeral-ai-chat-minimize,
    .funeral-ai-chat-window[data-color-scheme=""] .funeral-ai-chat-menu-trigger,
    .funeral-ai-chat-window[data-color-scheme=""] .funeral-ai-chat-minimize {
        color: #e2e8f0;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-menu-trigger:hover,
    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-minimize:hover,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-menu-trigger:hover,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-minimize:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #f7fafc;
    }

    .funeral-ai-chat-window:not([data-color-scheme]) .funeral-ai-chat-menu,
    .funeral-ai-chat-window[data-color-scheme=""] .funeral-ai-chat-menu {
        background: #2d3748;
        border-color: #4a5568;
    }

    .funeral-ai-chat-window:not([data-color-scheme]) .funeral-ai-chat-menu-item,
    .funeral-ai-chat-window[data-color-scheme=""] .funeral-ai-chat-menu-item {
        color: #e2e8f0;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-menu-item:hover,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-menu-item:hover {
        background: #4a5568;
        color: #f7fafc;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-menu-item
        svg,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-menu-item
        svg {
        fill: #e2e8f0;
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-menu-item:hover
        svg,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-menu-item:hover
        svg {
        fill: #f7fafc;
    }

    .funeral-ai-chat-window:not([data-color-scheme]) .funeral-ai-chat-footer,
    .funeral-ai-chat-window[data-color-scheme=""] .funeral-ai-chat-footer {
        background-color: rgba(40, 44, 52, 0.95);
        border-top-color: rgba(255, 255, 255, 0.1);
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-footer-link,
    .funeral-ai-chat-window[data-color-scheme=""] .funeral-ai-chat-footer-link {
        color: rgba(255, 255, 255, 0.85);
    }

    /* Lepszy kontrast awatarów w trybie ciemnym - tylko dla defaultu */
    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-message.assistant
        .funeral-ai-chat-message-avatar,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-message.assistant
        .funeral-ai-chat-message-avatar {
        background: #4a5568;
        color: #f7fafc;
        border-color: rgba(74, 85, 104, 0.3);
        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-message.user
        .funeral-ai-chat-message-avatar,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-message.user
        .funeral-ai-chat-message-avatar {
        background: #63b3ed;
        color: #1a202c;
        border-color: rgba(99, 179, 237, 0.3);
        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    }

    /* Lepszy kontrast nazw w trybie ciemnym - tylko dla defaultu */
    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-message.user
        .funeral-ai-chat-message-name,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-message.user
        .funeral-ai-chat-message-name {
        color: #e2e8f0;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-message.assistant
        .funeral-ai-chat-message-name,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-message.assistant
        .funeral-ai-chat-message-name {
        color: #f7fafc;
        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    }

    .funeral-ai-chat-window:not([data-color-scheme])
        .funeral-ai-chat-typing
        .funeral-ai-chat-message-name,
    .funeral-ai-chat-window[data-color-scheme=""]
        .funeral-ai-chat-typing
        .funeral-ai-chat-message-name {
        color: #f7fafc;
        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    }
}

/* Accessibility */
.funeral-ai-chat-widget [role="button"] {
    outline: none;
}

.funeral-ai-chat-widget [role="button"]:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Animation for bubble notification */
.funeral-ai-chat-bubble.has-notification {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }

    50% {
        box-shadow: 0 4px 20px rgba(0, 124, 186, 0.4);
    }

    100% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }
}

/* Ulepszenia dla historii czatu */
.historical-message {
    position: relative;
    transform: translateY(5px);
    transition: all 0.3s ease-out;
}

.historical-message::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #007cba, #0085d1);
    border-radius: 2px;
    opacity: 0.3;
}

.historical-message .funeral-ai-chat-message-content {
    border-left: 2px solid rgba(0, 124, 186, 0.1);
    padding-left: 14px !important;
}

/* Animacja pulse dla aktywnego statusu */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Style dla nagłówków sesji */
.chat-history-header,
.session-navigation-header,
.current-session-header {
    animation: slideInFromTop 0.4s ease-out;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover effects dla przycisków w nagłówkach */
.chat-history-header button:hover,
.session-navigation-header button:hover,
.current-session-header button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Style dla elementów sesji */
.chat-session-item {
    animation: fadeInUp 0.3s ease-out;
    animation-fill-mode: both;
}

.chat-session-item:nth-child(1) {
    animation-delay: 0.1s;
}

.chat-session-item:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-session-item:nth-child(3) {
    animation-delay: 0.3s;
}

.chat-session-item:nth-child(4) {
    animation-delay: 0.4s;
}

.chat-session-item:nth-child(5) {
    animation-delay: 0.5s;
}

/* Lepsza responsywność */
@media (max-width: 480px) {
    .chat-history-header,
    .session-navigation-header,
    .current-session-header {
        padding: 8px 12px !important;
    }

    .chat-history-header h4,
    .session-navigation-header h4,
    .current-session-header h4 {
        font-size: 13px !important;
    }

    .chat-history-header button,
    .session-navigation-header button,
    .current-session-header button {
        padding: 4px 8px !important;
        font-size: 10px !important;
    }

    .chat-session-item {
        padding: 12px !important;
        margin-bottom: 8px !important;
    }
}

/* Animacje bubble */
.funeral-ai-chat-bubble.animate-bounce {
    animation: bubbleBounce 1s ease-in-out 3;
}

.funeral-ai-chat-bubble.animate-pulse {
    animation: bubblePulse 2s ease-in-out infinite;
}

.funeral-ai-chat-bubble.animate-shake {
    animation: bubbleShake 0.5s ease-in-out 5;
}

.funeral-ai-chat-bubble.animate-glow {
    animation: bubbleGlow 2s ease-in-out infinite;
}

@keyframes bubbleBounce {
    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-20px);
    }

    60% {
        transform: translateY(-10px);
    }
}

@keyframes bubblePulse {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes bubbleShake {
    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-10px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(10px);
    }
}

@keyframes bubbleGlow {
    0%,
    100% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }

    50% {
        box-shadow:
            0 4px 30px rgba(52, 152, 219, 0.4),
            0 0 20px rgba(52, 152, 219, 0.2);
    }
}

@keyframes bubbleRotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        /* transform: rotate(360deg); */
        transform: rotate(0deg);
    }
}

/* Accent color dla ikon w menu */
.funeral-ai-chat-menu-item svg,
.funeral-ai-chat-menu-trigger svg,
.funeral-ai-chat-minimize svg {
    fill: var(--chat-header-text, #2c3e50) !important;
}

/* Footer z polityką prywatności i brandingiem */
.funeral-ai-chat-footer {
    background-color: var(--chat-footer-bg, rgba(248, 249, 250, 0.95));
    border-top: 1px solid var(--chat-footer-border, rgba(0, 0, 0, 0.08));
    padding: 8px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    font-size: 11px;
    line-height: 1.3;
    backdrop-filter: blur(8px);
    min-height: 32px;
    text-align: center;
}

.funeral-ai-chat-footer-link {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.85;
    font-weight: 600;
    min-height: 20px;
    color: var(--chat-footer-text, #444);
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 4px;
    text-align: center;
}

.funeral-ai-chat-footer-link:hover {
    opacity: 1;
    color: var(--accent-color, #2c3e50);
    text-decoration: none;
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.funeral-ai-chat-footer-link svg {
    width: 12px;
    height: 12px;
    opacity: 0.8;
    transition: all 0.2s ease;
    flex-shrink: 0;
    fill: currentColor;
}

/* Centered two-line footer message without icons */
.funeral-ai-chat-footer-text {
    display: block;
    width: 100%;
    text-align: center;
    line-height: 1.4;
    font-weight: 600;
    color: var(--chat-footer-text, #444);
}

.funeral-ai-chat-footer-text br {
    display: block;
    content: "";
}

.funeral-ai-chat-footer-link:hover svg {
    opacity: 1;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .funeral-ai-chat-footer {
        padding: 6px 12px;
        gap: 12px;
        font-size: 10px;
    }

    .funeral-ai-chat-footer-link {
        gap: 3px;
    }

    .funeral-ai-chat-footer-link svg {
        width: 10px;
        height: 10px;
    }
}

/* Tryb ciemny - jeszcze lepszy kontrast */
@media (prefers-color-scheme: dark) {
    .funeral-ai-chat-footer {
        background-color: rgba(40, 44, 52, 0.95);
        border-top-color: rgba(255, 255, 255, 0.1);
    }

    .funeral-ai-chat-footer-link {
        color: rgba(255, 255, 255, 0.85);
    }

    .funeral-ai-chat-footer-link:hover {
        color: rgba(255, 255, 255, 0.6);
        background-color: rgba(255, 255, 255, 0.06);
    }
}

/* Lepszy kontrast dla wiadomości */
.funeral-ai-chat-message-content {
    min-height: 36px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.5;
}

/* Awatar z dynamicznym kontrastem */
.funeral-ai-chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--user-avatar-bg);
    color: var(--user-avatar-text, #ffffff);
    border: 2px solid var(--user-avatar-border, rgba(52, 152, 219, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.funeral-ai-chat-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.funeral-ai-chat-message-avatar span {
    font-size: 16px;
    line-height: 1;
}

/* Lepszy kontrast dla awatarów asystenta */
.funeral-ai-chat-message.assistant .funeral-ai-chat-message-avatar {
    background: var(--assistant-avatar-bg, #f8f9fa);
    color: var(--assistant-avatar-text, #2c3e50);
    border: 2px solid var(--assistant-avatar-border, rgba(236, 240, 241, 0.5));
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.1);
    text-shadow: none;
}

/* Lepszy kontrast dla awatarów użytkownika */
.funeral-ai-chat-message.user .funeral-ai-chat-message-avatar {
    background: var(--user-avatar-bg, #3498db);
    color: var(--user-avatar-text, #ffffff);
    border: 2px solid var(--user-avatar-border, rgba(52, 152, 219, 0.3));
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Dynamiczne style kontrastowe */
.funeral-ai-chat-message .message-content {
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 75%;
    word-wrap: break-word;
    position: relative;
    line-height: 1.4;
    font-size: 14px;
}

/* Style dla wiadomości użytkownika z lepszym kontrastem */
.funeral-ai-chat-message.user .message-content {
    background-color: var(--user-bg-color, #007cba);
    color: var(--user-text-color, #ffffff);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

/* Style dla wiadomości asystenta z lekko akcentowym tłem */
.funeral-ai-chat-message.assistant .funeral-ai-chat-message-content {
    background-color: var(--assistant-bg-color, #f1f1f1);
    color: var(--assistant-text-color, #333333);
    border-bottom-left-radius: 4px;
}

/* Dodatkowe style dla lepszego kontrastu tekstu */
.funeral-ai-chat-message-name {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 2px;
    opacity: 0.9;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.funeral-ai-chat-message-time {
    font-size: 10px;
    opacity: 0.75;
    margin-top: 4px;
    line-height: 1.2;
    font-weight: 600;
}

/* Zapewnij dobry kontrast dla wszystkich elementów tekstowych */
.funeral-ai-chat-header h3 {
    color: var(--chat-header-text, #ffffff);
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    margin: 0;
    font-size: 16px;
}

.funeral-ai-chat-input {
    color: var(--chat-input-text, #333);
    background-color: var(--chat-input-bg, #ffffff);
    border: 1px solid var(--chat-input-border, rgba(0, 0, 0, 0.1));
    font-weight: 500;
}

.funeral-ai-chat-input::placeholder {
    color: var(--chat-input-placeholder, rgba(0, 0, 0, 0.6));
    font-weight: 400;
}

/* Message avatars using generated colors */
.funeral-ai-chat-message.user .funeral-ai-chat-avatar {
    background: var(--user-bg-color, #3498db);
    color: var(--user-text-color, #ffffff);
    border: 2px solid var(--user-name-color, #2980b9);
}

.funeral-ai-chat-message.assistant .funeral-ai-chat-avatar {
    background: var(--assistant-bg-color, #ecf0f1);
    color: var(--assistant-text-color, #2c3e50);
    border: 2px solid var(--assistant-name-color, #34495e);
}

.funeral-ai-chat-message.user .funeral-ai-chat-message-name {
    color: var(--user-name-color, #2980b9);
}

.funeral-ai-chat-message.assistant .funeral-ai-chat-message-name {
    color: var(--assistant-name-color, #34495e);
}

.funeral-ai-chat-message.user .funeral-ai-chat-message-time {
    color: var(--user-time-color, #7fb3d3);
}

.funeral-ai-chat-message.assistant .funeral-ai-chat-message-time {
    color: var(--assistant-time-color, #95a5a6);
}

/* Dodatkowe poprawki dla lepszej czytelności */
.funeral-ai-chat-message-content {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.funeral-ai-chat-message.user .funeral-ai-chat-message-content {
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.funeral-ai-chat-message.assistant .funeral-ai-chat-message-content {
    box-shadow: 0 1px 3px rgba(44, 62, 80, 0.1);
    border: 1px solid rgba(44, 62, 80, 0.05);
}

/* Tooltip z lepszym kontrastem */
.funeral-ai-chat-tooltip {
    background: var(--tooltip-bg, rgba(44, 62, 80, 0.95));
    color: var(--tooltip-text, #ffffff);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip-content {
    font-weight: 500;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    color: var(--tooltip-text, #ffffff);
}

/* Przyciski z lepszym kontrastem */
.funeral-ai-chat-send {
    background: var(--send-button-color, #3498db);
    color: var(--chat-send-button-text, #ffffff);
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.funeral-ai-chat-send:hover {
    box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
    transform: translateY(-1px);
}

/* Menu z lepszym kontrastem */
.funeral-ai-chat-menu {
    background: var(--menu-bg, rgba(255, 255, 255, 0.98));
    border: 1px solid var(--menu-border, rgba(0, 0, 0, 0.1));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(12px);
}

.funeral-ai-chat-menu-item {
    color: var(--menu-item-text, #2c3e50);
    font-weight: 500;
}

.funeral-ai-chat-menu-item:hover {
    background: var(--menu-item-hover-bg, rgba(52, 152, 219, 0.1));
    color: var(--menu-item-hover-text, #007cba);
}

/* Animacje notification badge z lepszym kontrastem */
.notification-badge {
    background: var(--notification-badge-bg, #e74c3c);
    color: var(--notification-badge-text, #ffffff);
    font-weight: 700;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.4);
}

/* Globalne poprawki kontrastowe */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === SYSTEM SCHEMATÓW KOLORÓW Z CSS ZMIENNYMI === */

/* Schemat: Professional (domyślny) */
.funeral-ai-chat-window[data-color-scheme="professional"],
.funeral-ai-chat-window:not([data-color-scheme]) {
    --user-bg-color: #3498db;
    --user-text-color: #ffffff;
    --user-name-color: #2980b9;
    --user-time-color: #7fb3d3;
    --assistant-bg-color: #f8f9fa;
    /* POPRAWKA: jaśniejsze tło */
    --assistant-text-color: #2c3e50;
    --assistant-name-color: #34495e;
    --assistant-time-color: #95a5a6;
    --header-bg-color: #2c3e50;
    --header-text-color: #ffffff;
    --input-bg-color: #ffffff;
    --send-button-color: #3498db;
    --bubble-color: #3498db;
    --accent-color: #3498db;
    --chat-window-bg: #ffffff;
    --chat-messages-bg: #ffffff;
    /* POPRAWKA: białe tło obszaru */
    --tooltip-bg: #2c3e50;
    --tooltip-text: #ffffff;
}

/* Schemat: Warm */
.funeral-ai-chat-window[data-color-scheme="warm"] {
    --user-bg-color: #e67e22;
    --user-text-color: #ffffff;
    --user-name-color: #d35400;
    --user-time-color: #f39c12;
    --assistant-bg-color: #ffffff;
    /* POPRAWKA: białe tło zamiast kremowego */
    --assistant-text-color: #5d2f0a;
    /* POPRAWKA: ciemniejszy tekst dla lepszego kontrastu */
    --assistant-name-color: #8b4513;
    /* POPRAWKA: ciemniejszy kolor nazwy */
    --assistant-time-color: #a0522d;
    /* POPRAWKA: ciemniejszy kolor czasu */
    --header-bg-color: #d35400;
    --header-text-color: #ffffff;
    --input-bg-color: #ffffff;
    --send-button-color: #e67e22;
    --bubble-color: #e67e22;
    --accent-color: #e67e22;
    --chat-window-bg: #ffffff;
    --chat-messages-bg: #ffffff;
    /* POPRAWKA: białe tło obszaru */
    --tooltip-bg: #d35400;
    --tooltip-text: #ffffff;
}

/* Schemat: Elegant */
.funeral-ai-chat-window[data-color-scheme="elegant"] {
    --user-bg-color: #9b59b6;
    --user-text-color: #ffffff;
    --user-name-color: #8e44ad;
    --user-time-color: #c39bd3;
    --assistant-bg-color: #ffffff;
    /* POPRAWKA: białe tło zamiast fioletowego */
    --assistant-text-color: #663399;
    --assistant-name-color: #7d3c98;
    --assistant-time-color: #bb8fce;
    --header-bg-color: #8e44ad;
    --header-text-color: #ffffff;
    --input-bg-color: #ffffff;
    --send-button-color: #9b59b6;
    --bubble-color: #9b59b6;
    --accent-color: #9b59b6;
    --chat-window-bg: #ffffff;
    --chat-messages-bg: #ffffff;
    --tooltip-bg: #8e44ad;
    --tooltip-text: #ffffff;
}

/* Schemat: Nature */
.funeral-ai-chat-window[data-color-scheme="nature"] {
    --user-bg-color: #27ae60;
    --user-text-color: #ffffff;
    --user-name-color: #229954;
    --user-time-color: #82e0aa;
    --assistant-bg-color: #ffffff;
    /* POPRAWKA: białe tło zamiast zielonego */
    --assistant-text-color: #1e8449;
    --assistant-name-color: #239b56;
    --assistant-time-color: #58d68d;
    --header-bg-color: #1e8449;
    --header-text-color: #ffffff;
    --input-bg-color: #ffffff;
    --send-button-color: #27ae60;
    --bubble-color: #27ae60;
    --accent-color: #27ae60;
    --chat-window-bg: #ffffff;
    --chat-messages-bg: #ffffff;
    /* POPRAWKA: białe tło obszaru */
    --tooltip-bg: #1e8449;
    --tooltip-text: #ffffff;
}

/* Schemat: Minimalist */
.funeral-ai-chat-window[data-color-scheme="minimalist"] {
    --user-bg-color: #2c3e50;
    --user-text-color: #ffffff;
    --user-name-color: #34495e;
    --user-time-color: #7f8c8d;
    --assistant-bg-color: #ffffff;
    /* POPRAWKA: pozostaje białe - już dobre */
    --assistant-text-color: #2c3e50;
    --assistant-name-color: #34495e;
    --assistant-time-color: #7f8c8d;
    --header-bg-color: #34495e;
    --header-text-color: #ffffff;
    --input-bg-color: #ffffff;
    --send-button-color: #2c3e50;
    --bubble-color: #2c3e50;
    --accent-color: #2c3e50;
    --chat-window-bg: #ffffff;
    --chat-messages-bg: #ffffff;
    /* POPRAWKA: pozostaje białe - już dobre */
    --tooltip-bg: #34495e;
    --tooltip-text: #ffffff;
}

/* Schemat: Funeral */
.funeral-ai-chat-window[data-color-scheme="funeral"] {
    --user-bg-color: #1a365d;
    --user-text-color: #ffffff;
    --user-name-color: #2d3748;
    --user-time-color: #4a5568;
    --assistant-bg-color: #ffffff;
    /* POPRAWKA: jaśniejsze niż poprzednie f7fafc */
    --assistant-text-color: #1a202c;
    --assistant-name-color: #2d3748;
    --assistant-time-color: #4a5568;
    --header-bg-color: #1a365d;
    --header-text-color: #ffd700;
    --input-bg-color: #ffffff;
    --send-button-color: #1a365d;
    --bubble-color: #1a365d;
    --accent-color: #1a365d;
    --chat-window-bg: #ffffff;
    --chat-messages-bg: #ffffff;
    /* POPRAWKA: jaśniejsze niż poprzednie f7fafc */
    --tooltip-bg: #1a365d;
    --tooltip-text: #ffd700;
}

/* Schemat: Dostrojny złoty (używając kolorów z theme.json) */
.funeral-ai-chat-window[data-color-scheme="golden"] {
    --user-bg-color: var(--wp--preset--color--gold-accent);
    --user-text-color: var(--wp--preset--color--dark-bg);
    --user-name-color: var(--wp--preset--color--gold-hover);
    --user-time-color: var(--wp--preset--color--gold-active);
    --assistant-bg-color: var(--wp--preset--color--light-bg);
    --assistant-text-color: var(--wp--preset--color--dark-bg);
    --assistant-name-color: var(--wp--preset--color--dark-hover);
    --assistant-time-color: var(--wp--preset--color--dark-light);
    --header-bg-color: var(--wp--preset--color--dark-bg);
    --header-text-color: var(--wp--preset--color--gold-accent);
    --input-bg-color: var(--wp--preset--color--light-bg);
    --send-button-color: var(--wp--preset--color--gold-accent);
    --bubble-color: var(--wp--preset--color--gold-accent);
    --accent-color: var(--wp--preset--color--gold-accent);
    --chat-window-bg: var(--wp--preset--color--light-bg);
    --chat-messages-bg: var(--wp--preset--color--light-bg);
    --tooltip-bg: var(--wp--preset--color--dark-bg);
    --tooltip-text: var(--wp--preset--color--gold-accent);
    --user-avatar-bg: var(--wp--preset--color--gold-accent);
    --user-avatar-text: var(--wp--preset--color--dark-bg);
    --user-avatar-border: var(--wp--preset--color--gold-hover);
    --assistant-avatar-bg: var(--wp--preset--color--light-bg);
    --assistant-avatar-text: var(--wp--preset--color--dark-bg);
    --assistant-avatar-border: var(--wp--preset--color--gold-accent);
}

/* Zastosowanie zmiennych CSS do elementów */
.funeral-ai-chat-header {
    background: var(
        --chat-header-bg,
        var(--header-bg-color, #2c3e50)
    ) !important;
    color: var(
        --chat-header-text,
        var(--header-text-color, #ffffff)
    ) !important;
}

.funeral-ai-chat-header h3 {
    color: var(
        --chat-header-text,
        var(--header-text-color, #ffffff)
    ) !important;
}

.funeral-ai-chat-message.user .funeral-ai-chat-message-content {
    background: var(--user-bg-color, #3498db) !important;
    color: var(--user-text-color, #ffffff) !important;
}

.funeral-ai-chat-message.assistant .funeral-ai-chat-message-content {
    background: var(--assistant-bg-color, #ecf0f1) !important;
    color: var(--assistant-text-color, #2c3e50) !important;
}

.funeral-ai-chat-message.user .funeral-ai-chat-message-name {
    color: var(--user-name-color, #2980b9) !important;
}

.funeral-ai-chat-message.assistant .funeral-ai-chat-message-name {
    color: var(--assistant-name-color, #34495e) !important;
}

.funeral-ai-chat-message.user .funeral-ai-chat-message-time {
    color: var(--user-time-color, #7fb3d3) !important;
}

.funeral-ai-chat-message.assistant .funeral-ai-chat-message-time {
    color: var(--assistant-time-color, #95a5a6) !important;
}

.funeral-ai-chat-input-container {
    background: var(--chat-input-bg, var(--input-bg-color, #ffffff)) !important;
}

.funeral-ai-chat-input {
    background: var(--chat-input-bg, var(--input-bg-color, #ffffff)) !important;
}

.funeral-ai-chat-send {
    background: var(
        --chat-send-button-bg,
        var(--send-button-color, var(--accent-color, #3498db))
    ) !important;
}

.funeral-ai-chat-send:hover {
    background: var(
        --chat-send-button-bg,
        var(--send-button-color, var(--accent-color, #3498db))
    ) !important;
    filter: brightness(1.1);
}

/* Awatary dostosowane do schematów kolorów */
.funeral-ai-chat-message.user .funeral-ai-chat-message-avatar {
    background: var(--user-avatar-bg, var(--user-bg-color, #3498db)) !important;
    color: var(--user-avatar-text, var(--user-text-color, #ffffff)) !important;
    border: 2px solid var(--user-avatar-border, var(--user-name-color, #2980b9)) !important;
}

.funeral-ai-chat-message.assistant .funeral-ai-chat-message-avatar {
    background: var(
        --assistant-avatar-bg,
        var(--assistant-bg-color, #ecf0f1)
    ) !important;
    color: var(
        --assistant-avatar-text,
        var(--assistant-text-color, #2c3e50)
    ) !important;
    border: 2px solid
        var(--assistant-avatar-border, var(--assistant-name-color, #34495e)) !important;
}

/* Chat bubble dostosowany do schematu */
.funeral-ai-chat-bubble {
    background: var(--bubble-bg-color, var(--bubble-color, #3498db)) !important;
}

/* Menu dropdown dostosowane do schematu */
.funeral-ai-chat-menu-trigger,
.funeral-ai-chat-minimize {
    color: var(
        --chat-header-text,
        var(--header-text-color, #ffffff)
    ) !important;
}

.funeral-ai-chat-menu-trigger:hover,
.funeral-ai-chat-minimize:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Specjalne poprawki dla schematu minimalistycznego */
.funeral-ai-chat-window[data-color-scheme="minimalist"]
    .funeral-ai-chat-header {
    background: #34495e !important;
    color: #ffffff !important;
}

.funeral-ai-chat-window[data-color-scheme="minimalist"]
    .funeral-ai-chat-header
    h3 {
    color: #ffffff !important;
}

.funeral-ai-chat-window[data-color-scheme="minimalist"]
    .funeral-ai-chat-menu-trigger,
.funeral-ai-chat-window[data-color-scheme="minimalist"]
    .funeral-ai-chat-minimize {
    color: #ffffff !important;
}

.funeral-ai-chat-window[data-color-scheme="minimalist"]
    .funeral-ai-chat-message.assistant
    .funeral-ai-chat-message-avatar {
    background: #f8f9fa !important;
    color: #2c3e50 !important;
    border: 2px solid #dee2e6 !important;
}

/* Poprawki dla trybu ciemnego - lepszy kontrast */
@media (prefers-color-scheme: dark) {
    .funeral-ai-chat-window[data-color-scheme="minimalist"]
        .funeral-ai-chat-header {
        background: #1a202c !important;
        color: #e2e8f0 !important;
    }

    .funeral-ai-chat-window[data-color-scheme="minimalist"]
        .funeral-ai-chat-message.assistant
        .funeral-ai-chat-message-content {
        background: #2d3748 !important;
        color: #e2e8f0 !important;
    }

    .funeral-ai-chat-window[data-color-scheme="minimalist"]
        .funeral-ai-chat-message.assistant
        .funeral-ai-chat-message-avatar {
        background: #4a5568 !important;
        color: #e2e8f0 !important;
        border-color: #718096 !important;
    }

    /* Footer i tooltip w trybie ciemnym */
    .funeral-ai-chat-footer {
        background-color: var(--chat-footer-bg, rgba(40, 44, 52, 0.95));
        border-top-color: rgba(255, 255, 255, 0.1);
    }

    .funeral-ai-chat-footer-link {
        color: var(--chat-footer-text, rgba(255, 255, 255, 0.85));
    }

    .funeral-ai-chat-tooltip {
        background: var(--tooltip-bg, rgba(26, 32, 44, 0.95));
        color: var(--tooltip-text, #e2e8f0);
    }

    .tooltip-arrow {
        border-left-color: var(--tooltip-bg, rgba(26, 32, 44, 0.95));
    }

    .position-bottom-left .tooltip-arrow,
    .position-top-left .tooltip-arrow,
    .position-center-left .tooltip-arrow {
        border-right-color: var(--tooltip-bg, rgba(26, 32, 44, 0.95));
    }
}

/* === POPRAWKI SPECYFICZNE DLA SCHEMATÓW === */

/* Schemat elegant - lepsze kolory stopki i tooltip */
.funeral-ai-chat-window[data-color-scheme="elegant"] .funeral-ai-chat-footer {
    background-color: #f3e5f5;
    border-top-color: rgba(106, 27, 154, 0.2);
}

.funeral-ai-chat-window[data-color-scheme="elegant"]
    .funeral-ai-chat-footer-link {
    color: #4a235a;
}

.funeral-ai-chat-window[data-color-scheme="elegant"]
    .funeral-ai-chat-footer-link:hover {
    color: #6a1b9a;
    background-color: rgba(106, 27, 154, 0.1);
}

/* Schemat warm - ciepłe kolory */
.funeral-ai-chat-window[data-color-scheme="warm"] .funeral-ai-chat-footer {
    background-color: #fef9e7;
    border-top-color: rgba(211, 84, 0, 0.2);
}

.funeral-ai-chat-window[data-color-scheme="warm"] .funeral-ai-chat-footer-link {
    color: #8b4513;
}

.funeral-ai-chat-window[data-color-scheme="warm"]
    .funeral-ai-chat-footer-link:hover {
    color: #d35400;
}

/* Schemat nature - zielone kolory */
.funeral-ai-chat-window[data-color-scheme="nature"] .funeral-ai-chat-footer {
    background-color: #e8f5e8;
    border-top-color: rgba(30, 132, 73, 0.2);
}

.funeral-ai-chat-window[data-color-scheme="nature"]
    .funeral-ai-chat-footer-link {
    color: #1e8449;
}

/* Schemat funeral - specjalne kolory */
.funeral-ai-chat-window[data-color-scheme="funeral"] .funeral-ai-chat-footer {
    background-color: #f7fafc;
    border-top-color: rgba(26, 54, 93, 0.2);
}

.funeral-ai-chat-window[data-color-scheme="funeral"]
    .funeral-ai-chat-footer-link {
    color: #1a202c;
}

.funeral-ai-chat-window[data-color-scheme="funeral"]
    .funeral-ai-chat-footer-link:hover {
    color: #1a365d;
}

/* Specjalne kolory ikon dla funeral */
.funeral-ai-chat-window[data-color-scheme="funeral"]
    .funeral-ai-chat-menu-trigger,
.funeral-ai-chat-window[data-color-scheme="funeral"] .funeral-ai-chat-minimize {
    color: #ffd700;
}

.funeral-ai-chat-window[data-color-scheme="funeral"]
    .funeral-ai-chat-menu-trigger
    svg,
.funeral-ai-chat-window[data-color-scheme="funeral"]
    .funeral-ai-chat-minimize
    svg {
    fill: #ffd700 !important;
}

/* Tooltip dla funeral */
.funeral-ai-chat-window[data-color-scheme="funeral"] .funeral-ai-chat-tooltip {
    background: #1a365d;
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.funeral-ai-chat-window[data-color-scheme="funeral"] .tooltip-arrow {
    border-left-color: #1a365d;
}

.funeral-ai-chat-window[data-color-scheme="funeral"]
    .position-bottom-left
    .tooltip-arrow,
.funeral-ai-chat-window[data-color-scheme="funeral"]
    .position-top-left
    .tooltip-arrow,
.funeral-ai-chat-window[data-color-scheme="funeral"]
    .position-center-left
    .tooltip-arrow {
    border-right-color: #1a365d;
}

/* Pozycjonowanie dla różnych pozycji bubble - poprawka koloru strzałki */
.position-bottom-left .tooltip-arrow,
.position-top-left .tooltip-arrow,
.position-center-left .tooltip-arrow {
    border-right: 8px solid var(--tooltip-bg, rgba(44, 62, 80, 0.95));
    border-left: 8px solid transparent;
}

/* Pozycjonowanie okna na desktopie dla różnych pozycji bubble */
/*
   Pozycjonowanie okna czatu jest teraz dynamicznie ustawiane przez JavaScript
   w funkcji updateChatWindowPosition() na podstawie pozycji bubble i marginesów użytkownika.
   To zapewnia spójność marginesów między bubble a oknem czatu.
*/
.funeral-ai-chat-widget.position-bottom-right .funeral-ai-chat-window {
    bottom: 100px;
    right: 30px;
    left: auto;
}

.funeral-ai-chat-widget.position-bottom-left .funeral-ai-chat-window {
    bottom: 100px;
    left: 30px;
    right: auto;
}

.funeral-ai-chat-widget.position-top-right .funeral-ai-chat-window {
    top: 100px;
    bottom: auto;
    right: 30px;
    left: auto;
}

.funeral-ai-chat-widget.position-top-left .funeral-ai-chat-window {
    top: 100px;
    bottom: auto;
    left: 30px;
    right: auto;
}

/* Style dla wiadomości asystenta z lekko akcentowym tłem */
.funeral-ai-chat-message.assistant .funeral-ai-chat-message-content {
    background-color: var(--assistant-bg-color, #f1f1f1);
    color: var(--assistant-text-color, #333333);
    border-bottom-left-radius: 4px;
}

/* Lepsze akcentowe tło dla wszystkich schematów z lekkim opacity */
.funeral-ai-chat-window[data-color-scheme="professional"]
    .funeral-ai-chat-message.assistant
    .funeral-ai-chat-message-content,
.funeral-ai-chat-window:not([data-color-scheme])
    .funeral-ai-chat-message.assistant
    .funeral-ai-chat-message-content {
    background-color: rgba(52, 152, 219, 0.08) !important;
    color: #2c3e50 !important;
    border: 1px solid rgba(52, 152, 219, 0.15);
}

.funeral-ai-chat-window[data-color-scheme="warm"]
    .funeral-ai-chat-message.assistant
    .funeral-ai-chat-message-content {
    background-color: rgba(230, 126, 34, 0.08) !important;
    color: #5d2f0a !important;
    border: 1px solid rgba(230, 126, 34, 0.15);
}

.funeral-ai-chat-window[data-color-scheme="elegant"]
    .funeral-ai-chat-message.assistant
    .funeral-ai-chat-message-content {
    background-color: rgba(155, 89, 182, 0.08) !important;
    color: #663399 !important;
    border: 1px solid rgba(155, 89, 182, 0.15);
}

.funeral-ai-chat-window[data-color-scheme="nature"]
    .funeral-ai-chat-message.assistant
    .funeral-ai-chat-message-content {
    background-color: rgba(39, 174, 96, 0.15) !important;
    color: #1e8449 !important;
    border: 1px solid rgba(39, 174, 96, 0.25);
}

.funeral-ai-chat-window[data-color-scheme="minimalist"]
    .funeral-ai-chat-message.assistant
    .funeral-ai-chat-message-content {
    background-color: rgba(44, 62, 80, 0.06) !important;
    color: #2c3e50 !important;
    border: 1px solid rgba(44, 62, 80, 0.12);
}

.funeral-ai-chat-window[data-color-scheme="funeral"]
    .funeral-ai-chat-message.assistant
    .funeral-ai-chat-message-content {
    background-color: rgba(26, 54, 93, 0.08) !important;
    color: #1a202c !important;
    border: 1px solid rgba(26, 54, 93, 0.15);
}

/* === MENU DOSTOSOWANE DO SCHEMATÓW KOLORÓW === */

/* Menu - schemat professional (domyślny) */
.funeral-ai-chat-window[data-color-scheme="professional"] .funeral-ai-chat-menu,
.funeral-ai-chat-window:not([data-color-scheme]) .funeral-ai-chat-menu {
    background: rgba(248, 249, 250, 0.98);
    border: 1px solid rgba(52, 152, 219, 0.2);
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.15);
}

.funeral-ai-chat-window[data-color-scheme="professional"]
    .funeral-ai-chat-menu-item,
.funeral-ai-chat-window:not([data-color-scheme]) .funeral-ai-chat-menu-item {
    color: #2c3e50;
}

.funeral-ai-chat-window[data-color-scheme="professional"]
    .funeral-ai-chat-menu-item:hover,
.funeral-ai-chat-window:not([data-color-scheme])
    .funeral-ai-chat-menu-item:hover {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

/* Menu - schemat warm */
.funeral-ai-chat-window[data-color-scheme="warm"] .funeral-ai-chat-menu {
    background: rgba(254, 249, 231, 0.98);
    border: 1px solid rgba(230, 126, 34, 0.2);
    box-shadow: 0 4px 20px rgba(230, 126, 34, 0.15);
}

.funeral-ai-chat-window[data-color-scheme="warm"] .funeral-ai-chat-menu-item {
    color: #8b4513;
}

.funeral-ai-chat-window[data-color-scheme="warm"]
    .funeral-ai-chat-menu-item:hover {
    background: rgba(230, 126, 34, 0.1);
    color: #e67e22;
}

/* Menu - schemat elegant */
.funeral-ai-chat-window[data-color-scheme="elegant"] .funeral-ai-chat-menu {
    background: rgba(243, 229, 245, 0.98);
    border: 1px solid rgba(155, 89, 182, 0.2);
    box-shadow: 0 4px 20px rgba(155, 89, 182, 0.15);
}

.funeral-ai-chat-window[data-color-scheme="elegant"]
    .funeral-ai-chat-menu-item {
    color: #663399;
}

.funeral-ai-chat-window[data-color-scheme="elegant"]
    .funeral-ai-chat-menu-item:hover {
    background: rgba(155, 89, 182, 0.1);
    color: #9b59b6;
}

/* Menu - schemat nature */
.funeral-ai-chat-window[data-color-scheme="nature"] .funeral-ai-chat-menu {
    background: rgba(232, 245, 232, 0.98);
    border: 1px solid rgba(39, 174, 96, 0.2);
    box-shadow: 0 4px 20px rgba(39, 174, 96, 0.15);
}

.funeral-ai-chat-window[data-color-scheme="nature"] .funeral-ai-chat-menu-item {
    color: #1e8449;
}

.funeral-ai-chat-window[data-color-scheme="nature"]
    .funeral-ai-chat-menu-item:hover {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

/* Menu - schemat minimalist */
.funeral-ai-chat-window[data-color-scheme="minimalist"] .funeral-ai-chat-menu {
    background: rgba(248, 249, 250, 0.98);
    border: 1px solid rgba(44, 62, 80, 0.2);
    box-shadow: 0 4px 20px rgba(44, 62, 80, 0.12);
}

.funeral-ai-chat-window[data-color-scheme="minimalist"]
    .funeral-ai-chat-menu-item {
    color: #2c3e50;
}

.funeral-ai-chat-window[data-color-scheme="minimalist"]
    .funeral-ai-chat-menu-item:hover {
    background: rgba(44, 62, 80, 0.1);
    color: #34495e;
}

/* Menu - schemat funeral */
.funeral-ai-chat-window[data-color-scheme="funeral"] .funeral-ai-chat-menu {
    background: rgba(247, 250, 252, 0.98);
    border: 1px solid rgba(26, 54, 93, 0.2);
    box-shadow: 0 4px 20px rgba(26, 54, 93, 0.15);
}

.funeral-ai-chat-window[data-color-scheme="funeral"]
    .funeral-ai-chat-menu-item {
    color: #1a202c;
}

.funeral-ai-chat-window[data-color-scheme="funeral"]
    .funeral-ai-chat-menu-item:hover {
    background: rgba(26, 54, 93, 0.1);
    color: #1a365d;
}

/* Ikony SVG w menu dostosowane do schematów */
.funeral-ai-chat-window[data-color-scheme="professional"]
    .funeral-ai-chat-menu-item
    svg,
.funeral-ai-chat-window:not([data-color-scheme])
    .funeral-ai-chat-menu-item
    svg {
    fill: #2c3e50 !important;
}

.funeral-ai-chat-window[data-color-scheme="professional"]
    .funeral-ai-chat-menu-item:hover
    svg,
.funeral-ai-chat-window:not([data-color-scheme])
    .funeral-ai-chat-menu-item:hover
    svg {
    fill: #3498db !important;
}

.funeral-ai-chat-window[data-color-scheme="warm"]
    .funeral-ai-chat-menu-item
    svg {
    fill: #8b4513 !important;
}

.funeral-ai-chat-window[data-color-scheme="warm"]
    .funeral-ai-chat-menu-item:hover
    svg {
    fill: #e67e22 !important;
}

.funeral-ai-chat-window[data-color-scheme="elegant"]
    .funeral-ai-chat-menu-item
    svg {
    fill: #663399 !important;
}

.funeral-ai-chat-window[data-color-scheme="elegant"]
    .funeral-ai-chat-menu-item:hover
    svg {
    fill: #9b59b6 !important;
}

.funeral-ai-chat-window[data-color-scheme="nature"]
    .funeral-ai-chat-menu-item
    svg {
    fill: #1e8449 !important;
}

.funeral-ai-chat-window[data-color-scheme="nature"]
    .funeral-ai-chat-menu-item:hover
    svg {
    fill: #27ae60 !important;
}

.funeral-ai-chat-window[data-color-scheme="minimalist"]
    .funeral-ai-chat-menu-item
    svg {
    fill: #2c3e50 !important;
}

.funeral-ai-chat-window[data-color-scheme="minimalist"]
    .funeral-ai-chat-menu-item:hover
    svg {
    fill: #34495e !important;
}

.funeral-ai-chat-window[data-color-scheme="funeral"]
    .funeral-ai-chat-menu-item
    svg {
    fill: #1a202c !important;
}

.funeral-ai-chat-window[data-color-scheme="funeral"]
    .funeral-ai-chat-menu-item:hover
    svg {
    fill: #1a365d !important;
}

/* === DARK MODE SUPPORT === */
/* Dark mode variables - automatically applied when dark mode is enabled */
:root[data-dark-mode="true"],
.funeral-ai-chat-window[data-dark-mode="true"] {
    --chat-window-bg: var(--chat-messages-bg, #1f2937);
    --chat-input-text: var(--assistant-text-color, #f9fafb);
    --chat-input-placeholder: rgba(249, 250, 251, 0.6);
    --chat-input-border: rgba(255, 255, 255, 0.1);
    --dark-mode-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Dark mode automatic adjustments for all schemes */
.funeral-ai-chat-window[data-dark-mode="true"] {
    background: var(--chat-window-bg) !important;
    box-shadow: var(--dark-mode-shadow) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.funeral-ai-chat-window[data-dark-mode="true"] .funeral-ai-chat-messages {
    background: var(--chat-messages-bg) !important;
}

.funeral-ai-chat-window[data-dark-mode="true"]
    .funeral-ai-chat-input-container {
    background: var(--chat-input-bg) !important;
    border-top-color: rgba(255, 255, 255, 0.1) !important;
}

.funeral-ai-chat-window[data-dark-mode="true"] .funeral-ai-chat-input {
    background: var(--chat-input-bg) !important;
    color: var(--chat-input-text) !important;
    border-color: var(--chat-input-border) !important;
}

.funeral-ai-chat-window[data-dark-mode="true"]
    .funeral-ai-chat-input::placeholder {
    color: var(--chat-input-placeholder) !important;
}

/* === EXISTING STYLES === */

.funeral-ai-chat-window[data-dark-mode="true"]
    .funeral-ai-chat-input::placeholder {
    color: rgba(249, 250, 251, 0.6) !important;
}

@media (max-width: 768px) {
    .funeral-ai-chat-window {
        position: fixed;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 1000000;
    }
}

/* === Predefiniowane pytania === */
.funeral-ai-chat-quick-questions {
    padding: 16px;
    background: var(--faq-bg-color, #f8f9fa);
    border-radius: 12px;
    margin: 8px 0;
    border: 1px solid var(--faq-border-color, #dee2e6);
    animation: fadeInUp 0.3s ease-out;
}

.quick-questions-header h4 {
    margin: 0 0 4px 0;
    color: var(--faq-header-color, #2c3e50);
    font-size: 14px;
    font-weight: 600;
}

.quick-questions-header p {
    margin: 0 0 12px 0;
    color: var(--faq-description-color, #6c757d);
    font-size: 12px;
    line-height: 1.4;
}

.quick-questions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-question-button {
    background: var(--faq-button-bg-color, #ffffff);
    border: 1px solid var(--faq-button-border-color, #e9ecef);
    border-radius: 8px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: var(--faq-button-text-color, #495057);
    line-height: 1.4;
    position: relative;
    overflow: hidden;
}

.quick-question-button:hover {
    background: var(--faq-button-hover-bg-color, #007cba);
    color: var(--faq-button-hover-text-color, #ffffff);
    border-color: var(--faq-button-hover-bg-color, #007cba);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.quick-question-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 124, 186, 0.4);
}

.quick-question-button::before {
    content: "💬";
    margin-right: 6px;
    opacity: 0.7;
}

.quick-question-button:hover::before {
    opacity: 1;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsywność dla predefiniowanych pytań */
@media (max-width: 768px) {
    .funeral-ai-chat-quick-questions {
        padding: 12px;
        margin: 6px 0;
    }

    .quick-questions-header h4 {
        font-size: 13px;
    }

    .quick-questions-header p {
        font-size: 11px;
    }

    .quick-question-button {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* === KOLORY FAQ DLA POSZCZEGÓLNYCH SCHEMATÓW === */

/* Professional scheme FAQ */
.funeral-ai-chat-window[data-color-scheme="professional"] {
    --faq-bg-color: #f8f9fa;
    --faq-border-color: #dee2e6;
    --faq-header-color: #2c3e50;
    --faq-description-color: #6c757d;
    --faq-button-bg-color: #ffffff;
    --faq-button-border-color: #e9ecef;
    --faq-button-text-color: #495057;
    --faq-button-hover-bg-color: #3498db;
    --faq-button-hover-text-color: #ffffff;
}

/* Warm scheme FAQ */
.funeral-ai-chat-window[data-color-scheme="warm"] {
    --faq-bg-color: #fef9e7;
    --faq-border-color: #f39c12;
    --faq-header-color: #8b4513;
    --faq-description-color: #a0522d;
    --faq-button-bg-color: #ffffff;
    --faq-button-border-color: #f39c12;
    --faq-button-text-color: #8b4513;
    --faq-button-hover-bg-color: #e67e22;
    --faq-button-hover-text-color: #ffffff;
}

/* Elegant scheme FAQ */
.funeral-ai-chat-window[data-color-scheme="elegant"] {
    --faq-bg-color: #f3e5f5;
    --faq-border-color: #b39ddb;
    --faq-header-color: #4a235a;
    --faq-description-color: #663399;
    --faq-button-bg-color: #ffffff;
    --faq-button-border-color: #b39ddb;
    --faq-button-text-color: #4a235a;
    --faq-button-hover-bg-color: #8e44ad;
    --faq-button-hover-text-color: #ffffff;
}

/* Nature scheme FAQ */
.funeral-ai-chat-window[data-color-scheme="nature"] {
    --faq-bg-color: #e8f5e8;
    --faq-border-color: #82e0aa;
    --faq-header-color: #1e8449;
    --faq-description-color: #239b56;
    --faq-button-bg-color: #ffffff;
    --faq-button-border-color: #82e0aa;
    --faq-button-text-color: #1e8449;
    --faq-button-hover-bg-color: #27ae60;
    --faq-button-hover-text-color: #ffffff;
}

/* Minimalist scheme FAQ */
.funeral-ai-chat-window[data-color-scheme="minimalist"] {
    --faq-bg-color: #ecf0f1;
    --faq-border-color: #bdc3c7;
    --faq-header-color: #2c3e50;
    --faq-description-color: #7f8c8d;
    --faq-button-bg-color: #ffffff;
    --faq-button-border-color: #bdc3c7;
    --faq-button-text-color: #2c3e50;
    --faq-button-hover-bg-color: #34495e;
    --faq-button-hover-text-color: #ffffff;
}

/* Funeral scheme FAQ */
.funeral-ai-chat-window[data-color-scheme="funeral"] {
    --faq-bg-color: #f7fafc;
    --faq-border-color: #4a5568;
    --faq-header-color: #1a202c;
    --faq-description-color: #2d3748;
    --faq-button-bg-color: #ffffff;
    --faq-button-border-color: #4a5568;
    --faq-button-text-color: #1a202c;
    --faq-button-hover-bg-color: #1a365d;
    --faq-button-hover-text-color: #ffd700;
}

/* Golden scheme FAQ - używając kolorów z theme.json */
.funeral-ai-chat-window[data-color-scheme="golden"] {
    --faq-bg-color: var(--wp--preset--color--light-bg);
    --faq-border-color: var(--wp--preset--color--gold-accent);
    --faq-header-color: var(--wp--preset--color--dark-bg);
    --faq-description-color: var(--wp--preset--color--dark-hover);
    --faq-button-bg-color: var(--wp--preset--color--light-bg);
    --faq-button-border-color: var(--wp--preset--color--gold-accent);
    --faq-button-text-color: var(--wp--preset--color--dark-bg);
    --faq-button-hover-bg-color: var(--wp--preset--color--gold-accent);
    --faq-button-hover-text-color: var(--wp--preset--color--dark-bg);
}

/* Custom scheme FAQ - wykorzystuje ustawienia z panelu administracyjnego */
.funeral-ai-chat-window[data-color-scheme="custom"] {
    --faq-bg-color: var(--custom-faq-bg-color, #f8f9fa);
    --faq-border-color: var(--custom-faq-border-color, #dee2e6);
    --faq-header-color: var(--custom-faq-header-color, #2c3e50);
    --faq-description-color: var(--custom-faq-description-color, #6c757d);
    --faq-button-bg-color: var(--custom-faq-button-bg-color, #ffffff);
    --faq-button-border-color: var(--custom-faq-button-border-color, #e9ecef);
    --faq-button-text-color: var(--custom-faq-button-text-color, #495057);
    --faq-button-hover-bg-color: var(
        --custom-faq-button-hover-bg-color,
        #007cba
    );
    --faq-button-hover-text-color: var(
        --custom-faq-button-hover-text-color,
        #ffffff
    );
}

/* ============================================================================ */
/* === ZAAWANSOWANE STYLE MARKDOWN - LEAGUE COMMONMARK & PARSEDOWN SUPPORT === */
/* ============================================================================ */

/* === TABELE === */
.funeral-ai-chat-message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: var(--message-bg-color, #ffffff);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 14px;
}

.funeral-ai-chat-message-content th,
.funeral-ai-chat-message-content td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #e9ecef);
    line-height: 1.5;
}

.funeral-ai-chat-message-content th {
    background: var(--table-header-bg, #f8f9fa);
    font-weight: 600;
    color: var(--table-header-color, #2c3e50);
    border-bottom: 2px solid var(--accent-color, #3498db);
}

.funeral-ai-chat-message-content tbody tr:hover {
    background: var(--table-hover-bg, #f8f9fa);
}

.funeral-ai-chat-message-content tbody tr:last-child td {
    border-bottom: none;
}

/* === TASK LISTS (CHECKBOXES) === */
.funeral-ai-chat-message-content li.task-list-item {
    list-style: none;
    margin: 8px 0;
    padding-left: 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.funeral-ai-chat-message-content li.task-list-item input[type="checkbox"] {
    margin: 4px 0 0 0;
    cursor: not-allowed;
    accent-color: var(--accent-color, #3498db);
    transform: scale(1.1);
}

.funeral-ai-chat-message-content
    li.task-list-item
    input[type="checkbox"]:checked
    + * {
    text-decoration: line-through;
    opacity: 0.7;
    color: var(--text-muted, #6c757d);
}

/* === HIGHLIGHTS & MARKS === */
.funeral-ai-chat-message-content mark {
    background: linear-gradient(
        120deg,
        transparent 0%,
        #fff3cd 0%,
        #fff3cd 100%,
        transparent 100%
    );
    background-size: 100% 0.5em;
    background-repeat: no-repeat;
    background-position: 0 85%;
    padding: 2px 4px;
    border-radius: 3px;
    color: var(--text-color, #212529);
    font-weight: 500;
}

/* === KEYBOARD KEYS === */
.funeral-ai-chat-message-content kbd {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow:
        0 2px 0 rgba(0, 0, 0, 0.2),
        inset 0 0 0 1px #ffffff;
    color: var(--text-color, #212529);
    display: inline-block;
    font-family:
        "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1;
    padding: 4px 6px;
    white-space: nowrap;
    margin: 0 2px;
    position: relative;
    top: -1px;
}

/* === FOOTNOTES === */
.funeral-ai-chat-message-content sup.footnote {
    font-size: 0.75em;
    line-height: 0;
    position: relative;
    top: -0.5em;
    margin: 0 2px;
}

.funeral-ai-chat-message-content sup.footnote a {
    background: var(--accent-color, #3498db);
    color: white;
    text-decoration: none;
    padding: 2px 5px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 11px;
    min-width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.funeral-ai-chat-message-content sup.footnote a:hover {
    background: var(--accent-color-dark, #2980b9);
    transform: scale(1.1);
}

/* === SUBSCRIPT & SUPERSCRIPT === */
.funeral-ai-chat-message-content sub,
.funeral-ai-chat-message-content sup {
    font-size: 0.75em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

.funeral-ai-chat-message-content sub {
    bottom: -0.25em;
}

.funeral-ai-chat-message-content sup:not(.footnote) {
    top: -0.5em;
}

/* === DEFINITION LISTS === */
.funeral-ai-chat-message-content dl {
    margin: 16px 0;
    padding: 16px;
    background: var(--definition-bg, #f8f9fa);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color, #3498db);
}

.funeral-ai-chat-message-content dt {
    font-weight: 600;
    color: var(--text-color, #212529);
    margin-bottom: 4px;
    font-size: 1.1em;
}

.funeral-ai-chat-message-content dd {
    margin: 0 0 12px 16px;
    color: var(--text-muted, #6c757d);
    line-height: 1.6;
}

.funeral-ai-chat-message-content dd:last-child {
    margin-bottom: 0;
}

/* === ENHANCED CODE BLOCKS Z SYNTAX HIGHLIGHTING === */
.funeral-ai-chat-message-content pre {
    background: var(--code-bg, #2d3748);
    color: var(--code-color, #e2e8f0);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
    position: relative;
    font-family:
        "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.funeral-ai-chat-message-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    white-space: pre;
}

/* Syntax highlighting dla różnych języków */
.funeral-ai-chat-message-content pre code.language-javascript,
.funeral-ai-chat-message-content pre code.language-js {
    color: #f7df1e;
}

.funeral-ai-chat-message-content pre code.language-python {
    color: #3776ab;
}

.funeral-ai-chat-message-content pre code.language-php {
    color: #777bb4;
}

.funeral-ai-chat-message-content pre code.language-css {
    color: #1572b6;
}

.funeral-ai-chat-message-content pre code.language-html {
    color: #e34f26;
}

/* === ULEPSZONE CYTATY === */
.funeral-ai-chat-message-content blockquote {
    margin: 16px 0;
    padding: 16px 20px;
    background: transparent;
    border-left: none;
    border-radius: 0;
    position: relative;
    font-style: normal;
    color: inherit;
    box-shadow: none;
}

.funeral-ai-chat-message-content blockquote::before {
    content: none;
    font-size: 3em;
    color: var(--accent-color, #3498db);
    position: absolute;
    top: -10px;
    left: 10px;
    font-family: Georgia, serif;
    opacity: 0.3;
}

.funeral-ai-chat-message-content blockquote p {
    margin: 0;
    position: relative;
    z-index: 1;
}

/* === ENHANCED HORIZONTAL RULES === */
.funeral-ai-chat-message-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--accent-color, #3498db),
        transparent
    );
    margin: 24px 0;
    position: relative;
}

.funeral-ai-chat-message-content hr::after {
    content: "✦";
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--message-bg-color, #ffffff);
    color: var(--accent-color, #3498db);
    padding: 0 8px;
    font-size: 16px;
}

/* === RESPONSIVE TABLES === */
@media (max-width: 768px) {
    .funeral-ai-chat-message-content table {
        font-size: 12px;
    }

    .funeral-ai-chat-message-content th,
    .funeral-ai-chat-message-content td {
        padding: 8px 12px;
    }

    /* Poziome przewijanie dla szerszych tabel */
    .funeral-ai-chat-message-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }

    .funeral-ai-chat-message-content thead,
    .funeral-ai-chat-message-content tbody,
    .funeral-ai-chat-message-content th,
    .funeral-ai-chat-message-content td,
    .funeral-ai-chat-message-content tr {
        display: block;
    }

    .funeral-ai-chat-message-content thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .funeral-ai-chat-message-content tr {
        border: 1px solid var(--border-color, #e9ecef);
        border-radius: 8px;
        margin-bottom: 8px;
        padding: 8px;
        background: var(--message-bg-color, #ffffff);
    }

    .funeral-ai-chat-message-content td {
        border: none;
        border-bottom: 1px solid var(--border-color, #e9ecef);
        position: relative;
        padding-left: 35%;
    }

    .funeral-ai-chat-message-content td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 30%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: var(--text-color, #212529);
    }
}

/* === DARK MODE ADJUSTMENTS === */
@media (prefers-color-scheme: dark) {
    .funeral-ai-chat-message-content {
        --table-header-bg: #2d3748;
        --table-header-color: #e2e8f0;
        --table-hover-bg: #2d3748;
        --code-bg: #1a202c;
        --code-color: #e2e8f0;
        --quote-bg: #2d3748;
        --quote-color: #e2e8f0;
        --definition-bg: #2d3748;
        --border-color: #4a5568;
    }

    .funeral-ai-chat-message-content kbd {
        background: linear-gradient(145deg, #4a5568, #2d3748);
        border-color: #2d3748;
        color: #e2e8f0;
        box-shadow:
            0 2px 0 rgba(255, 255, 255, 0.1),
            inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    }

    .funeral-ai-chat-message-content mark {
        background: rgba(255, 193, 7, 0.3);
        color: #ffc107;
    }
}

/* ===== MARKDOWN FORMATTING W ODPOWIEDZIACH ===== */

/* Nagłówki w odpowiedziach */
.funeral-ai-message-content h1,
.funeral-ai-message-content h2,
.funeral-ai-message-content h3,
.funeral-ai-message-content h4,
.funeral-ai-message-content h5,
.funeral-ai-message-content h6 {
    margin: 15px 0 10px 0;
    font-weight: 600;
    line-height: 1.3;
    color: #333;
}

.funeral-ai-message-content h1 {
    font-size: 1.4em;
}

.funeral-ai-message-content h2 {
    font-size: 1.3em;
}

.funeral-ai-message-content h3 {
    font-size: 1.2em;
}

.funeral-ai-message-content h4 {
    font-size: 1.1em;
}

/* Listy w odpowiedziach */
.funeral-ai-message-content ul,
.funeral-ai-message-content ol {
    margin: 12px 0;
    padding-left: 25px;
}

.funeral-ai-message-content li {
    margin: 5px 0;
    line-height: 1.5;
}

.funeral-ai-message-content ul li {
    list-style-type: disc;
}

.funeral-ai-message-content ol li {
    list-style-type: decimal;
}

/* Linki w odpowiedziach */
.funeral-ai-message-content a {
    color: var(--assistant-text-color, #6c757d);
    text-decoration: underline;
    font-weight: 500;
    transition: all 0.2s ease;
}

.funeral-ai-message-content a:hover {
    color: var(--accent-color, #495057);
    text-decoration: underline;
}

.funeral-ai-message-content a:visited {
    color: var(--assistant-text-color, #6c757d);
}

/* Telefony jako linki */
.funeral-ai-message-content .funeral-ai-phone-link {
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.95em;
    border: 1px solid #e1e5e9;
    color: #0073aa;
    display: inline-block;
    margin: 2px;
}

.funeral-ai-message-content .funeral-ai-phone-link:hover {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* Pogrubienie i kursywa */
.funeral-ai-message-content strong {
    font-weight: 600;
    color: #2c3e50;
}

.funeral-ai-message-content em {
    font-style: italic;
    color: #555;
}

/* Kod inline */
.funeral-ai-message-content code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: "Monaco", "Consolas", "Courier New", monospace;
    font-size: 0.9em;
    color: #d63384;
    border: 1px solid #e1e5e9;
}

/* Bloki kodu */
.funeral-ai-message-content .funeral-ai-code-block {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 5px;
    padding: 15px;
    margin: 15px 0;
    font-family: "Monaco", "Consolas", "Courier New", monospace;
    font-size: 0.9em;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* Cytaty */
.funeral-ai-message-content .funeral-ai-quote,
.funeral-ai-message-content blockquote {
    border-left: none;
    margin: 15px 0;
    padding: 10px 15px;
    background: transparent;
    font-style: normal;
    color: inherit;
    border-radius: 0;
}

/* Tabele */
.funeral-ai-message-content .funeral-ai-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.funeral-ai-message-content .funeral-ai-table th,
.funeral-ai-message-content .funeral-ai-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.funeral-ai-message-content .funeral-ai-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.funeral-ai-message-content .funeral-ai-table tr:last-child td {
    border-bottom: none;
}

/* Paragrafy w odpowiedziach */
.funeral-ai-message-content p {
    margin: 10px 0;
    line-height: 1.6;
}

.funeral-ai-message-content p:first-child {
    margin-top: 0;
}

.funeral-ai-message-content p:last-child {
    margin-bottom: 0;
}

/* Specjalne style dla różnych typów odpowiedzi */
.funeral-ai-message[data-type="quick_response"] .funeral-ai-message-content {
    border-left: none !important;
}

.funeral-ai-message[data-type="ai_response"] .funeral-ai-message-content {
    border-left: 3px solid #0073aa;
}

/* Wskaźnik typu odpowiedzi */
.funeral-ai-message[data-type="quick_response"]::before {
    content: none !important;
    color: inherit !important;
}

/* Responsive design dla markdown */
@media (max-width: 768px) {
    .funeral-ai-message-content .funeral-ai-table {
        font-size: 0.9em;
    }

    .funeral-ai-message-content .funeral-ai-table th,
    .funeral-ai-message-content .funeral-ai-table td {
        padding: 8px;
    }

    .funeral-ai-message-content h1,
    .funeral-ai-message-content h2,
    .funeral-ai-message-content h3 {
        font-size: 1.1em;
    }
}

/* Lepsze wyświetlanie długich linków */
.funeral-ai-message-content a {
    word-break: break-all;
    word-wrap: break-word;
}

/* Style dla lepszej czytelności długich odpowiedzi */
.funeral-ai-message-content {
    max-height: 400px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.funeral-ai-message-content::-webkit-scrollbar {
    width: 6px;
}

.funeral-ai-message-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.funeral-ai-message-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.funeral-ai-message-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ========================================
   KOMPLETNE STYLE MARKDOWN - LEAGUE COMMONMARK
   ======================================== */

/* GŁÓWNY KONTENER dla wiadomości z markdown */
.funeral-ai-chat-message-content {
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* NAGŁÓWKI H1-H6 */
.funeral-ai-chat-message-content h1,
.funeral-ai-chat-message-content h2,
.funeral-ai-chat-message-content h3,
.funeral-ai-chat-message-content h4,
.funeral-ai-chat-message-content h5,
.funeral-ai-chat-message-content h6 {
    margin: 16px 0 12px 0;
    font-weight: 600;
    line-height: 1.25;
    color: #1a1a1a;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 8px;
}

.funeral-ai-chat-message-content h1 {
    font-size: 1.6em;
}

.funeral-ai-chat-message-content h2 {
    font-size: 1.5em;
}

.funeral-ai-chat-message-content h3 {
    font-size: 1.3em;
}

.funeral-ai-chat-message-content h4 {
    font-size: 1.2em;
}

.funeral-ai-chat-message-content h5 {
    font-size: 1.1em;
}

.funeral-ai-chat-message-content h6 {
    font-size: 1em;
    color: #6a737d;
}

/* PARAGRAFY */
.funeral-ai-chat-message-content p {
    margin: 12px 0;
    line-height: 1.6;
}

.funeral-ai-chat-message-content p:first-child {
    margin-top: 0;
}

.funeral-ai-chat-message-content p:last-child {
    margin-bottom: 0;
}

/* POGRUBIENIE I KURSYWA */
.funeral-ai-chat-message-content strong {
    font-weight: 600;
    color: #24292e;
}

.funeral-ai-chat-message-content em {
    font-style: italic;
    color: #586069;
}

/* KOD INLINE */
.funeral-ai-chat-message-content code {
    background: rgba(175, 184, 193, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-family:
        "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
    font-size: 0.85em;
    color: #e36209;
    border: 1px solid rgba(175, 184, 193, 0.15);
}

/* BLOKI KODU Z KLASĄ CSS */
.funeral-ai-chat-message-content .funeral-ai-code-block {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 16px;
    margin: 16px 0;
    font-family:
        "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
    font-size: 0.85em;
    line-height: 1.45;
    overflow-x: auto;
    white-space: pre;
    color: #24292e;
}

.funeral-ai-chat-message-content .funeral-ai-code-block code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

/* LISTY NIEUPORZĄDKOWANE I UPORZĄDKOWANE */
.funeral-ai-chat-message-content ul,
.funeral-ai-chat-message-content ol {
    margin: 12px 0;
    padding-left: 1.4em;
    list-style-position: outside;
}

.funeral-ai-chat-message-content ul {
    list-style-type: disc;
}

.funeral-ai-chat-message-content ol {
    list-style-type: decimal;
}

.funeral-ai-chat-message-content li {
    margin: 6px 0;
    line-height: 1.6;
    padding-left: 0;
    display: list-item;
}

.funeral-ai-chat-message-content li > p {
    margin: 8px 0;
}

/* ZAGNIEŻDŻONE LISTY */
.funeral-ai-chat-message-content ul ul,
.funeral-ai-chat-message-content ol ol,
.funeral-ai-chat-message-content ul ol,
.funeral-ai-chat-message-content ol ul {
    margin: 6px 0;
}

.funeral-ai-chat-message-content ul ul {
    list-style-type: circle;
}

.funeral-ai-chat-message-content ul ul ul {
    list-style-type: square;
}

/* TASK LISTS (GitHub Flavored Markdown) */
.funeral-ai-chat-message-content .task-list-item {
    list-style-type: none;
    margin-left: -24px;
    padding-left: 24px;
}

.funeral-ai-chat-message-content .task-list-item input[type="checkbox"] {
    margin: 0 8px 0 0;
    vertical-align: middle;
}

/* CYTATY Z KLASĄ CSS */
.funeral-ai-chat-message-content .funeral-ai-quote {
    border-left: none;
    margin: 16px 0;
    padding: 0 16px;
    color: inherit;
    background: transparent;
    border-radius: 0;
}

.funeral-ai-chat-message-content .funeral-ai-quote > :first-child {
    margin-top: 0;
}

.funeral-ai-chat-message-content .funeral-ai-quote > :last-child {
    margin-bottom: 0;
}

/* CYTATY BEZ KLASY (fallback) */
.funeral-ai-chat-message-content blockquote {
    border-left: none;
    margin: 16px 0;
    padding: 0 16px;
    color: inherit;
    background: transparent;
    border-radius: 0;
}

/* TABELE Z KLASĄ CSS */
.funeral-ai-chat-message-content .funeral-ai-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.9em;
}

.funeral-ai-chat-message-content .funeral-ai-table th {
    background: #f6f8fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #24292e;
    border-bottom: 1px solid #e1e4e8;
}

.funeral-ai-chat-message-content .funeral-ai-table td {
    padding: 12px;
    border-bottom: 1px solid #e1e4e8;
    vertical-align: top;
}

.funeral-ai-chat-message-content .funeral-ai-table tr:last-child td {
    border-bottom: none;
}

.funeral-ai-chat-message-content .funeral-ai-table tr:hover {
    background: #f6f8fa;
}

/* TABELE BEZ KLASY (fallback) */
.funeral-ai-chat-message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.9em;
}

.funeral-ai-chat-message-content table th {
    background: #f6f8fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #24292e;
    border-bottom: 1px solid #e1e4e8;
}

.funeral-ai-chat-message-content table td {
    padding: 12px;
    border-bottom: 1px solid #e1e4e8;
    vertical-align: top;
}

.funeral-ai-chat-message-content table tr:last-child td {
    border-bottom: none;
}

/* LINKI */
.funeral-ai-chat-message-content a {
    color: #0366d6;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.funeral-ai-chat-message-content a:hover {
    color: #0256cc;
    border-bottom-color: #0366d6;
    text-decoration: underline;
}

.funeral-ai-chat-message-content a:visited {
    color: #6f42c1;
}

/* PRZEKREŚLENIA (GitHub Flavored Markdown) */
.funeral-ai-chat-message-content del,
.funeral-ai-chat-message-content s {
    color: #6a737d;
    text-decoration: line-through;
}

/* LINIE POZIOME */
.funeral-ai-chat-message-content hr {
    height: 2px;
    background: #e1e4e8;
    border: none;
    margin: 24px 0;
    border-radius: 1px;
}

/* PODZIAŁY LINII */
.funeral-ai-chat-message-content br {
    line-height: 1.6;
}

/* OBRAZY (jeśli byłyby używane) */
.funeral-ai-chat-message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid #e1e4e8;
    margin: 8px 0;
}

/* DEFINICJE (definition lists) */
.funeral-ai-chat-message-content dl {
    margin: 16px 0;
}

.funeral-ai-chat-message-content dt {
    font-weight: 600;
    margin-top: 16px;
    color: #24292e;
}

.funeral-ai-chat-message-content dd {
    margin: 8px 0 16px 24px;
    color: #586069;
}

/* KEYBOARD INPUT */
.funeral-ai-chat-message-content kbd {
    background: #fafbfc;
    border: 1px solid #c6cbd1;
    border-bottom-color: #959da5;
    border-radius: 3px;
    box-shadow: inset 0 -1px 0 #959da5;
    color: #444d56;
    display: inline-block;
    font-family:
        "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
    font-size: 0.85em;
    line-height: 1;
    padding: 3px 6px;
    vertical-align: middle;
}

/* MARK/HIGHLIGHT */
.funeral-ai-chat-message-content mark {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 2px;
    color: #856404;
}

/* SUB I SUP */
.funeral-ai-chat-message-content sub,
.funeral-ai-chat-message-content sup {
    font-size: 0.75em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

.funeral-ai-chat-message-content sub {
    bottom: -0.25em;
}

.funeral-ai-chat-message-content sup {
    top: -0.5em;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .funeral-ai-chat-message-content {
        font-size: 0.95em;
    }

    .funeral-ai-chat-message-content h1,
    .funeral-ai-chat-message-content h2,
    .funeral-ai-chat-message-content h3 {
        font-size: 1.2em;
    }

    .funeral-ai-chat-message-content .funeral-ai-table,
    .funeral-ai-chat-message-content table {
        font-size: 0.8em;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .funeral-ai-chat-message-content .funeral-ai-code-block {
        padding: 12px;
        font-size: 0.8em;
    }

    .funeral-ai-chat-message-content ul,
    .funeral-ai-chat-message-content ol {
        padding-left: 20px;
    }
}

/* DARK MODE WSPARCIE */
@media (prefers-color-scheme: dark) {
    .funeral-ai-chat-message-content h1,
    .funeral-ai-chat-message-content h2,
    .funeral-ai-chat-message-content h3,
    .funeral-ai-chat-message-content h4,
    .funeral-ai-chat-message-content h5,
    .funeral-ai-chat-message-content h6 {
        color: #f0f6fc;
        border-bottom-color: #30363d;
    }

    .funeral-ai-chat-message-content strong {
        color: #f0f6fc;
    }

    .funeral-ai-chat-message-content code {
        background: rgba(110, 118, 129, 0.4);
        color: #f97583;
        border-color: rgba(110, 118, 129, 0.2);
    }

    .funeral-ai-chat-message-content .funeral-ai-code-block {
        background: #161b22;
        border-color: #30363d;
        color: #f0f6fc;
    }

    .funeral-ai-chat-message-content .funeral-ai-quote,
    .funeral-ai-chat-message-content blockquote {
        background: transparent;
        border-left-color: transparent;
        color: inherit;
    }

    .funeral-ai-chat-message-content .funeral-ai-table,
    .funeral-ai-chat-message-content table {
        border-color: #30363d;
    }

    .funeral-ai-chat-message-content .funeral-ai-table th,
    .funeral-ai-chat-message-content table th {
        background: #161b22;
        color: #f0f6fc;
        border-bottom-color: #30363d;
    }

    .funeral-ai-chat-message-content .funeral-ai-table td,
    .funeral-ai-chat-message-content table td {
        border-bottom-color: #30363d;
    }

    .funeral-ai-chat-message-content hr {
        background: #30363d;
    }

    .funeral-ai-chat-message-content a {
        color: #58a6ff;
    }

    .funeral-ai-chat-message-content a:hover {
        color: #79c0ff;
    }

    .funeral-ai-chat-message-content mark {
        background: #bb8009;
        color: #f0f6fc;
    }
}

/* POGRUBIENIA - bardziej naturalne */
.funeral-ai-chat-message-content strong {
    font-weight: 600;
    color: inherit;
    /* Usuń techniczny kolor, zostaw naturalny */
}

.funeral-ai-chat-message-content em {
    font-style: italic;
    color: inherit;
    /* Usuń szary kolor, zostaw naturalny */
}

/* KOD INLINE - minimalistyczny, naturalny */
.funeral-ai-chat-message-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 1px 4px;
    border-radius: 2px;
    font-family: inherit;
    /* Użyj normalnej czcionki zamiast mono */
    font-size: 0.95em;
    color: inherit;
    /* Usuń pomarańczowy kolor techiczny */
    border: none;
    /* Usuń border żeby było czystsze */
}

/* BLOKI KODU Z KLASĄ CSS - zachowaj tylko dla prawdziwego kodu */
.funeral-ai-chat-message-content .funeral-ai-code-block {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 12px;
    margin: 12px 0;
    font-family:
        "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
    font-size: 0.85em;
    line-height: 1.45;
    overflow-x: auto;
    white-space: pre;
    color: #495057;
}

.funeral-ai-chat-message-content .funeral-ai-code-block code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

/* Chat Bubble */
.funeral-ai-chat-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        var(--bubble-bg-color, #2c3e50),
        var(--accent-color, #3498db)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    animation: subtlePulse 3s ease-in-out infinite;

    /* CSS Custom Properties dla dynamicznych wartości */
    --bubble-border-radius: 50%;
    --bubble-color: var(--bubble-bg-color, #2c3e50);
    --ripple-color: rgba(44, 62, 80, 0.3);
}

/* Style dla bubble z awatarem */
.funeral-ai-chat-bubble.has-avatar {
    background: transparent;
    padding: 3px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.funeral-ai-chat-bubble.has-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.25);
}

/* Bubble avatar container */
.bubble-avatar {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Avatar image w bubble */
.bubble-avatar .avatar-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Kropka online indicator */
.bubble-avatar .online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: #27ae60;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    animation: onlinePulse 2s ease-in-out infinite;
}

@keyframes onlinePulse {
    0%,
    100% {
        box-shadow:
            0 1px 3px rgba(0, 0, 0, 0.2),
            0 0 0 0 rgba(39, 174, 96, 0.4);
    }

    50% {
        box-shadow:
            0 1px 3px rgba(0, 0, 0, 0.2),
            0 0 0 4px rgba(39, 174, 96, 0.2);
    }
}

/* Streaming placeholder */
.funeral-ai-chat-message.assistant.streaming
    .funeral-ai-chat-message-content::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 1em;
    background: currentColor;
    margin-left: 4px;
    animation: funeral-ai-caret 0.8s steps(1) infinite;
    vertical-align: bottom;
    opacity: 0.6;
}

@keyframes funeral-ai-caret {
    0%,
    50% {
        opacity: 0.6;
    }
    51%,
    100% {
        opacity: 0;
    }
}

.typing-indicator-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.typing-status {
    font-size: 12px;
    color: #7a7a7a;
    font-style: italic;
    letter-spacing: 0.2px;
    animation: typingStatusPulse 1.6s ease-in-out infinite;
}

@keyframes typingStatusPulse {
    0%,
    100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-1px);
    }
}

/* ========================================
   MARKDOWN FORMATTING STYLES (rendered by Marked.js)
   ======================================== */

/* Główny kontener wiadomości asystenta z markdown */
.funeral-ai-chat-message.assistant .funeral-ai-chat-message-content {
    line-height: 1.6;
    font-size: 14px;
}

/* Paragrafy - klasa dodawana przez Marked.js */
.funeral-ai-chat-message-content p,
.funeral-ai-chat-message-content .markdown-paragraph {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.funeral-ai-chat-message-content p:last-child,
.funeral-ai-chat-message-content .markdown-paragraph:last-child {
    margin-bottom: 0;
}

/* Linki - ładne, klikalne, wyróżnione (klasy z Marked.js) */
.funeral-ai-chat-message-content a,
.funeral-ai-chat-message-content a {
    color: #0a66c2;
    text-decoration: underline;
    font-weight: 600;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    transition: color 0.2s ease;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: none;
    display: inline-block;
}

/* Ensure tel/mailto/URL anchors never wrap mid-token */
.funeral-ai-chat-message-content a[href^="tel:"],
.funeral-ai-chat-message-content a[href^="mailto:"],
.funeral-ai-chat-message-content a[href^="http"],
.funeral-ai-chat-message-content a[href^="https"],
.funeral-ai-chat-message-content a[href^="www."] {
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: none;
    display: inline-block;
}

.funeral-ai-chat-message-content a:hover {
    color: #084f8c;
}

.funeral-ai-chat-message-content a:active {
    color: #063d6a;
}

/* Bold (pogrubienie) */
.funeral-ai-chat-message-content strong {
    font-weight: 700;
    color: inherit;
}

/* Italic (kursywa) */
.funeral-ai-chat-message-content em {
    font-style: italic;
    color: inherit;
    opacity: 0.95;
}

/* Nagłówki */
.funeral-ai-chat-message-content h1,
.funeral-ai-chat-message-content h2,
.funeral-ai-chat-message-content h3,
.funeral-ai-chat-message-content h4 {
    font-weight: 700;
    margin: 16px 0 10px 0;
    line-height: 1.3;
    color: inherit;
}

.funeral-ai-chat-message-content h1:first-child,
.funeral-ai-chat-message-content h2:first-child,
.funeral-ai-chat-message-content h3:first-child,
.funeral-ai-chat-message-content h4:first-child {
    margin-top: 0;
}

.funeral-ai-chat-message-content h1 {
    font-size: 18px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 6px;
}

.funeral-ai-chat-message-content h2 {
    font-size: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 4px;
}

.funeral-ai-chat-message-content h3 {
    font-size: 15px;
}

.funeral-ai-chat-message-content h4 {
    font-size: 14px;
}

/* Listy - klasy dodawane przez Marked.js */
.funeral-ai-chat-message-content ul,
.funeral-ai-chat-message-content ol,
.funeral-ai-chat-message-content .markdown-list {
    margin: 10px 0;
    padding-left: 1.4em;
    list-style-position: outside;
}

.funeral-ai-chat-message-content ul,
.funeral-ai-chat-message-content .markdown-list:not([type]) {
    list-style-type: disc;
}

.funeral-ai-chat-message-content ol {
    list-style-type: decimal;
}

.funeral-ai-chat-message-content li,
.funeral-ai-chat-message-content .markdown-list-item {
    margin: 6px 0;
    line-height: 1.5;
    padding-left: 0;
}

.funeral-ai-chat-message-content ul ul,
.funeral-ai-chat-message-content ol ol {
    margin: 4px 0;
}

/* Inline code */
.funeral-ai-chat-message-content code {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "Monaco", "Menlo", "Consolas", monospace;
    font-size: 13px;
    color: #c7254e;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Code blocks */
.funeral-ai-chat-message-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.funeral-ai-chat-message-content pre code {
    background: transparent;
    padding: 0;
    border: none;
    color: inherit;
    font-size: 13px;
    line-height: 1.5;
}

/* Horizontal rule (separator) */
.funeral-ai-chat-message-content hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 16px 0;
}

/* Tabele */
.funeral-ai-chat-message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}

.funeral-ai-chat-message-content th,
.funeral-ai-chat-message-content td {
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    text-align: left;
}

.funeral-ai-chat-message-content th {
    background: rgba(0, 0, 0, 0.05);
    font-weight: 700;
}

.funeral-ai-chat-message-content tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

/* Numery telefonów - zielone z emoji (dodane przez Marked.js) */
.funeral-ai-chat-message-content .phone-link,
.funeral-ai-chat-message-content a[href^="tel:"] {
    color: inherit;
    text-decoration: underline;
    font-weight: 700;
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
}

.funeral-ai-chat-message-content .phone-link:hover,
.funeral-ai-chat-message-content a[href^="tel:"]:hover {
    color: inherit;
    text-decoration: underline;
    background: none;
    border: none;
}

/* Email - niebieski z emoji (dodane przez Marked.js) */
.funeral-ai-chat-message-content .email-link,
.funeral-ai-chat-message-content a[href^="mailto:"] {
    color: inherit;
    text-decoration: underline;
    font-weight: 700;
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
}

.funeral-ai-chat-message-content .email-link:hover,
.funeral-ai-chat-message-content a[href^="mailto:"]:hover {
    color: inherit;
    text-decoration: underline;
    background: none;
    border: none;
}

/* Dla starych wiadomości - usuń podwójne formatowanie */
.funeral-ai-chat-message-content br + br {
    display: none;
}

/* Mobile - mniejsze odstępy */
@media (max-width: 768px) {
    .funeral-ai-chat-message-content {
        font-size: 13px;
    }

    .funeral-ai-chat-message-content h1 {
        font-size: 16px;
    }

    .funeral-ai-chat-message-content h2 {
        font-size: 15px;
    }

    .funeral-ai-chat-message-content ul,
    .funeral-ai-chat-message-content ol {
        padding-left: 20px;
    }

    .funeral-ai-chat-message-content li {
        margin: 4px 0;
    }
}
