/* ================================================================
   PARTILAHSHOP — chat.css (Khusus Fitur Chat Firebase)
   ================================================================ */

/* 🆕 FIX: Paksa sembunyi elemen lain saat chat buka */
body.chat-open .cart-floating-btn,
body.chat-open #jamOperasionalBanner,
body.chat-open #tawkchat-container,
body.chat-open #tawkchat-embed-container,
body.chat-open .tawk-widget,
body.chat-open .crisp-client,
body.chat-open #crisp-chatbox,
body.chat-open .intercom-lightbox-app,
body.chat-open #intercom-container,
body.chat-open .zopim,
body.chat-open [class*="tawk"],
body.chat-open [class*="crisp"],
body.chat-open [class*="chat-widget"],
body.chat-open [class*="floating-chat"],
body.chat-open iframe[src*="tawk"],
body.chat-open iframe[src*="crisp"],
body.chat-open iframe[src*="intercom"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

/* Background overlay saat modal chat buka */
.chat-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100000; 
    display: none;
}
.chat-overlay.show { display: block; }

/* Box Modal Chat — Full Screen (sama seperti admin) */
.chat-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    z-index: 100001; 
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.chat-modal.show { display: flex; }

/* Header Chat — back button + title di kiri dengan gap profesional */
.chat-header {
    background: #fa5b0f;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.2rem;
}
.chat-header .chat-close-btn {
    flex-shrink: 0;
}
.chat-header span:not(.admin-online-dot) {
    flex: 0 0 auto;
}
.chat-close-btn {
    background: none; border: none; color: #fff;
    font-size: 1.5rem; cursor: pointer; line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}
.chat-close-btn svg {
    width: 28px;
    height: 28px;
    stroke-width: 3;
}

/* Area Pesan (Scrollable) — background light gray sama seperti admin */
.chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f1f1f1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Form Input Chat — padding bawah aman dari keyboard HP */
.chat-footer {
    padding: 10px 10px 14px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    background: #fff;
}
.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
}
.chat-input:focus { border-color: #fa5b0f; }
.chat-send-btn {
    background: #fa5b0f;
    color: #fff;
    border: none;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
}

/* Bubble Chat */
.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.4;
    word-wrap: break-word;
}
.chat-bubble.customer {
    background: #fa5b0f;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}
.chat-bubble.admin {
    background: #e5e5e5;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}
.chat-time {
    font-size: 0.6rem;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

/* Tombol Pilihan Varian */
.varian-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.varian-btn:hover { border-color: #fa5b0f; }
.varian-btn.active {
    background: #fa5b0f;
    color: #fff;
    border-color: #fa5b0f;
}

/* 🆕 FIX: Lock ukuran ikon 💬 biar tidak mengecil saat ada badge */
#btnToggleChat {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-width: 40px;
    min-height: 40px;
    font-size: 1.6rem !important;  /* 🆕 Perbesar ikon 💬 (emoji) */
}
/* 🆕 Perbesar juga kalau ikonnya SVG atau icon font */
#btnToggleChat svg,
#btnToggleChat i {
    width: 1.5rem !important;
    height: 1.5rem !important;
    font-size: 1.8rem !important;
}
#navChatBadge {
    pointer-events: none;
    left: 1px !important;
    right: auto !important;
    top: 0.1px !important;
}

/* 🆕 PRESENCE: Indikator online admin di header chat toko */
.admin-online-dot {
    width: 12px !important;
    height: 12px !important;
    min-width: 12px !important;
    border-radius: 50% !important;
    display: inline-block !important;
    margin-left: -14px !important;  /* Nempel ke huruf "r" di "Seller" */
    margin-top: 12px !important;       /* 🆕 FIX: Naikkan dot ke tengah vertikal */
    flex: 0 0 12px !important;
    border: 2px solid #fff;
    transition: all 0.3s ease;
    vertical-align: middle;
    align-self: center !important;  /* 🆕 FIX: Vertikal center sejajar text */
}
.admin-online-dot.online {
    background: #00ff66 !important;  /* 🆕 Neon green (paling terang) */
    box-shadow: 0 0 8px #00ff66, 0 0 16px rgba(0, 255, 102, 0.8), 0 0 24px rgba(0, 255, 102, 0.5) !important;
    animation: pulse-green 1.5s infinite !important;
}
.admin-online-dot.offline {
    background: #6b7280 !important;
    box-shadow: none !important;
    animation: none !important;
    opacity: 0.7;
}
@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 8px #00ff66, 0 0 16px rgba(0, 255, 102, 0.8), 0 0 24px rgba(0, 255, 102, 0.5); }
    50%      { box-shadow: 0 0 12px #00ff66, 0 0 22px rgba(0, 255, 102, 1), 0 0 32px rgba(0, 255, 102, 0.7); }
}