/**
 * Style CSS dla BT Advance Chatbot
 */

/* 1. Wrapper Przycisku i Szturchnięcia */
#btac-button-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999998;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* 2. NOWOŚĆ: Dymek "Szturchnięcie" (Nudge) */
#btac-nudge {
    background-color: #333;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.5s ease;
    position: relative;
    cursor: default;
}
/* Pokazywanie dymka */
#btac-nudge:not([hidden]) {
    opacity: 1;
}
/* Strzałka dymka */
#btac-nudge .btac-nudge-arrow {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #333;
    position: absolute;
    bottom: -8px;
    right: 22px; 
}

/* 3. Przycisk otwierający Czat (Ikona) */
#btac-button {
    /* Pozycja jest teraz kontrolowana przez wrapper */
    width: 60px;
    height: 60px;
    background-color: #007bff; /* Główny kolor (możesz zmienić) */
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

#btac-button:hover {
    background-color: #0056b3;
    transform: scale(1.1);
}

#btac-button svg {
    width: 32px;
    height: 32px;
}

/* --- NOWA ANIMACJA: Potrząsanie --- */
@keyframes btac-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

.btac-shake-animation {
    animation: btac-shake 0.4s ease-in-out;
    /* POPRAWKA: Zmiana z 3 na 4 potrząśnięcia w jednej serii */
    animation-iteration-count: 4;
}
/* --- KONIEC NOWEJ ANIMACJI --- */

/* 4. Panel Czatbota (Główne okno) */
#btac-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 370px;
    max-width: calc(100% - 40px);
    height: 600px;
    max-height: calc(100% - 40px);
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    transition: all 0.3s ease;
}

/* Ukrywanie, gdy atrybut 'hidden' jest obecny */
#btac-panel[hidden] {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

/* 5. Nagłówek Panelu */
.btac-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: #f7f7f7;
    border-bottom: 1px solid #e9e9e9;
    flex-shrink: 0;
}

.btac-title {
    font-size: 16px;
    color: #333;
}

.btac-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.btac-close:hover {
    color: #000;
}

/* 6. Okno Wiadomości */
.btac-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #fff;
}

.btac-msg {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.5;
    max-width: 85%;
    word-wrap: break-word;
    clear: both; /* Ważne dla float */
}

/* Wiadomość Bota (Asystenta) */
.btac-bot,
.btac-bot-greet,
.btac-bot-thinking {
    background-color: #f1f3f4;
    color: #202124;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    float: left;
}

.btac-bot-thinking {
    color: #666;
}

/* Wiadomość Użytkownika */
.btac-user {
    background-color: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
    float: right;
}

.btac-bot-error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 12px;
    float: left;
}

.btac-msg a {
    color: #0056b3;
    text-decoration: underline;
}

/* 7. NOWOŚĆ: Kontener Sugerowanych Pytań */
.btac-suggestions {
    padding: 0 16px 16px 16px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.btac-suggestions[hidden] {
    display: none;
}

.btac-suggestion-chip {
    background-color: #f1f3f4;
    border: 1px solid #e0e0e0;
    color: #0056b3;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btac-suggestion-chip:hover {
    background-color: #e2e6ea;
}

/* 8. Formularz Wpisywania */
.btac-form {
    display: flex;
    border-top: 1px solid #e9e9e9;
    padding: 12px;
    background-color: #f7f7f7;
    flex-shrink: 0;
}

#btac-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    line-height: 1.4;
    margin-right: 8px;
}

#btac-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.2);
}

.btac-form button {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.btac-form button svg {
    width: 20px;
    height: 20px;
}

.btac-form button:hover {
    background-color: #0056b3;
}

/* 9. Responsywność */
@media (max-width: 450px) {
    #btac-panel {
        width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        max-width: 100%;
        border-radius: 0;
    }

    #btac-button-wrapper { /* Zaktualizowany wrapper */
        bottom: 15px;
        right: 15px;
    }

    #btac-button {
        /* Usunięte pozycjonowanie, jest w wrapperze */
        width: 55px;
        height: 55px;
    }

    #btac-nudge {
        font-size: 13px;
        padding: 8px 12px;
    }

    .btac-suggestion-chip {
        font-size: 12px;
        padding: 6px 10px;
    }
}