/* --- Wrapper utama --- */
#ged-chat-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    font-family: Arial, sans-serif;
}

/* --- Tombol floating: hanya icon --- */
#ged-chat-toggle {
    display: inline-flex;          /* ikut ukuran icon */
    align-items: center;
    justify-content: center;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;

    /* Hapus bentuk bulat + background + shadow */
    border-radius: 0;
    width: auto;
    height: auto;
    background: transparent;
    box-shadow: none;
}

#ged-chat-toggle:hover {
    transform: translateY(-1px);
    box-shadow: none !important;
}

/* icon pada tombol dibuat besar */
.ged-chat-agent-icon {
    width: 88px;
    height: 88px;
    border-radius: 0;
    object-fit: contain;
}

/* text di tombol disembunyikan */
.ged-chat-toggle-text {
    display: none;
}

/* --- Panel kontak --- */
#ged-chat-panel {
    position: absolute;
    right: 0;
    bottom: 80px;
    width: 340px;
    max-width: 92vw;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-height: calc(100vh - 120px); /* supaya tidak mentok menu */
}

/* class ketika panel terbuka */
#ged-chat-panel.ged-chat-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* --- Header panel --- */
.ged-chat-panel-header {
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
    background: #212c65;
    color: #fff;
}

.ged-chat-header-left {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ged-chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: contain;
    background: #fff;
}

.ged-chat-title {
    font-weight: bold;
    font-size: 15px;
}

.ged-chat-subtitle {
    font-size: 11px;
}

.ged-chat-close {
    background: transparent;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #fff;
    cursor: pointer;
}

/* --- Body panel --- */
.ged-chat-panel-body {
    padding: 12px;
    max-height: calc(100vh - 180px); /* tinggi body yang bisa scroll */
    overflow-y: auto;
}

/* Item contact (Call / Chat / WA) */
.ged-chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    background: #f6f6f6;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    border: none;
    width: 100%;
}
/* Tombol contact yang sedang dinonaktifkan */
.ged-chat-item-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    position: relative;
}

.ged-chat-item-disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.ged-chat-item-disabled:hover {
    background: #f6f6f6; /* jangan berubah saat hover */
}


/* .ged-chat-item-disabled::after {
    content: "Sedang dalam pengembangan";
    position: absolute;
    right: 10px;
    bottom: 6px;
    font-size: 10px;
    color: #e60012;
    font-weight: 600;
} */


.ged-chat-item:hover {
    background: #ececec;
}

.ged-chat-item-icon {
    font-size: 20px;
    min-width: 28px;
    text-align: center;
}
/* Icon gambar di dalam ged-chat-item-icon */
.ged-chat-item-icon-img {
    width: 22px;      /* boleh diubah kalau mau lebih besar/kecil */
    height: 22px;
    display: block;
}
.ged-chat-btn-wa-icon {
    width: 16px;
    height: 16px;
    display: block;
}


.ged-chat-item-text {
    text-align: left;
}

.ged-chat-item-title {
    font-size: 13px;
    font-weight: bold;
    color: #333;
}

.ged-chat-item-subtitle {
    font-size: 11px;
    color: #666;
}

/* --- Social --- */
.ged-chat-social {
    margin-top: 10px;
    text-align: center;
}

.ged-chat-social-title {
    font-size: 11px;
    color: #777;
    margin-bottom: 6px;
}

.ged-chat-social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid #ddd;
    margin: 0 4px;
    font-size: 13px;
    text-decoration: none;
    color: #555;
}

.ged-chat-social-links a img {
    width: 14px;
    height: 14px;
    display: block;
}
.ged-chat-call {
    cursor: default !important; /* supaya card tidak dianggap tombol besar */
}

.ged-chat-call-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 3px;
}

.ged-chat-call-number {
    color: #212c65;
    text-decoration: underline;
    font-size: 12px;
}

.ged-chat-call-number:hover {
    color: #000;
}


/* --- Form pra-chat --- */
#ged-chat-form-wrapper {
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 8px;
}

.ged-chat-form-title {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 6px;
}
/* Banner kecil di atas form */
.ged-chat-form-banner {
    margin-top: 8px;
    margin-bottom: 10px;
    border-radius: 10px;
    overflow: hidden;
}

/* Untuk video di banner */
.ged-chat-form-banner video,
.ged-chat-form-banner-video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 150px;      /* boleh disesuaikan */
    object-fit: cover;      /* atau 'contain' kalau mau full terlihat tanpa crop */
}


/* Tombol kembali dari form ke opsi chat */
.ged-chat-form-back {
    border: none;
    background: transparent;
    color: #e60012;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ged-chat-form-back:hover {
    text-decoration: underline;
}
/* Icon panah kiri melengkung (SVG) */
.ged-chat-form-back-icon {
    width: 16px;
    height: 16px;
    stroke: #e60012;
    stroke-width: 2;
    fill: none;
}

/* Biar SVG sejajar rapi dengan teks */
.ged-chat-form-back-icon path {
    stroke-linecap: round;
    stroke-linejoin: round;
}



#ged-chat-form label {
    display: block;
    font-size: 11px;
    margin-bottom: 6px;
}

#ged-chat-form input[type="text"],
#ged-chat-form input[type="email"] {
    width: 100%;
    padding: 6px;
    margin-top: 2px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 12px;
}

.ged-chat-btn-submit {
    margin-top: 4px;
    width: 100%;
    padding: 7px;
    border-radius: 8px;
    border: none;
    background: #212c65; /* default: merah (livechat internal) */
    color: #fff;
    font-size: 12px;
    cursor: pointer;

    /* untuk icon + text di tengah */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Tombol submit dalam keadaan loading */
.ged-chat-btn-submit.ged-chat-loading {
    position: relative;
    opacity: 0.8;
    cursor: default;
    pointer-events: none;
}

/* Lingkaran loading di kanan teks */
.ged-chat-btn-submit.ged-chat-loading::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    animation: ged-chat-spin 0.8s linear infinite;
}

@keyframes ged-chat-spin {
    to { transform: rotate(360deg); }
}


/* span untuk icon di tombol (default disembunyikan) */
/* span untuk icon di tombol */
.ged-chat-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.ged-chat-btn-icon img {
    width: 16px;
    height: 16px;
    display: block;
}

/* style khusus kalau tombol dalam mode WhatsApp */
.ged-chat-btn-whatsapp {
    background: #25D366; /* warna hijau WhatsApp */
}

/* Required / optional label */
.ged-chat-required {
    color: #e60012;
    margin-left: 3px;
    font-weight: bold;
}

.ged-chat-optional {
    color: #999;
    margin-left: 4px;
    font-size: 10px;
}


/* --- Live chat box --- */
#ged-chat-box {
    margin-top: 10px;
    border-radius: 10px;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    height: 260px;
}
/* Dipaksa tetap hilang kalau ada class ged-chat-hidden */
#ged-chat-box.ged-chat-hidden {
    display: none;
}
.ged-chat-box-header {
    padding: 6px 8px;
    font-size: 12px;
    font-weight: bold;
    background: #f6f6f6;
    border-bottom: 1px solid #eee;

    /* NEW: supaya tombol "Tutup chat" di kanan */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ged-chat-end-btn {
    border: none;
    background: transparent;
    color: #e60012;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
}

.ged-chat-end-btn:hover {
    text-decoration: underline;
}

/* Box konfirmasi tutup chat */
.ged-chat-end-confirm {
    padding: 8px;
    border-top: 1px solid #eee;
    background: #fff6f6;
    font-size: 11px;
}

.ged-chat-end-confirm-text {
    margin-bottom: 6px;
}

.ged-chat-end-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.ged-chat-end-confirm-actions button {
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
}

.ged-chat-end-yes {
    background: #e60012;
    color: #fff;
}

.ged-chat-end-no {
    background: #f0f0f0;
    color: #333;
}

.ged-chat-messages {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    font-size: 12px;
}

.ged-chat-message {
    margin-bottom: 6px;
    padding: 6px 8px;
    border-radius: 8px;
    max-width: 90%;
}

.ged-chat-message-admin {
    background: #f0f0f0;
    align-self: flex-start;
}

.ged-chat-message-user {
    background: #e60012;
    color: #fff;
    align-self: flex-end;
    margin-left: auto;
}

#ged-chat-message-form {
    display: flex;
    border-top: 1px solid #eee;
}

#ged-chat-message-input {
    flex: 1;
    border: none;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 0 0 0 10px;
    outline: none;
}

#ged-chat-message-form button {
    border: none;
    padding: 0 10px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 0 0 10px 0;
    background: #e60012;
    color: #fff;
}

/* Pesan error di bawah input */
.ged-chat-error {
    color: #e60012;
    font-size: 10px;
    margin-top: 2px;
    display: block;
}

/* Border merah untuk input yang tidak valid */
.ged-chat-input-invalid {
    border-color: #e60012 !important;
}


/* Utility */
.ged-chat-hidden {
    display: none;
}



/* Modal konfirmasi sebelum mulai chat */
#ged-chat-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;              /* di atas panel chat */
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

/* ketika tidak punya class .ged-chat-hidden → tampilkan sebagai flex center */
#ged-chat-confirm-modal:not(.ged-chat-hidden) {
    display: flex;
    align-items: center;
    justify-content: center;
}


.ged-chat-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.ged-chat-confirm-box {
    position: relative;
    max-width: 360px;
    width: calc(100% - 40px);
    margin: 0 auto;
    background: #ffffff;
    border-radius: 16px;
    padding: 18px 20px 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    text-align: left;
    z-index: 1;
    font-size: 13px;
}

/* judul & teks */
.ged-chat-confirm-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    color: #212c65;
}

.ged-chat-confirm-text {
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 14px;
}

.ged-chat-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ged-chat-confirm-actions button {
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ged-chat-confirm-yes {
    background: #212c65;
    color: #fff;
    border-color: #212c65;
    font-weight: 600;
}
.ged-chat-confirm-yes:hover {
    background: #1a234f;
    border-color: #1a234f;
}

.ged-chat-confirm-no {
    background: #f5f5f5;
    color: #333;
    border-color: #d0d0d0;
}
.ged-chat-confirm-no:hover {
    background: #e7e7e7;
}
#ged-chat-confirm-modal.ged-chat-hidden {
    display: none !important;
}
/* Office Hours */
.ged-chat-office-hours {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 4px;
    font-size: 11px;
    color: #f1f3ff;          /* sedikit lebih terang */
}

.ged-chat-office-icon {
    width: 18px;             /* dibesarkan supaya lebih kelihatan */
    height: 18px;
    flex-shrink: 0;
    display: block;
}

.ged-chat-office-text {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
    margin-top: 2px;
}

.ged-chat-office-text span {
    display: block;            /* memastikan turun ke bawah */
    padding-left: 0px;         /* pastikan rata kiri */
    margin: 0;                 /* hilangkan jarak tidak perlu */
}




/* --- Responsif mobile --- */
@media (max-width: 480px) {

    .ged-chat-confirm-box {
        max-width: 92vw;
        padding: 16px 14px 14px;
    }

    .ged-chat-confirm-text {
        font-size: 12px;
    }
    .ged-chat-confirm-actions button {
        font-size: 11px;
        padding: 6px 10px;
    }
    #ged-chat-widget {
        right: 12px;
        bottom: 12px;
    }

    #ged-chat-panel {
        width: 92vw;
    }

    .ged-chat-agent-icon {
        width: 72px;
        height: 72px;
    }
}


/* =====================================================
   GED Chat Widget v2.0 - REAL-TIME ADDITIONS
   ===================================================== */

/* ---- Online dot di menu "Chat with Us" ---- */
.ged-chat-online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    margin-left: 6px;
    position: relative;
    top: -1px;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: ged-pulse 2s infinite;
}
@keyframes ged-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70%  { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ---- Badge unread pada toggle button ---- */
#ged-chat-widget { position: fixed; }
#ged-chat-toggle { position: relative; }

#ged-chat-toggle-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    animation: ged-bounce-in 0.35s ease;
    z-index: 2;
}
@keyframes ged-bounce-in {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ---- Chat Box Header: status pill ---- */
.ged-chat-box-header {
    padding: 8px 10px;
}
.ged-chat-box-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ged-chat-box-header-title {
    font-size: 12px;
    font-weight: 700;
    color: #212c65;
}
.ged-chat-box-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 500;
}
.ged-chat-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    display: inline-block;
}
.ged-chat-status-waiting .ged-chat-status-dot {
    background: #f59e0b;
    animation: ged-blink 1.4s infinite;
}
.ged-chat-status-active .ged-chat-status-dot {
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
    animation: ged-pulse-small 2s infinite;
}
.ged-chat-status-closed .ged-chat-status-dot {
    background: #ef4444;
}
.ged-chat-status-waiting .ged-chat-status-text { color: #b45309; }
.ged-chat-status-active  .ged-chat-status-text { color: #059669; }
.ged-chat-status-closed  .ged-chat-status-text { color: #dc2626; }
@keyframes ged-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}
@keyframes ged-pulse-small {
    0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); }
    70%  { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ---- Chat box tinggi diperbesar ---- */
#ged-chat-box {
    height: 340px;
    background: #fff;
}
.ged-chat-messages {
    background: #fafafa;
    display: flex;
    flex-direction: column;
}

/* ---- Message bubble polish ---- */
.ged-chat-message {
    position: relative;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 82%;
    padding: 8px 10px;
    border-radius: 14px;
    margin-bottom: 6px;
    font-size: 12.5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.ged-chat-message-admin {
    background: #ffffff;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #e5e7eb;
}
.ged-chat-message-user {
    background: #212c65;
    color: #fff;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}
.ged-chat-message-system {
    background: #fffbeb;
    color: #92400e;
    font-size: 11px;
    text-align: center;
    align-self: center;
    border: 1px dashed #fcd34d;
    max-width: 95%;
}
.ged-chat-message-time {
    font-size: 9.5px;
    opacity: 0.65;
    margin-top: 2px;
    text-align: right;
}
.ged-chat-message-admin .ged-chat-message-time { color: #6b7280; }
.ged-chat-message-user  .ged-chat-message-time { color: #e5e7eb; }

.ged-chat-message-enter {
    animation: ged-msg-in 0.25s ease;
}
@keyframes ged-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ged-chat-message-pending { opacity: 0.7; }
.ged-chat-message-failed {
    background: #fee2e2 !important;
    color: #991b1b !important;
}
.ged-chat-message-fail-label {
    font-size: 10px;
    opacity: 0.85;
    font-style: italic;
}

/* ---- Typing indicator ---- */
.ged-chat-typing-indicator {
    padding: 4px 10px;
    font-size: 11px;
    color: #6b7280;
    background: #fafafa;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #f1f1f1;
}
.ged-chat-typing-dots {
    display: inline-flex;
    gap: 3px;
}
.ged-chat-typing-dots span {
    width: 5px;
    height: 5px;
    background: #9ca3af;
    border-radius: 50%;
    animation: ged-typing 1.2s infinite;
}
.ged-chat-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ged-chat-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ged-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-3px); opacity: 1; }
}

/* ---- Message input & button polish ---- */
#ged-chat-message-form {
    display: flex;
    gap: 0;
    border-top: 1px solid #eee;
    background: #fff;
    padding: 6px;
}
#ged-chat-message-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 999px;
    outline: none;
    background: #f9fafb;
    transition: border-color 0.15s ease, background 0.15s ease;
}
#ged-chat-message-input:focus {
    border-color: #212c65;
    background: #fff;
}
#ged-chat-message-input:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}
#ged-chat-message-form button {
    border: none;
    padding: 0;
    margin-left: 6px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #212c65;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease;
}
#ged-chat-message-form button:hover:not(:disabled) {
    background: #1a234f;
    transform: scale(1.05);
}
#ged-chat-message-form button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* ---- TOAST notifikasi ---- */
#ged-chat-toast {
    position: absolute;
    bottom: 100px;
    right: 0;
    width: 280px;
    max-width: 88vw;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    z-index: 10001;
}
.ged-chat-toast-enter {
    animation: ged-toast-in 0.35s ease;
}
@keyframes ged-toast-in {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.ged-chat-toast-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #212c65;
    color: #fff;
}
.ged-chat-toast-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: contain;
    background: #fff;
}
.ged-chat-toast-title {
    flex: 1;
    font-size: 12px;
    font-weight: 700;
}
.ged-chat-toast-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.ged-chat-toast-body {
    padding: 10px 12px;
    font-size: 12px;
    color: #374151;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Responsive tweaks ---- */
@media (max-width: 480px) {
    #ged-chat-toast {
        right: 0;
        left: 0;
        margin: 0 auto;
        width: calc(100vw - 24px);
    }
    #ged-chat-box {
        height: 320px;
    }
}
