/* Asisten Virtual Ade Gumilar - V4: panel hampir setinggi layar dan area jawaban penuh */
#ag-ai-widget {
    font-family: Arial, sans-serif;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 99999;
    color: #26364a;
}

/* Tombol pembuka */
.ag-ai-launcher {
    border: 0;
    border-radius: 30px;
    background: #142b46;
    color: #fff;
    padding: 14px 20px;
    box-shadow: 0 8px 28px #0003;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}

/* Panel dipasang fixed agar header mulai dari bagian paling atas panel,
   tanpa ruang kosong besar di atas maupun di bawah. */
#ag-ai-widget .ag-ai-panel {
    position: fixed !important;
    top: 14px !important;
    right: 14px !important;
    bottom: 14px !important;
    left: auto !important;
    width: min(680px, calc(100vw - 28px)) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #d9dee5;
    border-radius: 16px;
    box-shadow: 0 12px 42px #10243b35;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#ag-ai-widget .ag-ai-panel[hidden] {
    display: none !important;
}

/* Header dan keterangan tetap di posisi atas */
#ag-ai-widget .ag-ai-header {
    flex: 0 0 auto;
    background: #142b46;
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ag-ai-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 50%;
    background: #d7b65d;
    color: #142b46;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 15px;
}

.ag-ai-heading {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    font-size: 15px;
}

.ag-ai-heading small {
    font-size: 12px;
    color: #dbe5ef;
}

.ag-ai-close {
    background: none;
    border: 0;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 5px;
}

#ag-ai-widget .ag-ai-notice {
    flex: 0 0 auto;
    padding: 10px 16px;
    background: #f5f6f8;
    color: #687386;
    font-size: 12px;
    line-height: 1.5;
    border-bottom: 1px solid #e8ebef;
}

/* Area pesan menggunakan seluruh ruang vertikal yang tersisa */
#ag-ai-widget .ag-ai-messages {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding: 16px 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    scroll-behavior: smooth;
    box-sizing: border-box;
}

/* Jawaban bot memakai seluruh lebar area pesan agar baris teks lebih panjang */
#ag-ai-widget .ag-ai-bubble {
    box-sizing: border-box;
    padding: 14px 16px;
    border-radius: 13px;
    font-size: 15px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

#ag-ai-widget .ag-ai-bot {
    align-self: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    background: #f0f2f5;
    color: #26364a;
}

#ag-ai-widget .ag-ai-user {
    align-self: flex-end;
    width: fit-content;
    max-width: 88%;
    background: #e8eef7;
    color: #1e3551;
}

.ag-ai-typing {
    flex: 0 0 auto;
    font-size: 13px;
    color: #7b8491;
    padding: 3px 2px;
}

/* Kolom input dan catatan menempel di bagian bawah panel */
#ag-ai-widget .ag-ai-form {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid #e8ebef;
    align-items: flex-end;
    background: #fff;
}

#ag-ai-widget .ag-ai-form textarea {
    font: 15px/1.5 Arial, sans-serif;
    resize: vertical;
    flex: 1;
    min-width: 0;
    min-height: 46px;
    max-height: 120px;
    border: 1px solid #d7dce3;
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
    box-sizing: border-box;
}

#ag-ai-widget .ag-ai-form textarea:focus {
    border-color: #8298b3;
    box-shadow: 0 0 0 3px #142b4612;
}

#ag-ai-widget .ag-ai-form button {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border: 0;
    border-radius: 50%;
    background: #142b46;
    color: #fff;
    font-size: 19px;
    cursor: pointer;
}

#ag-ai-widget .ag-ai-form button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

#ag-ai-widget .ag-ai-footnote {
    flex: 0 0 auto;
    text-align: center;
    padding: 0 10px 9px;
    font-size: 11px;
    color: #8a929e;
    background: #fff;
}

/* Ponsel: panel hampir memenuhi seluruh layar */
@media (max-width: 600px) {
    #ag-ai-widget {
        right: 8px;
        bottom: 8px;
    }

    #ag-ai-widget .ag-ai-panel {
        top: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        left: 8px !important;
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        border-radius: 14px;
    }

    #ag-ai-widget .ag-ai-messages {
        padding: 12px 10px 16px;
    }

    #ag-ai-widget .ag-ai-bot {
        width: 100% !important;
        max-width: 100% !important;
    }

    #ag-ai-widget .ag-ai-user {
        max-width: 92%;
    }
}