/* JURNAL AI — Professional floating news assistant */
#jurnal-ai-widget {
    --jai-red: #c7191f;
    --jai-ink: #171717;
    --jai-muted: #737373;
    --jai-line: #e8e8e8;
    font-family: inherit;
}

#jurnal-ai-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999990;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 13px 19px;
    border: 0;
    border-radius: 999px;
    background: var(--jai-red);
    color: #fff;
    box-shadow: 0 7px 24px rgba(0,0,0,.22);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .2s ease, background .2s ease;
}
#jurnal-ai-toggle:hover { background: #a91419; transform: translateY(-2px); }
#jurnal-ai-toggle:focus-visible,
#jurnal-ai-window button:focus-visible,
#jurnal-ai-input:focus-visible { outline: 2px solid #111; outline-offset: 3px; }
.jai-bubble-icon { font-size: 21px; line-height: 1; }

#jurnal-ai-window {
    position: fixed;
    right: 24px;
    bottom: 86px;
    z-index: 999991;
    display: none;
    flex-direction: column;
    width: 380px;
    max-width: calc(100vw - 28px);
    height: 570px;
    max-height: calc(100dvh - 110px);
    overflow: hidden;
    border: 1px solid var(--jai-line);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 14px 48px rgba(0,0,0,.2);
}
#jurnal-ai-window.jai-open { display: flex; animation: jai-enter .18s ease-out; }
@keyframes jai-enter {
    from { opacity: 0; transform: translateY(9px); }
    to { opacity: 1; transform: translateY(0); }
}

.jai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    padding: 15px 16px;
    background: var(--jai-ink);
    color: #fff;
}
.jai-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.jai-logo {
    display: grid;
    place-items: center;
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    border-radius: 9px;
    background: var(--jai-red);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
}
.jai-brand-copy strong { display: block; color: #fff; font-size: 14px; line-height: 1.3; }
.jai-brand-copy small { display: block; margin-top: 3px; color: #d1d1d1; font-size: 10px; }
#jurnal-ai-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
#jurnal-ai-close:hover { background: rgba(255,255,255,.12); }

.jai-welcome {
    flex: 0 0 auto;
    padding: 15px 16px 13px;
    border-bottom: 1px solid var(--jai-line);
    background: #fff;
}
.jai-welcome > strong { color: var(--jai-ink); font-size: 13px; }
.jai-welcome p { margin: 6px 0 12px; color: var(--jai-muted); font-size: 11px; line-height: 1.55; }
.jai-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.jai-suggestions button {
    padding: 7px 10px;
    border: 1px solid #ead0d1;
    border-radius: 20px;
    background: #fff;
    color: var(--jai-red);
    font: inherit;
    font-size: 10px;
    cursor: pointer;
}
.jai-suggestions button:hover { background: #fff3f3; }

#jurnal-ai-messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    gap: 10px;
    overflow-y: auto;
    padding: 14px;
    background: #f8f8f8;
}
.jai-message { display: flex; width: 100%; }
.jai-message.user { justify-content: flex-end; }
.jai-message.ai { justify-content: flex-start; }
.jai-message-content {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}
.jai-message.user .jai-message-content {
    border-bottom-right-radius: 3px;
    background: var(--jai-red);
    color: #fff;
}
.jai-message.ai .jai-message-content {
    border: 1px solid var(--jai-line);
    border-bottom-left-radius: 3px;
    background: #fff;
    color: #303030;
}
.jai-message-content a { display: inline-block; margin-top: 5px; color: var(--jai-red); text-decoration: underline; }
.jai-message-content a:hover { color: #8f1015; }
.jai-message-content .jai-source-date { display: block; color: var(--jai-muted); font-size: 10px; }

.jai-input-area {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-end;
    gap: 8px;
    margin: 0;
    padding: 11px 12px 8px;
    border-top: 1px solid var(--jai-line);
    background: #fff;
}
#jurnal-ai-input {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    max-height: 90px;
    min-height: 40px;
    resize: none;
    box-sizing: border-box;
    padding: 10px 11px;
    border: 1px solid #ddd;
    border-radius: 9px;
    background: #fff;
    color: #222;
    font: inherit;
    font-size: 12px;
    line-height: 1.45;
}
#jurnal-ai-input:focus { border-color: var(--jai-red); outline: none; }
#jurnal-ai-send {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 0;
    border-radius: 9px;
    background: var(--jai-red);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}
#jurnal-ai-send:disabled { opacity: .55; cursor: wait; }
.jai-disclaimer {
    flex: 0 0 auto;
    padding: 0 10px 9px;
    background: #fff;
    color: #999;
    font-size: 9px;
    text-align: center;
}

@media (max-width: 480px) {
    #jurnal-ai-toggle { right: 15px; bottom: 15px; padding: 12px 16px; }
    #jurnal-ai-window {
        right: 10px;
        bottom: 75px;
        width: calc(100vw - 20px);
        height: min(590px, calc(100dvh - 90px));
        max-height: calc(100dvh - 90px);
    }
}
