/* Menaikkan layer kotak dialog messager EasyUI */
.window, .window-shadow, .window-mask {
    z-index: 999999 !important;
}

/* Memastikan teks dan layout di dalam dialog tetap rapi */
.messager-window {
    z-index: 1000000 !important;
}

/* --- STYLING UTAMA WIDGET FLOATING POJOK KANAN BAWAH --- */
#chatWidgetContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Tombol Bulat Floating Saat Minimize */
.chat-trigger-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #0066cc;
    color: white;
    text-align: center;
    line-height: 60px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}
/* Memperbaiki hover selektor agar sesuai dengan .chat-trigger-btn2 */
.chat-trigger-btn:hover {
    transform: scale(1.05);
    background-color: #0052a3;
}

/* Kotak Box Chat Saat Maximize (Ukuran Panel) */
.chat-window-box {
    display: none;    
    width: 380px;
    height: 480px;
    background: #fff;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    overflow: hidden;
}

/* Header kustom untuk kontrol minimize */
.chat-custom-header {
    background: #0066cc;
    color: white;
    padding: 12px 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    height: 45px;
    box-sizing: border-box;
}

/* Layout internal obrolan */
.chat-container-layout {
    display: flex;
    flex-direction: column;
    height: calc(100% - 45px);
}

.chat-box { 
    flex: 1; 
    padding: 15px; 
    overflow-y: auto; 
    background: #f5f7fa; 
}

/* Balon Percakapan */
.message { 
    margin-bottom: 12px; 
    padding: 8px 12px; 
    border-radius: 8px; 
    max-width: 75%; 
    word-wrap: break-word; 
    white-space: pre-wrap; 
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.msg-me { background: #dcf8c6; margin-left: auto; text-align: left; }
.msg-them { background: #fff; border: 1px solid #e6e6e6; text-align: left; }

.chat-input-area {
    padding: 10px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex; 
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    box-sizing: border-box;
}


/* Responsif untuk resolusi Handphone */
@media (max-width: 480px) {
    /* Container utama tetap di pojok kanan bawah agar tombol bulat tidak lari ke atas kiri */
    #chatWidgetContainer { 
        position: fixed;
        bottom: 20px; 
        right: 20px; 
        left: auto;
        top: auto;
    }

    .chat-window-box {
        pointer-events: auto; 
        width: 100% !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        /* Menggunakan tinggi visual dinamis dari JavaScript */
        height: calc(var(--vh, 1vh) * 100) !important; 
        border-radius: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        
        /* KUNCI 1: Paksa box utama menggunakan flex vertikal & matikan scroll luar /
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important; */
    }

    /* Memastikan tata letak dalam membagi ruang dengan tegas */
    .chat-container-layout {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        overflow: hidden !important; /* Mencegah layout dalam meluber */
    }

    /* KUNCI 2: Hanya area ini yang boleh memiliki scrollbar */
    .chat-box {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch; /* Membuat scrolling mulus di iOS/Android */
    }

    /* KUNCI 3: Mengunci area input di posisi paling bawah dan melarangnya menciut/tergeser */
    .chat-input-area {
        flex-shrink: 0 !important;
        background: #fff !important;
        position: relative !important;
        bottom: 0 !important;
        z-index: 10 !important;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05); /* Memberi batas samar atas keyboard */
    }
}

/* --- STYLING BADGE COUNTER ANGKA MERAH --- */
.chat-badge-counter {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff4d4d;
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    padding: 0 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    border: 2px solid #0066cc;
    font-family: Arial, sans-serif;
    animation: popIn 0.3s ease;
}

/* Animasi kecil saat angka bertambah */
@keyframes popIn {
    0% { transform: scale(0); }
    80% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
