/* ai_savetnik.css - Floating AI savetnik widget (desno dole) */

.mk-ai-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99999;
    font-family: 'PT Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: #222;
}

.mk-ai-widget * {
    box-sizing: border-box;
}

/* Floating dugme */
.mk-ai-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-mk, #DB2B30);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.mk-ai-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    background: #b92024;
}

.mk-ai-toggle svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Chat prozor */
.mk-ai-panel {
    display: none;
    flex-direction: column;
    width: 390px;
    max-width: calc(100vw - 24px);
    height: 680px;
    max-height: calc(100vh - 48px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.24);
    border: 1px solid #e2e2e2;
    overflow: hidden;
    margin-bottom: 12px;
    transition: height 0.25s ease;
}

.mk-ai-widget.is-compact .mk-ai-panel {
    height: 340px;
}

.mk-ai-widget.is-open .mk-ai-panel {
    display: flex;
    margin-bottom: 0;
}

.mk-ai-widget.is-open .mk-ai-toggle {
    display: none;
}

/* Header */
.mk-ai-header {
    background: var(--bg-mk, #DB2B30);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.mk-ai-header-info {
    display: flex;
    flex-direction: column;
}

.mk-ai-header-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.mk-ai-header-sub {
    font-size: 12px;
    opacity: 0.9;
}

.mk-ai-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mk-ai-icon-btn {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.mk-ai-icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Poruke */
.mk-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f7f7f8;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mk-ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 90%;
}

.mk-ai-msg.is-user {
    align-self: flex-end;
    align-items: flex-end;
}

.mk-ai-msg.is-bot {
    align-self: flex-start;
    align-items: flex-start;
    max-width: 96%;
}

.mk-ai-bubble {
    padding: 10px 13px;
    border-radius: 12px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.mk-ai-msg.is-user .mk-ai-bubble {
    background: var(--bg-mk, #DB2B30);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.mk-ai-msg.is-bot .mk-ai-bubble {
    background: #fff;
    color: #222;
    border: 1px solid #e5e5e5;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Brzi predlozi */
.mk-ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.mk-ai-chip {
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 999px;
    padding: 6px 11px;
    font-size: 12.5px;
    color: #333;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    text-align: left;
}

.mk-ai-chip:hover {
    border-color: var(--bg-mk, #DB2B30);
    color: var(--bg-mk, #DB2B30);
    background: #fff5f5;
}

/* Kartice knjiga u odgovoru */
.mk-ai-books {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}

.mk-ai-book-card {
    display: flex;
    gap: 10px;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    padding: 8px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.mk-ai-book-card:hover {
    border-color: var(--bg-mk, #DB2B30);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.mk-ai-book-img {
    width: 54px;
    height: 76px;
    object-fit: cover;
    border-radius: 4px;
    background: #f0f0f0;
    flex-shrink: 0;
}

.mk-ai-book-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    flex: 1;
}

.mk-ai-book-title {
    font-weight: 700;
    font-size: 13.5px;
    color: #111;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mk-ai-book-author {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mk-ai-book-price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.mk-ai-price-old {
    font-size: 12px;
    color: #888;
    text-decoration: line-through;
}

.mk-ai-price-now {
    font-size: 14px;
    font-weight: 700;
    color: var(--bg-mk, #DB2B30);
}

.mk-ai-discount-badge {
    font-size: 11px;
    font-weight: 700;
    background: #fdebec;
    color: var(--bg-mk, #DB2B30);
    padding: 1px 5px;
    border-radius: 4px;
}

/* Typing indikator */
.mk-ai-typing {
    font-size: 12.5px;
    color: #666;
    font-style: italic;
    padding: 4px 2px;
}

/* Input forma */
.mk-ai-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.mk-ai-input {
    flex: 1;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.mk-ai-input:focus {
    border-color: var(--bg-mk, #DB2B30);
}

.mk-ai-send {
    background: var(--bg-mk, #DB2B30);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 14px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.mk-ai-send:hover:not(:disabled) {
    background: #b92024;
}

.mk-ai-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Mobilni prikaz */
@media (max-width: 600px) {
    .mk-ai-widget {
        right: 12px;
        bottom: 12px;
    }

    .mk-ai-panel {
        width: calc(100vw - 24px);
        height: 82vh;
        height: 82dvh;
        max-height: calc(100dvh - 32px);
    }

    .mk-ai-widget.is-compact .mk-ai-panel {
        height: 42vh;
        height: 42dvh;
    }
}
