#kasia-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    max-width: 90vw;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: visible; /* Zmienione z 'hidden' na 'visible' */
    transition: all 0.3s ease;
    max-height: 500px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

#kasia-chat-container.kasia-chat-closed {
    max-height: 60px;
}

.kasia-chat-header {
    background-color: var(--bot-color, #4f46e5);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    position: relative; /* Dodane dla prawidłowego pozycjonowania avatara */
    padding-left: 90px; /* Dodajemy miejsce dla avatara */
    min-height: 50px; /* Minimalna wysokość, by zmieścić avatar */
    border-top-left-radius: 10px; /* Dodajemy zaokrąglenie górnego lewego rogu */
    border-top-right-radius: 10px; /* Dodajemy zaokrąglenie górnego prawego rogu */
}

.kasia-chat-header-left {
    display: flex;
    align-items: center;
}

.kasia-avatar {
    width: 70px; /* Zwiększone z 60px na 70px */
    height: 70px; /* Zwiększone z 60px na 70px */
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.9);
    position: absolute;
    left: 10px;
    top: -25px; /* Dostosowane, by zachować proporcje */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); /* Ciemniejszy i większy cień */
    z-index: 1000;
}

.kasia-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kasia-chat-title {
    font-weight: bold;
    font-size: 16px;
    margin-left: 10px; /* Dodajemy margines dla tytułu */
}

.kasia-chat-toggle {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
    font-size: 18px;
}

#kasia-chat-container.kasia-chat-closed .kasia-chat-toggle {
    transform: rotate(0deg);
}

.kasia-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Dodajemy overflow: hidden tutaj */
    transition: max-height 0.3s ease;
    max-height: 440px;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

#kasia-chat-container.kasia-chat-closed .kasia-chat-body {
    max-height: 0;
}

.kasia-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kasia-message {
    max-width: 80%;
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
}

.kasia-message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 10px;
    flex-shrink: 0;
}

.kasia-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kasia-message-content {
    padding: 10px 15px;
    border-radius: 12px; /* Mniej zaokrąglone rogi */
    word-wrap: break-word;
    white-space: normal; /* Zmiana z pre-wrap na normal */
    margin: 0; /* Usunięcie niepotrzebnych marginesów */
    line-height: 1.4; /* Poprawienie odstępów między wierszami */
}

.kasia-user-message .kasia-message-content {
    background-color: var(--bot-color, #4f46e5);
    color: white;
    border-bottom-right-radius: 4px; /* Mniejsze zaokrąglenie dla "ogonka" */
}

.kasia-bot-message .kasia-message-content {
    background-color: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px; /* Mniejsze zaokrąglenie dla "ogonka" */
}

.kasia-chat-input-container {
    display: flex;
    padding: 10px 15px;
    border-top: 1px solid #e0e0e0;
}

.kasia-chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
    margin-right: 10px;
}

.kasia-chat-send {
    background-color: var(--bot-color, #4f46e5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.kasia-chat-send:hover {
    background-color: #3c359e;
}

/* Zastąp istniejący styl loadera */
.kasia-loader-container {
    display: none;
    padding: 10px 15px;
    margin-left: 45px; /* Miejsce na awatar */
}

.kasia-typing-indicator {
    display: flex;
    align-items: center;
}

.kasia-typing-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 10px;
    flex-shrink: 0;
}

.kasia-typing-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kasia-typing-dots {
    display: flex;
    align-items: center;
    background-color: #f0f0f0;
    padding: 8px 13px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.kasia-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #666;
    margin: 0 2px;
    opacity: 0.6;
    animation: typingAnimation 1.4s infinite;
}

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

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

@keyframes typingAnimation {
    0% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.6; transform: scale(1); }
}

.kasia-loader {
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid var(--bot-color, #4f46e5);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#kasia-welcome-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 10000;
    width: 200px;
    text-align: center;
}

.kasia-welcome-avatar {
    position: relative;
    cursor: pointer;
    display: inline-block;
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.kasia-welcome-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 4px solid white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

#kasia-chat-container.kasia-chat-closed {
    max-height: 70px; /* Wysokość wystarczająca na avatar */
    opacity: 1;
    visibility: visible;
    overflow: visible;
    z-index: 10;
}

.kasia-welcome-avatar img:hover {
    transform: scale(1.05);
}

.kasia-welcome-bubble {
    position: absolute;
    top: 100%; 
    left: 50%;
    transform: translateX(-50%);
    background-color: #4f46e5; 
    color: white; 
    border-radius: 20px;
    padding: 12px 15px;
    max-width: 250px;
    min-width: 200px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    text-align: center;
    z-index: 10;
    margin-top: 15px; 
}

.kasia-welcome-bubble::before {
    content: '';
    position: absolute;
    top: -6px; /* Delikatne podniesienie */
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 15px;
    height: 15px;
    background-color: #4f46e5;
    z-index: -1;
}

.kasia-welcome-avatar:hover .kasia-welcome-bubble {
    opacity: 1;
    visibility: visible;
}

.kasia-welcome-bubble p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

#kasia-welcome-container.kasia-welcome-hidden {
    opacity: 0;
    transform: scale(0.5);
}

.kasia-chat-controls {
    display: flex;
    align-items: center;
}

.kasia-chat-minimize,
.kasia-chat-close {
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 10px;
    color: white;
    font-size: 20px;
}

#kasia-chat-container.kasia-chat-minimized {
    min-height: 50px;
    max-height: 90px; 
    
}

#kasia-chat-container.kasia-chat-minimized .kasia-chat-body {
    display: none;
}

/* Style dla linków wewnętrznych w wiadomościach czatu */
.kasia-message-content a.kasia-internal-link {
    color: var(--bot-color, #4f46e5);
    text-decoration: underline;
    word-break: break-all;
    transition: all 0.2s ease;
}

.kasia-message-content a.kasia-internal-link:hover {
    color: #3c359e;
    text-decoration: none;
}

/* Zachowaj emoji w czacie */
.kasia-message-content {
    unicode-bidi: normal;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
}