#aaa-chat-widget {
    position: fixed;
    bottom: 28px !important;
    right: 28px !important;
    z-index: 99999;
    font-family: Arial, sans-serif;
}

#aaa-chat-button {
    width: 62px;
    height: 62px;
    background: #4a6cf7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(var(--aaa-rgb, 74,108,247), 0.5);
    transition: transform 0.2s, opacity 0.2s;
    animation: aaa-pulse 2.5s infinite;
    position: relative;
    outline: none;
}

#aaa-chat-button:focus-visible {
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--aaa-color, #4a6cf7);
}

#aaa-chat-button.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
    animation: none;
}

@keyframes aaa-pulse {
    0%,100% { box-shadow: 0 4px 20px rgba(var(--aaa-rgb, 74,108,247), 0.5); }
    50%      { box-shadow: 0 4px 28px rgba(var(--aaa-rgb, 74,108,247), 0.8), 0 0 0 8px rgba(var(--aaa-rgb, 74,108,247), 0.1); }
}

#aaa-chat-button:hover {
    transform: scale(1.08);
    animation: none;
}

#aaa-chat-box {
    display: none;
    flex-direction: column;
    width: 340px;
    height: 460px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    overflow: hidden;
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 99999;
}

#aaa-chat-box.open {
    display: flex;
}

#aaa-chat-header {
    background: #4a6cf7;
    color: white;
    padding: 14px 16px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-weight: bold;
    font-size: 15px;
}

#aaa-chat-header span {
    flex: 1;
}

#aaa-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin-left: auto;
}

#aaa-chat-footer {
    text-align: center;
    padding: 3px 10px 4px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

#aaa-chat-clear {
    background: none;
    border: none;
    color: #bbb;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
    text-decoration: underline;
    text-underline-offset: 2px;
}

#aaa-chat-clear:hover {
    color: #888;
}

#aaa-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f7f7;
}

.aaa-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.aaa-msg.bot {
    background: #fff;
    color: #222;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.aaa-msg.user {
    background: #4a6cf7;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.aaa-msg.typing {
    background: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 12px 16px;
    display: flex;
    gap: 5px;
    align-items: center;
}

.aaa-typing-dot {
    width: 8px;
    height: 8px;
    background: #bbb;
    border-radius: 50%;
    display: inline-block;
    animation: aaa-bounce 1.2s infinite;
}

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

@keyframes aaa-bounce {
    0%, 80%, 100% { transform: translateY(0); background: #bbb; }
    40%            { transform: translateY(-6px); background: #999; }
}

#aaa-chat-input-area {
    display: flex;
    padding: 10px;
    border-top: 1px solid #eee;
    gap: 8px;
    background: #fff;
}

#aaa-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}

#aaa-chat-send {
    background: #4a6cf7;
    color: white;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aaa-msg.bot a {
    color: inherit;
    font-weight: bold;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Skriveno vizuelno, dostupno čitačima ekrana */
#aaa-chat-widget .aaa-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === UOČLJIVOST: značka obaveštenja === */
#aaa-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 4px;
    border-radius: 11px;
    background: #e53935;
    color: #fff;
    font: 700 12px/18px Arial, sans-serif;
    text-align: center;
    border: 2px solid #fff;
    box-sizing: border-box;
    pointer-events: none;
    animation: aaa-badge-pop 0.4s ease-out;
}
#aaa-chat-badge[hidden] { display: none; }

@keyframes aaa-badge-pop {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* === UOČLJIVOST: natpis (teaser) pored dugmeta === */
#aaa-chat-teaser {
    position: absolute;
    bottom: 13px;
    right: 76px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: 250px;
    padding: 10px 12px 10px 16px;
    background: #fff;
    color: #222;
    border-radius: 18px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    font-size: 14px;
    line-height: 1.35;
    opacity: 0;
    transform: translateX(10px) scale(0.95);
    transition: opacity 0.35s ease, transform 0.35s ease;
    cursor: pointer;
}
#aaa-chat-teaser[hidden] { display: none; }
#aaa-chat-teaser.aaa-show {
    opacity: 1;
    transform: none;
}
/* repić oblačića prema dugmetu */
#aaa-chat-teaser::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -6px;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 3px -3px 6px rgba(0,0,0,0.05);
}
#aaa-chat-teaser-text {
    flex: 1;
    font-weight: 600;
}
#aaa-chat-teaser-close {
    flex-shrink: 0;
    background: #f0f0f0;
    border: none;
    color: #777;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 10px;
    line-height: 20px;
    padding: 0;
    cursor: pointer;
}
#aaa-chat-teaser-close:hover { background: #e0e0e0; color: #333; }

/* dugme levo → natpis desno od dugmeta */
#aaa-chat-widget.aaa-side-left #aaa-chat-teaser {
    right: auto;
    left: 76px;
    transform: translateX(-10px) scale(0.95);
}
#aaa-chat-widget.aaa-side-left #aaa-chat-teaser.aaa-show { transform: none; }
#aaa-chat-widget.aaa-side-left #aaa-chat-teaser::after {
    right: auto;
    left: -6px;
    box-shadow: -3px 3px 6px rgba(0,0,0,0.05);
}

/* natpis se ne prikazuje dok je chat otvoren */
#aaa-chat-widget:has(#aaa-chat-box.open) #aaa-chat-teaser { display: none; }

/* === UOČLJIVOST: pojačana animacija (talasi + poskok) === */
#aaa-chat-widget.aaa-anim-strong #aaa-chat-button::before,
#aaa-chat-widget.aaa-anim-strong #aaa-chat-button::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--aaa-color, #4a6cf7);
    opacity: 0;
    pointer-events: none;
    animation: aaa-ripple 2.4s ease-out infinite;
}
#aaa-chat-widget.aaa-anim-strong #aaa-chat-button::after { animation-delay: 1.2s; }
#aaa-chat-widget.aaa-anim-strong #aaa-chat-button {
    animation: aaa-pulse 2.5s infinite, aaa-nudge 6s ease-in-out 2s infinite;
}
#aaa-chat-widget.aaa-anim-strong.aaa-seen #aaa-chat-button::before,
#aaa-chat-widget.aaa-anim-strong.aaa-seen #aaa-chat-button::after { animation: none; display: none; }
#aaa-chat-widget.aaa-anim-strong.aaa-seen #aaa-chat-button { animation: aaa-pulse 2.5s infinite; }

@keyframes aaa-ripple {
    0%   { transform: scale(1);   opacity: 0.7; }
    100% { transform: scale(1.7); opacity: 0; }
}
@keyframes aaa-nudge {
    0%, 86%, 100% { transform: translateY(0); }
    90%           { transform: translateY(-8px); }
    94%           { transform: translateY(0); }
    97%           { transform: translateY(-4px); }
}

/* Mobilni */
@media (max-width: 480px) {
    #aaa-chat-teaser {
        max-width: calc(100vw - 130px);
        font-size: 13px;
        padding: 8px 10px 8px 12px;
    }
}

/* Poštuj sistemsko podešavanje "smanji pokrete" */
@media (prefers-reduced-motion: reduce) {
    #aaa-chat-button,
    #aaa-chat-widget.aaa-anim-strong #aaa-chat-button,
    #aaa-chat-badge { animation: none !important; }
    #aaa-chat-widget.aaa-anim-strong #aaa-chat-button::before,
    #aaa-chat-widget.aaa-anim-strong #aaa-chat-button::after { display: none; }
    #aaa-chat-teaser { transition: none; }
}
