/* Smart Materna Chatbot */
.sm-chatbot {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1080;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.admin-materna .sm-chatbot {
    bottom: 1.25rem;
    right: 1.25rem;
}

/* naikkan di atas bottom-nav mandiri / admin mobile */
body:has(.bottom-nav) .sm-chatbot,
body:has(.admin-bottom-nav) .sm-chatbot {
    bottom: 4.75rem;
}

@media (min-width: 992px) {
    .admin-materna .sm-chatbot {
        bottom: 1.25rem;
    }
}

.sm-chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #e91e8c, #9c27b0);
    color: #fff;
    font-size: 1.35rem;
    box-shadow: 0 8px 24px rgba(233, 30, 140, .35);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm-chatbot-toggle:hover {
    transform: scale(1.05);
}

.sm-chatbot-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(233, 30, 140, .45);
    animation: smChatPulse 2s ease-out infinite;
    pointer-events: none;
}

@keyframes smChatPulse {
    0% { transform: scale(.9); opacity: .8; }
    100% { transform: scale(1.35); opacity: 0; }
}

.sm-chatbot-panel {
    position: absolute;
    right: 0;
    bottom: 70px;
    width: min(360px, calc(100vw - 1.5rem));
    height: min(480px, calc(100vh - 8rem));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.sm-chatbot-header {
    background: linear-gradient(135deg, #e91e8c, #9c27b0);
    color: #fff;
    padding: .85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
}

.sm-chatbot-sub {
    font-size: .7rem;
    opacity: .85;
    margin-top: .15rem;
}

.sm-chatbot-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .25rem;
}

.sm-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: .85rem;
    background: #f7f8fa;
}

.sm-chat-bubble {
    max-width: 88%;
    margin-bottom: .65rem;
    padding: .65rem .8rem;
    border-radius: 14px;
    font-size: .88rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.sm-chat-bubble.bot {
    background: #fff;
    color: #333;
    border: 1px solid #eee;
    border-bottom-left-radius: 4px;
}

.sm-chat-bubble.user {
    background: #e91e8c;
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.sm-chat-bubble.typing {
    color: #888;
    font-style: italic;
}

.sm-chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    padding: .4rem .75rem;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    max-height: 72px;
    overflow-y: auto;
}

.sm-chat-chip {
    border: 1px solid #f3c6df;
    background: #fce4f0;
    color: #c2187a;
    border-radius: 50px;
    padding: .25rem .65rem;
    font-size: .72rem;
    cursor: pointer;
    white-space: nowrap;
}

.sm-chat-chip:hover {
    background: #e91e8c;
    color: #fff;
    border-color: #e91e8c;
}

.sm-chatbot-form {
    display: flex;
    gap: .4rem;
    padding: .65rem .75rem;
    background: #fff;
    border-top: 1px solid #eee;
}

.sm-chatbot-form input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 50px;
    padding: .55rem .9rem;
    font-size: .88rem;
    outline: none;
}

.sm-chatbot-form input:focus {
    border-color: #e91e8c;
    box-shadow: 0 0 0 3px rgba(233, 30, 140, .12);
}

.sm-chatbot-form button {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #e91e8c;
    color: #fff;
    cursor: pointer;
}

.sm-chatbot-form button:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.sm-chatbot-disclaimer {
    font-size: .65rem;
    color: #999;
    text-align: center;
    padding: 0 .75rem .5rem;
    background: #fff;
}

@media (max-width: 576px) {
    .sm-chatbot-panel {
        height: min(70vh, 520px);
    }
}
