/* Skidanje AI Savetnik — chat widget */

.savetnik-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Floating bubble */
.savetnik-bubble {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #4a2d7a 0%, #7a3aa8 50%, #d4af37 100%);
    box-shadow: 0 8px 32px rgba(74, 45, 122, 0.5), 0 0 0 4px rgba(212, 175, 55, 0.15);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.savetnik-bubble:hover { transform: scale(1.08); }
.savetnik-bubble-icon {
    color: #fff;
    font-size: 30px;
    line-height: 1;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}
.savetnik-bubble-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(212, 175, 55, 0.6);
    animation: savetnik-pulse 2s infinite ease-out;
    pointer-events: none;
}
@keyframes savetnik-pulse {
    0%   { transform: scale(1);   opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Greeting teaser bubble */
.savetnik-teaser {
    position: absolute;
    right: 78px;
    bottom: 8px;
    background: #fff;
    color: #2a1f5c;
    padding: 12px 16px;
    border-radius: 14px 14px 4px 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    max-width: 260px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 8px;
    animation: savetnik-teaser-pop 0.45s ease-out;
}
.savetnik-teaser.visible { display: flex; }
.savetnik-teaser-close {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    color: #9b8fbf;
    padding: 0;
    line-height: 1;
}
@keyframes savetnik-teaser-pop {
    0%   { opacity: 0; transform: translateY(8px) scale(0.94); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat panel */
.savetnik-panel {
    display: none;
    position: absolute;
    bottom: 0;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 60px);
    background: #0d0a1f;
    color: #e8e3ff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    flex-direction: column;
    animation: savetnik-panel-in 0.3s ease-out;
}
.savetnik-panel.open { display: flex; }
@keyframes savetnik-panel-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.savetnik-header {
    background: linear-gradient(135deg, #1a1438, #3a2a7a);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}
.savetnik-header-title {
    font-family: Georgia, serif;
    font-size: 18px;
    color: #d4af37;
    font-weight: 600;
}
.savetnik-header-sub {
    font-size: 12px;
    color: #9b8fbf;
    margin-top: 2px;
}
.savetnik-close {
    border: none;
    background: transparent;
    color: #9b8fbf;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.savetnik-close:hover { color: #fff; }

.savetnik-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.savetnik-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;
}
.savetnik-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #5a3a8b, #7a4ab8);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.savetnik-msg.assistant {
    align-self: flex-start;
    background: #1f1837;
    color: #e8e3ff;
    border-bottom-left-radius: 4px;
}
.savetnik-msg.system {
    align-self: center;
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: #1a1438;
    font-weight: 600;
    font-size: 13px;
    text-align: center;
    border-radius: 10px;
    padding: 10px 16px;
}

.savetnik-typing {
    align-self: flex-start;
    background: #1f1837;
    border-radius: 14px;
    padding: 10px 14px;
    margin: 0 16px 8px;
    display: flex;
    gap: 4px;
    width: fit-content;
}
.savetnik-typing[hidden] { display: none; }
.savetnik-typing span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #9b8fbf;
    animation: savetnik-bounce 1.2s infinite;
}
.savetnik-typing span:nth-child(2) { animation-delay: 0.2s; }
.savetnik-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes savetnik-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40%           { transform: translateY(-6px); opacity: 1; }
}

.savetnik-form {
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    padding: 12px;
    display: flex;
    gap: 8px;
    background: #0d0a1f;
    align-items: flex-end;
}
.savetnik-form textarea {
    flex: 1;
    background: #1f1837;
    color: #e8e3ff;
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
    line-height: 1.5;
}
.savetnik-form textarea:focus {
    outline: none;
    border-color: #d4af37;
}
.savetnik-form button[type=submit] {
    background: linear-gradient(135deg, #d4af37, #b8941f);
    border: none;
    color: #1a1438;
    width: 42px; height: 42px;
    border-radius: 10px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s;
}
.savetnik-form button[type=submit]:hover { transform: scale(1.05); }
.savetnik-form button[type=submit]:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.savetnik-foot {
    text-align: center;
    font-size: 11px;
    color: #6a5d8f;
    padding: 8px;
    background: #0d0a1f;
    border-top: 1px solid rgba(212, 175, 55, 0.08);
}

.savetnik-timer {
    text-align: center;
    font-size: 11px;
    color: #9b8fbf;
    padding: 6px 12px;
    background: rgba(212, 175, 55, 0.06);
    letter-spacing: 0.4px;
}
.savetnik-timer.warning { color: #d4af37; }

.savetnik-cta {
    align-self: stretch;
    margin: 6px 0;
    background: linear-gradient(135deg, #2a1f5c 0%, #4a2d7a 100%);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 14px;
    padding: 18px 18px 14px;
    color: #e8e3ff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    animation: savetnik-panel-in 0.3s ease-out;
}
.savetnik-cta-title {
    font-family: Georgia, serif;
    font-size: 15px;
    color: #d4af37;
    margin-bottom: 8px;
    font-weight: 600;
}
.savetnik-cta-msg {
    font-size: 13px;
    line-height: 1.55;
    color: #d4cce8;
    margin-bottom: 14px;
}
.savetnik-cta-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.savetnik-cta-btn {
    flex: 1;
    min-width: 130px;
    text-align: center;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.15s, box-shadow 0.15s;
    display: inline-block;
}
.savetnik-cta-btn-primary {
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: #1a1438;
    box-shadow: 0 3px 10px rgba(212, 175, 55, 0.4);
}
.savetnik-cta-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(212, 175, 55, 0.55);
}
.savetnik-cta-btn-soft {
    background: transparent;
    color: #d4cce8;
    border: 1px solid rgba(212, 175, 55, 0.4);
}
.savetnik-cta-btn-soft:hover { background: rgba(212, 175, 55, 0.08); }

.savetnik-mic {
    background: transparent;
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: #d4af37;
    width: 42px; height: 42px;
    border-radius: 10px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.savetnik-mic:hover { background: rgba(212, 175, 55, 0.08); }
.savetnik-mic.recording {
    background: linear-gradient(135deg, #b8324a, #d44a6b);
    border-color: transparent;
    color: #fff;
    animation: savetnik-pulse-mic 1.4s infinite ease-out;
}
@keyframes savetnik-pulse-mic {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 74, 107, 0.5); }
    50%      { box-shadow: 0 0 0 8px rgba(212, 74, 107, 0); }
}
.savetnik-mic[hidden] { display: none !important; }

@media (max-width: 480px) {
    .savetnik-root { bottom: 16px; right: 16px; }
    .savetnik-panel {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
    }
    .savetnik-teaser {
        right: 76px;
        max-width: 200px;
        font-size: 13px;
    }
}
