
/* =============================================
   CYLO - CHATBOT PERPUSTAKAAN UNIVERSITAS DINAMIKA
   Modal Tengah - Desktop & Mobile
   ============================================= */

/* Tombol avatar di kanan bawah */
#cylo-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99998;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 52px;
    height: 52px;
    padding: 3px;

    border: none;
    border-radius: 50%;
    background: #ffffff;

    box-shadow: 0 4px 18px rgba(0,0,0,0.25);
    cursor: pointer;
    transition: transform 0.2s ease;
}

#cylo-launcher:hover {
    transform: scale(1.07);
}

#cylo-launcher img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Jendela chatbot utama */
#cylo-modal {
    display: none;
    padding: 0;
    border: 0;
    margin: auto;
    inset: 0;
    max-width: calc(100% - 2rem);
    color: #292426;
    font: inherit;
    flex-direction: column;

    width: min(950px, 100%);
    height: 85vh;
    height: 85dvh;
    max-height: 900px;

    overflow: hidden;
    box-sizing: border-box;
    border-radius: 18px;
    background: #F8F8F8;

    box-shadow: 0 20px 65px rgba(0,0,0,0.30);
}

/* Header popup */
#cylo-header {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 12px;

    padding: 14px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

#cylo-header-avatar {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}

#cylo-header-info {
    flex: 1;
    min-width: 0;

    font-family: Arial, sans-serif;
    line-height: 1.4;
}

#cylo-header-info strong {
    display: block;
    margin: 0;
    color: #222222;
    font-size: 17px;
    font-weight: 700;
}

#cylo-header-info span {
    display: block;
    margin-top: 3px;
    color: #666666;
    font-size: 12px;
}

/* Tombol tutup */
#cylo-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    width: 38px;
    height: 38px;
    padding: 0;

    border: 0;
    border-radius: 50%;
    background: #f1f2f4;
    color: #333333;

    font-family: Arial, sans-serif;
    font-size: 25px;
    line-height: 1;

    cursor: pointer;
}

#cylo-close:hover {
    background: #e5e7eb;
}

#cylo-close:focus-visible,
#cylo-launcher:focus-visible {
    outline: 3px solid #ed1c24;
    outline-offset: 2px;
}

#cylo-modal[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
#cylo-modal::backdrop { background: rgb(0 0 0 / .65); }
body:has(#cylo-modal[open]) { overflow: hidden; }
body:has(#cylo-modal[open]) #dnmkChatTooltip { visibility: hidden; }
#cylo-modal .conversation { position: relative; min-height: 0; background: white; }
#cylo-modal #messages { height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 1rem; padding: 1rem; }
#cylo-modal .message { font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
#cylo-modal .message:not(.mine) { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .6rem; }
#cylo-modal .message-avatar { width: 2rem; height: 2rem; border-radius: 50%; object-fit: cover; }
#cylo-modal .message.mine { align-self: end; max-width: 85%; position: relative; margin-right: .4rem; padding: .55rem .8rem; background: #fce7e8; border-radius: 1rem 1rem .25rem 1rem; white-space: pre-wrap; }
#cylo-modal .message.mine::after { content: ""; position: absolute; right: -.5rem; bottom: 0; width: .7rem; height: .65rem; background: inherit; clip-path: polygon(0 0, 30% 0, 50% 55%, 100% 100%, 0 100%); }
#cylo-modal .cylo-composer { padding: .75rem; border-top: 1px solid #eadfe0; background: #fff8f8; }
#cylo-modal .composer { display: flex; gap: .5rem; align-items: end; border: 1px solid #ddd2d3; border-radius: .8rem; padding: .5rem; background: white; }
#cylo-modal textarea { width: 100%; min-width: 0; margin: 0; border: 0; background: white; outline: none; resize: vertical; }
#cylo-modal textarea, #cylo-modal .send { font: inherit; font-size: .875rem; }
#cylo-modal .send { border: 0; border-radius: .6rem; background: #eff1f3; padding: .5rem .8rem; }
#cylo-modal .credits { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; margin-top: .5rem; font-size: .75rem; }
#cylo-modal #scroll-latest { position: absolute; bottom: .6rem; left: 50%; transform: translateX(-50%); width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 1px solid #ddd2d3; background: white; color: #a4151b; }
#cylo-modal #scroll-latest[hidden] { display: none; }
#cylo-modal .reply > * { margin: 0; color: inherit; }
#cylo-modal .reply > * + * { margin-top: .65rem; }
#cylo-modal .reply ul, #cylo-modal .reply ol { padding-left: 1.4em; }
#cylo-modal .reply ul { list-style: disc; }
#cylo-modal .reply ol { list-style: decimal; }
#cylo-modal .reply h3 { font-size: 1.15em; }
#cylo-modal .reply a { color: #a4151b; text-decoration: underline; }
#cylo-modal .reply-table { overflow-x: auto; border: 1px solid #ddd2d3; border-radius: .6rem; }
#cylo-modal table { width: 100%; border-collapse: collapse; }
#cylo-modal th, #cylo-modal td { text-align: left; border: 1px solid #ddd2d3; padding: .45rem; }
#cylo-modal th { background: #f5f2f2; }
#cylo-modal .answer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin-top: .45rem; }
#cylo-modal .answer-actions button { background: transparent; border: 0; color: #675a5c; padding: .3rem; }
#cylo-modal .answer-actions button:hover, #cylo-modal [aria-pressed="true"] { background: #fce7e8; color: #a4151b; }
#cylo-modal .answer-actions svg { width: 1.125rem; height: 1.125rem; }
#cylo-modal .answer-actions output, #cylo-modal .pending { font-size: .8rem; }

/* Tampilan mobile */
@media (max-width: 600px) {

    #cylo-modal {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        max-width: none;
        border-radius: 0;
    }

    #cylo-header {
        padding: 12px 15px;
    }

    #cylo-header-avatar {
        width: 38px;
        height: 38px;
    }

    #cylo-header-info strong {
        font-size: 16px;
    }

    #cylo-header-info span {
        font-size: 11px;
    }

    #cylo-launcher {
        right: 16px;
        bottom: 16px;
        width: 58px;
        height: 58px;
    }
}
