/* =============================================
   Kemp AI Poradce – Chat Widget Styles
   ============================================= */

:root {
    --kaip-primary: #2e7d32;
    --kaip-primary-dark: #1b5e20;
    --kaip-primary-light: #e8f5e9;
    --kaip-bg: #ffffff;
    --kaip-text: #212121;
    --kaip-msg-user-bg: var(--kaip-primary);
    --kaip-msg-user-color: #fff;
    --kaip-msg-bot-bg: #f1f1f1;
    --kaip-msg-bot-color: #212121;
    --kaip-radius: 16px;
    --kaip-shadow: 0 8px 32px rgba(0,0,0,.18);
    --kaip-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Floating widget ── */
.kaip-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: var(--kaip-font);
}

.kaip-bubble {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    background: linear-gradient(150deg, #43a047, #1b5e20);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow:
        0 4px 18px rgba(46,125,50,.5),
        0 1px 3px rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 6px 6px;
    box-sizing: border-box;
    transition: transform .2s ease, box-shadow .2s ease;
    position: relative;
    z-index: 2;
}
.kaip-bubble:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(46,125,50,.6), 0 2px 6px rgba(0,0,0,.2);
}
.kaip-bubble:active {
    transform: scale(.96);
}

/* Ikona stavu "zavřeno" */
.kaip-bubble-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1;
    width: 100%;
}
.kaip-bubble-icon .kaip-icon-main {
    font-size: 22px;
    line-height: 1;
    display: block;
}
.kaip-bubble-icon .kaip-icon-label {
    font-size: 7px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    opacity: .88;
    font-family: var(--kaip-font);
}

/* Ikona stavu "otevřeno" – X */
.kaip-bubble-close {
    display: none;
    font-size: 19px;
    line-height: 1;
}

.kaip-widget.kaip-open .kaip-bubble-icon  { display: none; }
.kaip-widget.kaip-open .kaip-bubble-close { display: block; }
.kaip-widget.kaip-open .kaip-bubble       { border-radius: 50%; width: 48px; height: 48px; padding: 0; }

/* Panel */
.kaip-panel {
    position: absolute;
    bottom: 74px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: var(--kaip-bg);
    border-radius: var(--kaip-radius);
    box-shadow: var(--kaip-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(.97);
    transition: opacity .22s ease, transform .22s ease;
}
.kaip-widget.kaip-open .kaip-panel {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}
.kaip-widget.kaip-closed .kaip-panel {
    display: none;
}

/* Header */
.kaip-panel-header {
    background: var(--kaip-primary);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.kaip-bot-avatar { font-size: 28px; flex-shrink: 0; }
.kaip-panel-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.kaip-panel-sub  { font-size: 11px; opacity: .8; }
.kaip-panel-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: .75;
    transition: opacity .15s;
}
.kaip-panel-close:hover { opacity: 1; }

/* Messages */
.kaip-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    min-height: 260px;
    max-height: 340px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.kaip-msg {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
    animation: kaipFadeIn .18s ease;
}
@keyframes kaipFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.kaip-msg-bot {
    align-self: flex-start;
    background: var(--kaip-msg-bot-bg);
    color: var(--kaip-msg-bot-color);
    border-bottom-left-radius: 4px;
}
.kaip-msg-user {
    align-self: flex-end;
    background: var(--kaip-msg-user-bg);
    color: var(--kaip-msg-user-color);
    border-bottom-right-radius: 4px;
}
.kaip-msg-typing {
    align-self: flex-start;
    background: var(--kaip-msg-bot-bg);
    color: #888;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.kaip-typing-dots span {
    display: inline-block;
    width: 6px; height: 6px;
    background: #888;
    border-radius: 50%;
    margin: 0 2px;
    animation: kaipDot 1.2s infinite;
}
.kaip-typing-dots span:nth-child(2) { animation-delay: .2s; }
.kaip-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes kaipDot {
    0%,80%,100% { transform: scale(.8); opacity:.5; }
    40%         { transform: scale(1.2); opacity:1; }
}

/* Input row */
.kaip-input-row {
    display: flex;
    border-top: 1px solid #e0e0e0;
    padding: 8px 10px;
    gap: 6px;
    align-items: center;
}
.kaip-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 22px;
    padding: 9px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
    font-family: var(--kaip-font);
}
.kaip-input:focus { border-color: var(--kaip-primary); }
.kaip-send {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--kaip-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}
.kaip-send:hover { background: var(--kaip-primary-dark); }
.kaip-send:disabled { opacity: .5; cursor: default; }

.kaip-footer-note {
    text-align: center;
    font-size: 10px;
    color: #aaa;
    padding: 2px 0 6px;
}

/* ── Inline (shortcode) ── */
.kaip-inline {
    border: 1px solid #ddd;
    border-radius: var(--kaip-radius);
    overflow: hidden;
    font-family: var(--kaip-font);
    max-width: 600px;
    margin: 20px auto;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.kaip-inline-header {
    background: var(--kaip-primary);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.kaip-bot-title { font-weight: 700; font-size: 16px; }
.kaip-bot-sub   { font-size: 11px; opacity: .8; margin-left: auto; }

.kaip-inline .kaip-messages {
    max-height: 400px;
    min-height: 200px;
    background: #fafafa;
}
.kaip-inline .kaip-input-row {
    background: #fff;
}

/* Responsive */
@media (max-width: 480px) {
    .kaip-widget {
        bottom: 16px;
        right: 16px;
    }
    .kaip-panel {
        width: calc(100vw - 32px);
        right: -8px;
    }
}
