/* =============================
   CHAT BUTTON
============================= */
#chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1e8f4d;
    color: #fff;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    text-align: center;
    line-height: 55px;
    font-size: 22px;
    cursor: pointer;
    z-index: 2147483647;
    transition: 0.3s;
}

/* Notifikasi merah */
#chat-button.notif {
    background: #dc2626;
    animation: pulseChat 1s infinite;
}

/* Titik notif */
#chat-button::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    display: none;
}

#chat-button.notif::after {
    display: block;
}

@keyframes pulseChat {
    0% { box-shadow: 0 0 0 0 rgba(220,38,38,0.7); }
    70% { box-shadow: 0 0 0 12px rgba(220,38,38,0); }
    100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}


/* =============================
   CHAT WIDGET
============================= */
#chat-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,.25);
    display: none;
    flex-direction: column;
    z-index: 2147483647;
}

/* Header */
#chat-header {
    background: #1e8f4d;
    color: #fff;
    padding: 12px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

/* Body */
#chat-body {
    padding: 12px;
    height: 260px;
    overflow-y: auto;
    font-size: 14px;
    background: #f9fafb;
}

/* Input */
#chat-input {
    display: flex;
    border-top: 1px solid #eee;
}

#chat-input input {
    flex: 1;
    border: none;
    padding: 10px;
    outline: none;
    font-size: 14px;
}

#chat-input button {
    background: #1e8f4d;
    color: #fff;
    border: none;
    padding: 0 15px;
    cursor: pointer;
}


/* =============================
   CHAT BUBBLE SYSTEM
============================= */
.chat {
    display: flex;
    margin: 8px 0;
}

/* Posisi kiri/kanan */
.chat.pengunjung {
    justify-content: flex-end;
}

.chat.admin {
    justify-content: flex-start;
}

.chat.sistem {
    justify-content: center;
}

/* Bubble */
.bubble {
    position: relative;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 75%;
    word-wrap: break-word;
    font-size: 14px;
}

/* Warna bubble */
.chat.pengunjung .bubble {
    background: #2563eb;
    color: #fff;
}

.chat.admin .bubble {
    background: #16a34a;
    color: #fff;
}

.chat.sistem .bubble {
    background: #eee;
    color: #333;
    font-size: 13px;
}

/* Waktu */
.chat-time {
    font-size: 11px;
    opacity: 0.8;
    text-align: right;
    margin-top: 4px;
}


/* =============================
   IMAGE CHAT
============================= */
.chat-image {
    max-width: 180px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 5px;
}


/* =============================
   IMAGE PREVIEW MODAL
============================= */
#imagePreviewModal {
    display: none;
    position: fixed;
    z-index: 2147483647;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
}

#imagePreviewModal img {
    max-width: 90%;
    max-height: 85%;
    border-radius: 10px;
}

#closePreview {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 30px;
    color: #fff;
    cursor: pointer;
}

.chat.sistem {
    justify-content: center;
}

.chat.sistem .bubble {
    background: #e5e7eb;
    color: #444;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
}

