@keyframes tkChatFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes chatPanelIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.tk-panel-menu-item.active {
    color: #fff !important;
    background: rgba(255,255,255,0.06);
    border-left-color: var(--i-primary, #007bff) !important;
}

.tk-panel-menu-item:hover {
    background: rgba(255,255,255,0.04);
    color: #fff !important;
}
.tk-chat-settings {
    position: relative;
}

.tk-chat-settings-btn {
    cursor: pointer;
    font-size: 15px;
    color: #888;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tk-chat-settings-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.tk-msg-fade-in { animation: tkChatFadeIn 0.25s ease-out forwards; }

/* STABILNE I NOWOCZESNE DYMKI CZATU */
.tk-msg-item { 
    position: relative;
    display: flex !important;
    flex-direction: column !important;
    background: rgb(94 94 94 / 15%);
    border-radius: 18px;
    padding: 12px 40px 12px 16px;
    margin-bottom: 15px;
    width: fit-content;
    max-width: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: background 0.2s ease;
    line-height: 1.45;
    font-size: 14px;
    color: var(--i-text-color, #1c1e21);
    word-break: break-word;
    border: 1px solid rgb(214 214 214 / 7%);
}
.tk-msg-item:last-child {
    margin-bottom: 0;
}
.tk-msg-item:hover { 
    background: rgb(216 216 216 / 7%); 
}

.tk-msg-item img {
    max-width: 100%;
    height: auto;
    display: inline-block;
    vertical-align: middle;
}

.tk-reply-quote {
    background: var(--i-background-3, rgba(0,0,0,0.05));
    border-left: 3px solid var(--i-primary, #007bff);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--i-text-light, #65676b);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#chatMessageWindow::-webkit-scrollbar { width: 6px; }
#chatMessageWindow::-webkit-scrollbar-track { background: transparent; }
#chatMessageWindow::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.2); border-radius: 10px; }
#chatMessageWindow::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.4); }

/* Przyciski akcji wiadomości */
.tk-msg-actions {
    position: absolute;
    right: 30px;
    top: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 10;
}

.tk-msg-item:hover .tk-msg-actions {
    opacity: 1;
    visibility: visible;
}

.tk-action-btn {
background-color: hsl(0deg 0% 24.25% / 82%);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    width: 28px;
    height: 26px;
    padding: 0;
    font-size: 11px;
    cursor: pointer;
    color: rgb(255 255 255 / 81%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.05);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.tk-action-btn i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 11px;
}

.tk-action-btn:hover {
    background: rgb(73 73 73 / 90%);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
    border-radius: 12px;
}

.tk-action-btn.tk-edit-btn:hover {
    background: rgb(73 73 73 / 90%);
    color: #fff;
    border-color: rgba(255,255,255,0.35);
}

.tk-action-btn.tk-delete-btn:hover {
    background: rgba(255,80,80,0.25);
    color: #ff6b6b;
    border-color: rgba(255,80,80,0.4);
}

/* Przycisk odpowiedzi */
.tk-reply-btn { 
    position: absolute; 
    right: -14px; 
    top: 50%; 
    transform: translateY(-50%) scale(0.8); 
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12); 
    border-radius: 12px;
    width: 34px;
    height: 30px;
    padding: 0;
    font-size: 13px; 
    cursor: pointer; 
    color: rgba(255,255,255,0.7);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.06);
    z-index: 10;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.tk-reply-btn i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 13px;
}

.tk-msg-item:hover .tk-reply-btn { 
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(-50%) scale(1); 
}

.tk-reply-btn:hover { 
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
    transform: translateY(-50%) scale(1.1); 
    box-shadow: 0 4px 16px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.1);
    border-radius: 14px;
}

/* Styl edycji wiadomości */
.tk-edit-container {
    display: none;
    width: 100%;
    margin-top: 8px;
}

.tk-edit-container.active {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tk-edit-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--i-primary, #007bff);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 40px;
    outline: none;
    box-sizing: border-box;
    background: var(--i-background-1, #fff);
    color: var(--i-text-color, #333);
}

.tk-edit-input:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

.tk-edit-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.tk-edit-save-btn, .tk-edit-cancel-btn {
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    font-weight: 500;
}

.tk-edit-save-btn {
    background: var(--i-primary, #007bff);
    color: #fff;
    border-color: var(--i-primary, #007bff);
}

.tk-edit-save-btn:hover {
    opacity: 0.9;
}

.tk-edit-cancel-btn {
    background: var(--i-background-3, #f0f0f0);
    color: var(--i-text-light, #666);
    border-color: rgba(128,128,128,0.2);
}

.tk-edit-cancel-btn:hover {
    background: var(--i-background-2, #e0e0e0);
}

.tk-edited-badge {
    font-size: 10px;
    color: var(--i-text-light, #888);
    font-style: italic;
    margin-left: 6px;
}

.tk-mention-highlight,
.tk-msg-item.tk-reply-to-me {
    padding-left: 12px !important;
    position: relative;
    box-shadow: -2px 0 8px rgba(241,196,15,0.2), inset 0 0 0 1px rgba(241,196,15,0.1);
}

.tk-mention-highlight .tk-msg-content::before,
.tk-msg-item.tk-reply-to-me .tk-msg-content::before {
    content: '@';
    font-size: 40px;
    font-weight: 900;
    color: rgba(241,196,15,0.06);
    position: absolute;
    right: 10px;
    bottom: -5px;
    pointer-events: none;
    z-index: 0;
}
.tk-msg-item.tk-reply-to-me .tk-msg-content::before {
    content: '"' !important;
}

.tk-mention-highlight .tk-msg-content::after,
.tk-msg-item.tk-reply-to-me .tk-msg-content::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    background: #f1c40f;
    border-radius: 50%;
    box-shadow: 0 0 10px #f1c40f, 0 0 20px rgba(241,196,15,0.5);
    pointer-events: none;
    z-index: 1;
    animation: glowDot 2s ease-in-out infinite;
}
#chatSendBtn {
    background: linear-gradient(135deg, rgba(128,128,128,0.12), rgba(128,128,128,0.05)) !important;
    color: var(--i-text-light, #999) !important;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.04);
    position: relative;
    overflow: hidden;
}

#chatSendBtn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.1), transparent 60%);
    pointer-events: none;
}

#chatSendBtn:hover {
    transform: scale(1.1);
    border-color: rgba(255,255,255,0.15);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.08);
    background: linear-gradient(135deg, rgba(128,128,128,0.2), rgba(128,128,128,0.1)) !important;
    color: #fff !important;
}

#chatSendBtn:hover i {
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

#chatSendBtn:active {
    transform: scale(0.9);
    transition: all 0.1s ease;
}
/* Menu wzmianek */
.tk-mention-dropdown { 
    position: absolute; bottom: 60px; left: 0; 
    background: var(--i-dropdown--ba-co) !important; 
    border: 1px solid var(--i-border-color, rgba(128,128,128,0.1)) !important; 
    border-radius: 12px !important; width: 220px !important; 
    box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important; 
    z-index: 9999 !important; list-style: none !important; 
    padding: 6px !important; 
    margin: 0 !important; 
    display: block; 
    overflow: hidden; 
}

.tk-mention-dropdown li { 
    padding: 10px 16px !important; cursor: pointer !important; 
    font-size: 13px !important; 
    color: var(--i-text-color, #333) !important; 
    background: transparent !important; 
    list-style-type: none !important; 
    transition: background 0.15s ease; 
}

.tk-mention-dropdown li:hover, .tk-mention-dropdown li.active { 
    
    color: #fff !important; 
}

.tk-send-error { 
    color: #e74c3c; font-size: 12px; padding: 10px 14px; 
    display: none; background: rgba(231, 76, 60, 0.1); 
    border-radius: 8px; margin-bottom: 10px; font-weight: 500; 
    border-left: 3px solid #e74c3c; 
}

.tk-clickable { cursor: pointer; }

/* Kontener czatu */
#tkChatContainer {
    background: var(--i-widget--ba-co) !important;

    color: var(--i-text-color, #333) !important;
}

/* Okno wiadomości */
#chatMessageWindow {
    background: var(--i-widget--ba-co) !important;
    border-bottom: 1px solid var(--i-border-color, rgba(128,128,128,0.1)) !important;
    border-radius: 12px;
}
.tk-msg-text {
    color: #d2d2d2;
}
/* Input czatu */
#chatInputField {
    background: var(--i-widget--ba-co) !important;
    color: var(--i-color_soft) !important;
    border: 1px solid var(--i-border-color, rgba(128,128,128,0.2)) !important;
    border-radius: 24px;
    padding: 12px 54px 12px 18px;
}
.tkchat--onlinecount {
    display: flex;
    gap: 3px;
        align-items: center;
    font-size: 11px;
    text-transform: uppercase;
    color: rgb(210 210 210 / 87%);
}
.tk-action-btn .ipsTooltip,
.tk-reply-btn .ipsTooltip {
    left: auto !important;
    right: 0 !important;
    transform: translateX(0) !important;
}

.tk-action-btn .ipsTooltip::after,
.tk-reply-btn .ipsTooltip::after {
    left: auto !important;
    right: 15px !important;
}
.tkliveactivity-dot {
    width: 7px;
    height: 7px;
     margin-right: 4px;
    border-radius: 50%;
    background: var(--i-color-positive, #22c55e);
    box-shadow: 0 0 8px var(--i-color-positive, #22c55e);
    animation: ipw-blink 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    
}
@keyframes ipw-blink {
    0%, 100% {
    opacity: 1;
    transform: scale(1);
}
}
#chatInputField:focus {
    background: var(--i-widget--ba-co) !important;
    border-color: var(--i-primary, #007bff) !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

#chatInputField::placeholder {
    color: var(--i-text-light, #999);
}

/* Przyciski w input area */
#elChatKlipyButton, #elChatEmojiButton {
    color: #b5b5b5 !important;
    border-radius: 24px;
    transition: background 0.2s;
}

#elChatKlipyButton:hover, #elChatEmojiButton:hover {
    background: var(--i-background-3, rgba(128,128,128,0.1)) !important;
}

#chatSendBtn {

    border-radius: 24px;
    font-weight: 600;
}

/* Menu emoji i klipy */
#elChatEmojiMenu, #elChatKlipyMenu {
    background: var(--i-dropdown--ba-co) !important;
    border: 1px solid var(--i-border-color, rgba(128,128,128,0.1)) !important;
    border-radius: var(--i-dropdown--bo-ra);
    box-shadow: var(--i-dropdown--bo-sh);
}

#chatKlipySearch {
    background: var(--i-widget--ba-co) !important;
    color: var(--i-color_soft) !important;
    border: 1px solid var(--i-border-color, rgba(128, 128, 128, 0.2)) !important;;
    border-radius: 20px;
}

/* Loader */
#initialLoader {
    color: var(--i-text-light, #777) !important;
}
.tk-msg-time::before {
    content: '· ';
    color: #888;
}
/* Animacja pisania - migające kropki */
#chatTypingIndicator {
    position: absolute;
    bottom: 80px;
    left: 30px;
    font-size: 11px;
    color: var(--i-text-light, #888);
    font-style: italic;
    background: rgba(0,0,0,0.6);
    padding: 4px 10px;
    border-radius: 12px;
    z-index: 5;
    pointer-events: none;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: typingPulse 1.5s ease-in-out infinite;
}

@keyframes typingPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
/* Połącz w jedno: */
#chatMessageWindow {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(128,128,128,0.2) transparent;
}

/* Ostrzeżenie o stracie połączenia */
#chatReconnect {
    animation: pulseWarning 2s ease-in-out infinite;
}

@keyframes pulseWarning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,193,7,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255,193,7,0); }
}
/* 4. Subtelna linia oddzielająca dzień */
.tk-msg-date-separator {
    text-align: center;
    font-size: 11px;
    color: rgba(128,128,128,0.6);
    margin: 15px 0;
    position: relative;
}

.tk-msg-date-separator::before,
.tk-msg-date-separator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: rgba(128,128,128,0.15);
}
#chatMessageWindow::after {
    content: '';
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20px;
    background: linear-gradient(transparent, var(--i-widget--ba-co, #fff));
    pointer-events: none;
}
/* Load more button */
#chatLoadMoreBtn {
    background: rgba(128,128,128,0.15) !important;
    color: var(--i-text-light, #999) !important;
    border: 1px solid rgba(128,128,128,0.15) !important;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

#chatLoadMoreBtn:hover {
    background: rgba(128,128,128,0.25) !important;
    color: var(--i-text-color, #fff) !important;
    border-color: rgba(128,128,128,0.3) !important;
}

/* Guest notice */
#chatGuestNotice {
    background: var(--i-background-2, #f8f9fa) !important;
    color: var(--i-text-light, #555) !important;
    border: 1px dashed var(--i-border-color, rgba(128,128,128,0.15)) !important;
    border-radius: 12px;
}
.tkmsg-replymsg {
    font-size: 11px;
    color: #bbb;
    background: rgba(241,196,15,0.06);
    padding: 8px 14px;
    margin-left: 42px;
    margin-bottom: 8px;
    border: 1px solid rgba(241,196,15,0.2);
    border-radius: 12px;
    max-width: fit-content;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(241,196,15,0.08), inset 0 0 20px rgba(241,196,15,0.02);
}

.tkmsg-replymsg i {
    color: #f1c40f;
    font-size: 10px;
    background: rgba(241,196,15,0.15);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tkmsg-replymsg strong {
    color: #d5d5d5;
    font-weight: 600;
    font-size: 11px;
}

.tkmsg-replymsg em {
    color: #aaa;
    font-style: normal;
}
/* Reply preview bar */
#chatReplyPreviewBar {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: rgba(128,128,128,0.06);
    border: 1px solid rgba(128,128,128,0.1);
    border-left: 3px solid #f1c40f;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    animation: replySlideDown 0.2s ease-out;
}

#chatReplyPreviewBar span:first-child {
    font-size: 10px;
    font-weight: 700;
    color: #f1c40f;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

#chatReplyPreviewText {
    color: var(--i-text-color, #bbb);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
    font-size: 12px;
    opacity: 0.8;
}

#chatCancelReplyBtn {
    cursor: pointer;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 5px;
    font-size: 10px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#chatCancelReplyBtn:hover {
    background: rgba(255,80,80,0.2);
    color: #ff6b6b;
    border-color: rgba(255,80,80,0.3);
}

@keyframes replySlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Char counter */
#chatCharCounter {
    color: var(--i-text-light, #a0a0a0) !important;
}

/* New message alert */
#chatNewMessageAlert {
    background: var(--i-primary, #007bff) !important;
    color: #fff !important;
    border-radius: 24px;
}

.tkchat--others {
padding: 0px 15px 15px 15px;
}

#chatInputArea {
display: flex;
    padding: 0px 15px 15px 15px;
}
#chatMessageWindow.is-inactive {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
    opacity: 0.6;
    transition: all 0.3s ease;
}
@keyframes glowDot {
    0%, 100% { opacity: 0.4; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.5); }
}
.tk-typing-name {
    color: var(--i-text-color, #ccc);
    font-weight: 500;
}

.tk-typing-dots span {
    display: inline-block;
    animation: typingDot 1.4s infinite;
    opacity: 0;
    font-weight: bold;
}

.tk-typing-dots span:nth-child(1) { animation-delay: 0s; }
.tk-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.tk-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
    0%, 60%, 100% { opacity: 0; }
    30% { opacity: 1; }
}

@media (max-width: 768px) {
    #chatSettingsPanel > div:last-child {
        flex-direction: row !important;
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 85vh !important;
        border-radius: 14px !important;
    }
    
    #chatSettingsPanel > div:last-child > div:first-child {
        width: 160px !important;
        min-width: 160px !important;
        padding: 12px 0 !important;
    }
    
    .tk-panel-menu-item {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
    
    #chatSettingsPanel > div:last-child > div:last-child {
        padding: 14px !important;
    }
    
    #chatSettingsPanel input,
    #chatSettingsPanel select {
        font-size: 16px !important;
    }
}
#chatBanDuration > option {
    color: #000;
}

.tkchat-rules {
        display: revert;
    list-style: revert;
    margin: revert;
    padding: 0;
    position: relative;
    inset-inline-start: 2em;
    max-width: calc(100% - 2em);
}