/* KV Library chatbot - external stylesheet for CSP compatibility */
.library-bot, .library-bot * { box-sizing: border-box; }

.library-bot {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1050;
    font-family: Arial, Helvetica, sans-serif;
    color: #202a25;
}

.bot-toggle {
    background: #155e45;
    color: #fff;
    border: 0;
    border-radius: 30px;
    padding: 14px 20px;
    box-shadow: 0 4px 15px #0003;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
}

.bot-toggle:hover, .bot-toggle:focus-visible { background: #104a36; }

.bot-panel {
    position: absolute;
    right: 0;
    bottom: 65px;
    width: min(390px, calc(100vw - 30px));
    height: min(590px, calc(100dvh - 110px));
    min-height: 350px;
    background: #fff;
    border: 1px solid #d8e1dc;
    border-radius: 16px;
    box-shadow: 0 8px 35px #0003;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bot-panel[hidden] { display: none !important; }

.bot-header {
    flex: 0 0 auto;
    background: #155e45;
    color: #fff;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.bot-subtitle { font-size: 12px; margin-top: 4px; opacity: .9; }

.bot-close {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
}

.bot-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    background: #f5f8f6;
    overscroll-behavior: contain;
}

.bot-bubble {
    position: relative;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.bot-reply {
    background: #fff;
    border: 1px solid #e0e8e3;
    margin-right: 18px;
}

.bot-user {
    background: #d9f3e6;
    border: 1px solid #c5e8d7;
    margin-left: 28px;
}

.bot-book-card { padding: 12px; }

.bot-book-title {
    display: block;
    color: #155e45;
    font-size: 15px;
    margin-bottom: 6px;
}

.bot-book-detail { margin-top: 2px; font-size: 13px; }
.bot-detail-label { font-weight: 700; }

.bot-book-cover {
    display: block;
    max-width: 90px;
    max-height: 125px;
    object-fit: contain;
    margin-top: 8px;
}

.bot-suggestions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 9px;
    border-top: 1px solid #e6ece8;
    background: #fff;
}

.bot-suggestions button {
    background: #fff;
    border: 1px solid #b8d5c6;
    color: #155e45;
    border-radius: 18px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
}

.bot-suggestions button:hover,
.bot-suggestions button:focus-visible { background: #eaf6ef; }

.bot-form {
    flex: 0 0 auto;
    display: flex;
    padding: 10px;
    gap: 8px;
    border-top: 1px solid #ddd;
    background: #fff;
}

.bot-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid #cbd5cf;
    border-radius: 22px;
    padding: 11px 13px;
    font-size: 14px;
    outline-offset: 2px;
}

.bot-form input:focus { border-color: #155e45; }

.bot-form button {
    flex: 0 0 42px;
    background: #155e45;
    color: #fff;
    border: 0;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    cursor: pointer;
    font-size: 18px;
}

.bot-form button:disabled { opacity: .55; cursor: wait; }

.bot-status {
    flex: 0 0 auto;
    font-size: 11px;
    color: #52665a;
    padding: 0 12px 5px;
    background: #fff;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 480px) {
    .library-bot { right: 10px; bottom: 10px; }
    .bot-panel {
        position: fixed;
        right: 10px;
        bottom: 72px;
        width: calc(100vw - 20px);
        height: min(650px, calc(100dvh - 95px));
    }
}
