
:root {
    --primary-color: #53bcee;        /* główny niebieski */
    --secondary-color: white;      /* ciemny granat zamiast fioletu */
    --accent-color: #EEA236;         /* złoty akcent */
    --background: #53bcef;
    --white: #ffffff;
    --gray-100: #f1f5f9;             /* jaśniejszy, lekko niebieskawy */
    --gray-200: #e2e8f0;
    --gray-400: #94a3b8;
    --gray-600: #475569;
    --gray-900: #0f172a;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
}



/* Kontener główny - pozycjonowany absolutnie w prawym dolnym rogu */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Dymek czatu - zwinięty stan - PROSTOKĄTNY */
.chat-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--primary-color);
    border: 2px solid var(--primary-color);
    color: var(--white);
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.5s ease;
    animation: float 3s ease-in-out infinite;
}

.chat-bubble:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--gray-100);
    color: var(--primary-color);
}

.chat-bubble .bubble-icon {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.chat-bubble .bubble-text {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.chat-bubble .status-indicator {
    width: 8px;
    height: 8px;
    background: #EEA236;
    animation: pulse 2s infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes pulse {
    0% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.3;  /* Zmniejsz jeszcze bardziej przezroczystość */
        transform: scale(1.2);  /* Dodaj lekkie powiększenie */
    }
    100% { 
        opacity: 1;
        transform: scale(1);
    }
}

/* Kontener rozwinięty - PROSTOKĄTNY */
.chat-container {
    display: none;
    width: 400px;
    height: 600px;
    background: var(--white);
    border: 2px solid var(--primary-color);
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    box-shadow: var(--shadow-lg);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    background: var(--primary-color);
    color: var(--white);
    padding: 16px;
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--primary-color);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header h1 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-icon {
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-icon img {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-btn,
.minimize-button {
    background: var(--primary-color);
    border: none;
    color: var(--white);
    font-size: 12px;
    cursor: pointer;
    padding: 8px 16px;
    transition: all 0.2s ease;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 70px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-btn:hover,
.minimize-button:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.close-button {
    background: var(--primary-color);
    border: none;
    color: var(--white);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.close-button:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.chat-messages {
    flex: 1;
    padding: 20px 20px 20px 20px; /* pozycja i szerokośc dymka */
    overflow-y: auto;
    background: var(--white);
    scrollbar-width: thin;
    scrollbar-color: var(--gray-400) transparent;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--gray-400);
}

.message {
    margin-bottom: 16px;
    margin-top: 20px; 
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    background: var(--gray-100);
}

.message-content {
    max-width: calc(85% - 58px);
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: var(--primary-color);
    color: var(--white);
    border: 2px solid var(--primary-color);
}

.user-message .message-avatar {
    background: white;
    color: var(--white);
}

.bot-message .message-content {
    margin-top: 35px;
    background: var(--gray-100);
    color: var(--gray-900);
    border: 2px solid var(--gray-200);
}

.bot-message .message-avatar {
    background: var(--primary-color);
    color: var(--white);
    margin-top: 30px; 
}

.bot-message .bot-name {
    font-size: 12px;
    color: var(--gray-600);
    margin-bottom: 4px;
    font-weight: 600;
}

.chat-input-container {
    padding: 20px;
    background: var(--white);
    border-top: 2px solid var(--gray-200);
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 2px solid var(--gray-200);
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    outline: none;
    transition: border-color 0.3s ease;
    background: var(--white);
}

.chat-input:focus {
    border-color: var(--primary-color);
}

.send-button {
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    color: var(--white);
    border: 2px solid var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: bold;
}

.send-button:hover:not(:disabled) {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.close-button svg polygon,
.send-button svg polygon {
    fill: var(--accent-color);
}

.typing-indicator {
    display: none;
    padding: 12px 16px;
    font-size: 14px;
    color: #94a3b8;
    font-style: italic;
    margin-left: 40px;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--gray-600);
    animation: wave 1.4s linear infinite;
}

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

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

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

@keyframes wave {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.error-message {
    background: #fef2f2;
    border: 2px solid #fecaca;
    color: #dc2626;
    padding: 12px;
    margin: 16px 40px 16px 0;
    font-size: 14px;
    text-align: center;
}

.welcome-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-bubble {
    background: var(--white);
    border: 2px solid var(--gray-200);
    padding: 16px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--gray-900);
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-action-button {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 12px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.5s ease;
    text-align: left;
    font-weight: 500;
    font-weight: bold;
}

/* Hover efekt przycisków */
.quick-action-button:hover {
    background: linear-gradient(90deg, var(--primary-color), #6fd4ff);
    color: var(--white);
    font-weight: bold;
}

/* Responsywność */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 10px;
        right: 10px;
    }

    .chat-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 40px);
    }

    .chat-bubble .bubble-text {
        font-size: 14px;
    }

    .chat-header {
        padding: 15px;
    }

    .chat-messages {
        padding: 15px;
    }

    .chat-input-container {
        padding: 15px;
    }

    .message-content {
        max-width: calc(85% - 58px);
    }

    .message-avatar {

        width: 50px;
        height: 50px;
        font-size: 14px;
    }

    .welcome-container {
        padding: 15px;
    }
}

html {
    scroll-behavior: smooth;
}

/* =================== DODATKOWE ANIMACJE =================== */

/* 1. Animowane belki w tle nagłówka */
.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--secondary-color), transparent);
    animation: slidingBeam 3s linear infinite;
    z-index: 1;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -100%;
    width: 50%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: slidingBeam 4s linear infinite reverse;
    z-index: 1;
}

@keyframes slidingBeam {
    0% { transform: translateX(0); }
    100% { transform: translateX(200%); }
}

/* 2. Pulsujący cień dla głównego kontenera */
.chat-container.expanded {
    animation: pulsingGlow 4s ease-in-out infinite alternate;
}

@keyframes pulsingGlow {
    0% { 
        box-shadow: var(--shadow-lg);
    }
    100% { 
        box-shadow: var(--shadow-lg), 0 0 20px rgba(35, 48, 78, 0.2);
    }
}

/* 3. Animacja przesuwania dla przycisków szybkich akcji */
.quick-action-button {
    position: relative;
    overflow: hidden;
}

.quick-action-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.quick-action-button:hover::before {
    left: 100%;
}

/* 4. Rozwijanie animacja dla wiadomości */
.message {
    transform: translateX(-20px);
    opacity: 0;
    animation: messageSlideIn 0.5s ease-out forwards;
}

.user-message {
    transform: translateX(20px);
}

@keyframes messageSlideIn {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 5. Animacja wciśnięcia dla przycisków */
.send-button:active,
.quick-action-button:active,
.download-btn:active,
.close-button:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* 6. Animowana ramka dla inputa w focus */
.chat-input:focus {
    position: relative;
    animation: inputGlow 2s ease-in-out infinite alternate;
}

@keyframes inputGlow {
    0% { 
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px rgba(35, 48, 78, 0.1);
    }
    100% { 
        border-color: var(--primary-color);
        box-shadow: 0 0 0 4px rgba(35, 48, 78, 0.2);
    }
}

/* 7. Falująca animacja dla wskaźnika statusu */
.status-indicator {
    position: relative;
}

.status-indicator::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px solid #EEA236;
    animation: ripple 2s linear infinite;
    opacity: 0;
}

@keyframes ripple {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* 8. Animacja hover dla dymka czatu */
.chat-bubble {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-bubble:hover {
    transform: translateY(-3px) scale(1.02);
}

/* 9. Animowane tło dla obszaru wiadomości */
.chat-messages::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(35, 48, 78, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(61, 185, 255, 0.03) 0%, transparent 50%);
    animation: backgroundShift 10s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes backgroundShift {
    0% { 
        transform: translateX(0) translateY(0);
    }
    100% { 
        transform: translateX(20px) translateY(-10px);
    }
}

/* 10. Animacja pisania - bardziej płynna */
.typing-dot {
    animation: typingWave 1.4s ease-in-out infinite;
}

@keyframes typingWave {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
        background: var(--secondary-color);
    }
}

/* 11. Subtlna animacja dla avatarów */
.message-avatar {
    transition: all 0.3s ease;
}

.message:hover .message-avatar {
    transform: scale(1.1) rotate(5deg);
}

/* 12. Animacja przesuwania dla nagłówka */
.chat-header {
    position: relative;
    overflow: hidden;
}

.header-content {
    animation: headerSlide 0.8s ease-out;
}

@keyframes headerSlide {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.header-buttons {
    animation: headerSlide 0.8s ease-out 0.2s both;
}
/* =================== ZAOKRĄGLONE ROGI =================== */

/* Główny kontener czatu */
.chat-container {
    border-radius: 12px;
}

/* Dymek czatu */
.chat-bubble {
    border-radius: 12px;
}

/* Nagłówek czatu */
.chat-header {
    border-radius: 10px 10px 0 0;
}

/* Treść wiadomości */
.message-content {
    border-radius: 12px;
}

/* Avatary wiadomości */
.message-avatar {
    border-radius: 50%;
}

/* Input tekstowy */
.chat-input {
    border-radius: 8px;
}

/* Przycisk wysyłania */
.send-button {
    border-radius: 8px;
}

/* Przyciski szybkich akcji */
.quick-action-button {
    border-radius: 8px;
}

/* Przyciski w nagłówku */
.download-btn,
.minimize-button,
.close-button {
    border-radius: 6px;
}

/* Bańki informacyjne */
.info-bubble {
    border-radius: 10px;
}

/* Wskaźnik statusu */
.status-indicator {
    border-radius: 50%;
}

/* Komunikat błędu */
.error-message {
    border-radius: 8px;
}

/* Kontener powitalny */
.welcome-container {
    border-radius: 8px;
}
.chat-bubble .status-indicator {
    width: 8px;
    height: 8px;
    background: #EEA236;
    border-radius: 50%;  /* ← DODAJ TĘ LINIĘ */
    animation: pulse 2s infinite;
}

.chat-header .status-indicator {
    width: 8px;
    height: 8px;
    background: #EEA236;
    border-radius: 50%;  /* ← DODAJ TĘ LINIĘ */
    animation: pulse 2s infinite;
    display: inline-block;
}
.status-indicator {
    border-radius: 50%;
}

        /* --- Zwinięty widżet: sama grafika (przezroczyste tło), napis po najechaniu.
               Napis-podpowiedź pokazuje się automatycznie tylko raz na sesję przeglądarki.
               Aby wrócić do starej belki: usuń klasę "compact" z div#chatBubble. --- */
        .chat-bubble.compact {
            position: relative;
            border: none;
            outline: none;
            background: none;
            padding: 0;
            border-radius: 0;
            box-shadow: none;
            flex-direction: row-reverse; /* napis wysuwa się w lewo od grafiki */
            gap: 0;
        }
        .chat-bubble.compact:hover {
            transform: none;
            box-shadow: none;
        }
        .chat-bubble.compact .bubble-img {
            width: 100px;
            height: 100px;
            display: block;
            filter: drop-shadow(0 4px 10px rgba(35, 48, 78, 0.35));
            transition: transform 0.2s ease;
        }
        .chat-bubble.compact:hover .bubble-img {
            transform: scale(1.08);
        }
        .chat-bubble.compact .bubble-label {
            max-width: 0;
            opacity: 0;
            overflow: hidden;
            white-space: nowrap;
            background: var(--primary-color); /* niebieski Domenika */
            color: #ffffff;
            font-size: 14px;
            font-weight: 600;
            border-radius: 20px;
            padding: 10px 0;
            margin-right: 10px;
            transition: max-width 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
            box-shadow: 0 4px 14px rgba(83, 188, 238, 0.45);
        }
        .chat-bubble.compact:hover .bubble-label,
        .chat-bubble.compact.show-label .bubble-label {
            max-width: 280px;
            opacity: 1;
            padding: 10px 16px;
        }
        .chat-bubble.compact .status-indicator {
            display: none; /* jak w oryginale Domenika */
        }

        /* Mobile expanded viewport guard */
        @media (max-width: 480px) {
            .chat-container.expanded {
                position: fixed;
                top: max(12px, env(safe-area-inset-top));
                right: max(10px, env(safe-area-inset-right));
                bottom: max(12px, env(safe-area-inset-bottom));
                left: max(10px, env(safe-area-inset-left));
                width: auto;
                height: auto;
                max-height: none;
                border-radius: 15px;
            }

            .chat-header {
                flex-wrap: wrap;
                align-items: center;
                gap: 8px;
                padding: 10px 12px;
            }

            .header-content {
                min-width: 0;
                flex: 1 1 auto;
                animation: none;
            }

            .chat-header h1 {
                min-width: 0;
                font-size: 16px;
                line-height: 1.2;
            }

            .header-buttons {
                flex: 0 0 auto;
                flex-wrap: nowrap;
                gap: 6px;
                animation: none;
            }

            .download-btn {
                min-height: 32px;
                padding: 5px 8px;
                font-size: 11px;
                white-space: nowrap;
            }

            .close-button {
                flex: 0 0 32px;
                width: 32px;
                height: 32px;
            }
        }

        @media (max-width: 360px) {
            .header-buttons {
                width: 100%;
                justify-content: flex-end;
            }
        }



        /* Hide textarea scrollbar track in the edit field */
        .chat-input {
            overflow-y: auto;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        .chat-input::-webkit-scrollbar {
            width: 0;
            height: 0;
            display: none;
        }
