/* ================================================================
   chat-widget.css — Tampilan widget live chat markiel-olshop
   Menyesuaikan tema situs (aksen #3498db) & mendukung dark mode.
   ================================================================ */

#mk-chat * { box-sizing: border-box; }

#mk-chat {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

/* ---------- Tombol mengambang ---------- */
#mk-chat-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: #3498db;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(52, 152, 219, .45);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, background .2s, box-shadow .2s;
}
#mk-chat-launcher:hover { background: #2980b9; transform: scale(1.06); }
#mk-chat-launcher.mk-open { background: #2c3e50; }

/* Titik notifikasi balasan baru */
#mk-chat-badge {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    background: #e74c3c;
    color: #fff;
    border-radius: 9px;
    font-size: 11px; font-weight: 700;
    display: none;
    align-items: center; justify-content: center;
    border: 2px solid #fff;
}
#mk-chat-badge.mk-show { display: flex; }

/* ---------- Panel chat ---------- */
#mk-chat-panel {
    position: fixed;
    right: 20px;
    bottom: 92px;
    width: 350px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .2s, transform .2s;
}
#mk-chat-panel.mk-open { display: flex; opacity: 1; transform: translateY(0); }

/* Header */
#mk-chat-head {
    background: linear-gradient(180deg, #3498db 0%, #2980b9 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
#mk-chat-head .mk-title { font-weight: 600; font-size: 16px; flex: 1; }
#mk-chat-head .mk-sub   { font-size: 12px; opacity: .85; font-weight: 400; display: block; }
#mk-chat-head button {
    background: transparent; border: none; color: #fff;
    font-size: 16px; cursor: pointer; opacity: .85; padding: 4px;
}
#mk-chat-head button:hover { opacity: 1; }

/* Area form & pesan */
#mk-chat-body { flex: 1; overflow-y: auto; padding: 16px; background: #f5f7fa; }

/* Form nama + WA */
#mk-chat-form { display: flex; flex-direction: column; gap: 12px; }
#mk-chat-form .mk-intro { color: #555; font-size: 14px; margin-bottom: 2px; }
#mk-chat-form label { font-size: 13px; font-weight: 600; color: #2c3e50; margin-bottom: 4px; display: block; }
#mk-chat-form input {
    width: 100%; padding: 10px 12px; border: 1px solid #d5dbe0;
    border-radius: 8px; font-size: 15px; font-family: inherit; background: #fff; color: #333;
}
#mk-chat-form input:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 3px rgba(52,152,219,.15); }
#mk-chat-form .mk-err { color: #e74c3c; font-size: 13px; min-height: 16px; }
#mk-chat-start {
    background: #3498db; color: #fff; border: none; padding: 12px;
    border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
    transition: background .2s;
}
#mk-chat-start:hover { background: #2980b9; }
#mk-chat-start:disabled { background: #9bbfd6; cursor: default; }

/* Gelembung pesan */
.mk-msg { max-width: 80%; padding: 9px 13px; border-radius: 14px; margin-bottom: 10px; word-wrap: break-word; white-space: pre-wrap; font-size: 14px; }
.mk-msg.mk-visitor { background: #3498db; color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.mk-msg.mk-admin   { background: #fff; color: #333; border: 1px solid #e3e8ee; border-bottom-left-radius: 4px; }
.mk-time { font-size: 10px; opacity: .65; display: block; margin-top: 3px; }
.mk-note { text-align: center; color: #888; font-size: 12px; margin: 6px 0 12px; }

/* Baris input */
#mk-chat-input-row { display: none; padding: 10px; border-top: 1px solid #e3e8ee; background: #fff; gap: 8px; align-items: flex-end; }
#mk-chat-input-row.mk-show { display: flex; }
#mk-chat-text {
    flex: 1; resize: none; border: 1px solid #d5dbe0; border-radius: 10px;
    padding: 9px 12px; font-size: 14px; font-family: inherit; max-height: 90px; color: #333; background: #fff;
}
#mk-chat-text:focus { outline: none; border-color: #3498db; }
#mk-chat-send {
    background: #3498db; color: #fff; border: none; width: 42px; height: 42px;
    border-radius: 50%; cursor: pointer; font-size: 16px; flex-shrink: 0; transition: background .2s;
}
#mk-chat-send:hover { background: #2980b9; }

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
    #mk-chat-panel {
        left: 10px;
        right: 10px;
        top: auto;
        bottom: 50px;
        width: auto;
        max-width: none;
        /* Tinggi mengikuti area layar yang BENAR-BENAR terlihat.
           '100dvh' otomatis menyesuaikan saat address bar muncul/hilang,
           sehingga header tidak tertutup address bar & bawah tidak menggantung.
           '100vh' dipakai sebagai cadangan untuk browser lama. */
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        max-height: calc(100dvh - 100px);
    }
    /* Saat chat terbuka di HP, panel menutupi hampir seluruh layar,
       jadi tombol bulat mengambang disembunyikan — tutup lewat tombol × di header. */
    #mk-chat-launcher.mk-open { display: none; }
    /* Tombol dinaikkan sedikit agar tidak menutupi teks di pojok kiri-bawah.
       Ubah angka 'bottom' ini bila ingin lebih naik/turun. */
    #mk-chat-launcher { right: 16px; bottom: 92px; }
}

/* ================================================================
   DARK MODE (mengikuti body.dark milik situs)
   ================================================================ */
body.dark #mk-chat-panel { background: #1a1a28; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
body.dark #mk-chat-body  { background: #15151f; }
body.dark #mk-chat-form .mk-intro { color: #b0b0bc; }
body.dark #mk-chat-form label { color: #d0d0d8; }
body.dark #mk-chat-form input,
body.dark #mk-chat-text { background: #23233a; border-color: #34344e; color: #e0e0e8; }
body.dark .mk-msg.mk-admin { background: #23233a; color: #e0e0e8; border-color: #34344e; }
body.dark #mk-chat-input-row { background: #1a1a28; border-top-color: #2a2a3e; }
body.dark .mk-note { color: #8a8a98; }
body.dark #mk-chat-launcher.mk-open { background: #0e0e1a; }
