/* Chatbot MTsN 1 */
.mtsn-chatbot {
    position: fixed;
    bottom: 22px;
    z-index: 99990;
    font-family: 'Roboto', system-ui, sans-serif;
}
.mtsn-chatbot.is-right { right: 22px; }
.mtsn-chatbot.is-left { left: 22px; }

.mtsn-chatbot-fab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--theme-primary, #006838), #007a3d);
    color: #fff;
    box-shadow: 0 8px 28px rgba(0, 80, 40, .35);
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: transform .2s, box-shadow .2s;
}
.mtsn-chatbot-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0, 80, 40, .4); }
.mtsn-chatbot-fab i { font-size: 18px; }

.mtsn-chatbot-panel {
    position: absolute;
    bottom: calc(100% + 12px);
    width: min(380px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 120px));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(15, 35, 25, .22);
    border: 1px solid rgba(0, 104, 56, .12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mtsn-chatbot.is-right .mtsn-chatbot-panel { right: 0; }
.mtsn-chatbot.is-left .mtsn-chatbot-panel { left: 0; }
.mtsn-chatbot-panel[hidden] { display: none !important; }

.mtsn-chatbot-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--theme-primary, #006838), var(--theme-gold, #c9a227));
    color: #fff;
}
.mtsn-chatbot-head-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mtsn-chatbot-avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.mtsn-chatbot-title { margin: 0; font-size: 15px; font-weight: 800; line-height: 1.25; }
.mtsn-chatbot-status { margin: 2px 0 0; font-size: 11px; opacity: .92; display: flex; align-items: center; gap: 6px; }
.mtsn-chatbot-dot { width: 7px; height: 7px; border-radius: 50%; background: #7fff9a; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.mtsn-chatbot-close {
    border: none; background: rgba(255,255,255,.18); color: #fff; width: 34px; height: 34px;
    border-radius: 50%; cursor: pointer; flex-shrink: 0;
}

.mtsn-chatbot-messages {
    flex: 1; overflow-y: auto; padding: 16px; background: #f6faf7;
    display: flex; flex-direction: column; gap: 12px;
}

.mtsn-chatbot-msg {
    max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.55;
    white-space: pre-wrap; word-break: break-word;
}
.mtsn-chatbot-msg.is-user {
    align-self: flex-end; background: var(--theme-primary, #006838); color: #fff;
    border-bottom-right-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 4px 6px;
}
.mtsn-chatbot-msg-text { flex: 1 1 auto; min-width: 0; }
.mtsn-chatbot-ticks {
    flex-shrink: 0;
    font-size: 11px;
    line-height: 1;
    letter-spacing: -2px;
    opacity: 0.72;
    user-select: none;
}
.mtsn-chatbot-ticks.is-read {
    opacity: 1;
    color: #9ef0c0;
}
.mtsn-chatbot-msg.is-bot {
    align-self: flex-start; background: #fff; color: #243328;
    border: 1px solid #e2ece6; border-bottom-left-radius: 4px;
}
.mtsn-chatbot-msg.is-admin {
    align-self: flex-start; background: #fff8e1; color: #3e320f;
    border: 1px solid var(--theme-gold, #c9a227); border-bottom-left-radius: 4px;
}
.mtsn-chatbot.is-human-mode .mtsn-chatbot-status::after {
    content: ' · Petugas';
    color: var(--theme-gold, #c9a227);
    font-weight: 600;
}
.mtsn-chatbot-chip-human {
    border-color: var(--theme-gold, #c9a227);
    background: #fffdf5;
}
.mtsn-chatbot-msg.is-typing { opacity: .7; font-style: italic; }

.mtsn-chatbot-msg.is-typing-indicator {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fff8e1;
    border: 1px solid var(--theme-gold, #c9a227);
    border-bottom-left-radius: 4px;
    max-width: 88%;
}
.mtsn-chatbot-typing-label {
    font-size: 12px;
    color: #5c4a12;
    font-style: italic;
}
.mtsn-chatbot-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 14px;
}
.mtsn-chatbot-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--theme-gold, #c9a227);
    animation: mtsn-chatbot-typing-bounce 1.2s infinite ease-in-out;
}
.mtsn-chatbot-typing-dots span:nth-child(1) { animation-delay: 0s; }
.mtsn-chatbot-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.mtsn-chatbot-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes mtsn-chatbot-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.mtsn-chatbot-sources { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #dce8e0; }
.mtsn-chatbot-sources p { margin: 0 0 4px; font-size: 11px; font-weight: 700; color: #5a6b60; }
.mtsn-chatbot-sources a {
    display: block; font-size: 11px; color: var(--theme-primary, #006838); text-decoration: none; margin-bottom: 2px;
}
.mtsn-chatbot-sources a:hover { text-decoration: underline; }

.mtsn-chatbot-suggestions {
    display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; background: #f6faf7;
}
.mtsn-chatbot-suggestions:empty { display: none; padding: 0; }
.mtsn-chatbot-chip {
    border: 1px solid #cfe0d4; background: #fff; color: #2a4036;
    border-radius: 999px; padding: 5px 10px; font-size: 11px; cursor: pointer; line-height: 1.3;
}
.mtsn-chatbot-chip:hover { border-color: var(--theme-gold, #c9a227); color: #5c4a12; }

.mtsn-chatbot-form {
    padding: 12px; border-top: 1px solid #e8efe9; background: #fff;
}
.mtsn-chatbot-compose { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.mtsn-chatbot-compose-row { display: flex; align-items: flex-end; gap: 8px; }
.mtsn-chatbot-attach-btn {
    width: 38px; height: 38px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid #d5e3d9; border-radius: 50%; background: #f6faf7; color: #3d5c4a; cursor: pointer;
}
.mtsn-chatbot-attach-btn:hover { border-color: var(--theme-gold, #c9a227); color: #5c4a12; }
.mtsn-chatbot-attach-preview {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.mtsn-chatbot-attach-preview[hidden] { display: none !important; }
.mtsn-chatbot-attach-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; background: #f0f7f3;
    border: 1px solid #cfe0d4; border-radius: 8px; font-size: 11px; max-width: 100%;
}
.mtsn-chatbot-attach-chip img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
.mtsn-chatbot-attach-chip button {
    border: none; background: none; color: #c62828; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px;
}
.mtsn-chatbot-attachments { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.mtsn-chatbot-attachments img {
    max-width: 200px; max-height: 160px; border-radius: 8px; display: block; border: 1px solid rgba(255,255,255,.25);
}
.mtsn-chatbot-msg.is-user .mtsn-chatbot-attachments img { border-color: rgba(255,255,255,.35); }
.mtsn-chatbot-attach-file {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: inherit;
    text-decoration: underline; word-break: break-all;
}
.mtsn-chatbot-input {
    flex: 1; border: 1px solid #d5e3d9; border-radius: 14px; padding: 10px 14px; font-size: 13px; outline: none;
    resize: none; min-height: 42px; max-height: 120px; line-height: 1.45; font-family: inherit;
}
.mtsn-chatbot-input:focus { border-color: var(--theme-primary, #006838); box-shadow: 0 0 0 3px rgba(0,104,56,.12); }
.mtsn-chatbot-send {
    width: 42px; height: 42px; border: none; border-radius: 50%;
    background: var(--theme-gold, #c9a227); color: #fff; cursor: pointer; flex-shrink: 0;
}
.mtsn-chatbot-send:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 480px) {
    .mtsn-chatbot { bottom: 14px; }
    .mtsn-chatbot.is-right { right: 14px; }
    .mtsn-chatbot.is-left { left: 14px; }
    .mtsn-chatbot-fab-label { display: none; }
    .mtsn-chatbot-fab { width: 52px; height: 52px; padding: 0; justify-content: center; border-radius: 50%; }
    .mtsn-chatbot-panel {
        position: fixed; inset: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; bottom: 0;
    }
}

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
