/* =====================================================================
   WhatsApp Gateway - gaya kustom
   ===================================================================== */

.app-navbar {
    background: linear-gradient(90deg, #128c7e 0%, #25d366 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
}

.navbar-brand,
.app-navbar .nav-link {
    color: rgba(255, 255, 255, .92);
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
    color: #fff;
}

.min-w-0 {
    min-width: 0;
}

.letter-spacing-lg {
    letter-spacing: .5rem;
    font-weight: 600;
}

/* --- QR Code --- */
.qr-frame {
    width: 300px;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    border: 2px dashed #ced4da;
    border-radius: .75rem;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: .5rem;
}

.qr-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- Chat / Inbox --- */
.chat-window {
    max-height: 62vh;
    overflow-y: auto;
    background: #eae6df;
    background-image:
        radial-gradient(rgba(0, 0, 0, .03) 1px, transparent 1px);
    background-size: 20px 20px;
}

.chat-bubble {
    max-width: 78%;
    padding: .5rem .75rem;
    border-radius: .75rem;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
    word-wrap: break-word;
}

.chat-out {
    background: #d9fdd3;
    border-top-right-radius: .2rem;
}

.chat-in {
    background: #fff;
    border-top-left-radius: .2rem;
}

.chat-text {
    white-space: pre-wrap;
    font-size: .925rem;
}

.chat-meta {
    font-size: .7rem;
    color: #667781;
    text-align: right;
    margin-top: .15rem;
}

.avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #e7f6f1;
    color: #128c7e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* --- Chat split view (menu Chat) --- */
.chat-app {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: calc(100vh - 260px);
    min-height: 420px;
    overflow: hidden;
}

.chat-list {
    border-right: 1px solid #e9edef;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
    height: 100%;
    min-height: 0;
}

.chat-list-head {
    padding: .6rem .75rem;
    border-bottom: 1px solid #e9edef;
    flex-shrink: 0;
}

.chat-list-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    gap: .65rem;
    align-items: center;
    padding: .6rem .75rem;
    border-bottom: 1px solid #f2f4f5;
    text-decoration: none;
    color: inherit;
}

.chat-item:hover {
    background: #f5f6f6;
}

.chat-item.active {
    background: #e9edef;
}

.chat-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chat-item-top,
.chat-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
}

.chat-item-name {
    font-weight: 600;
    font-size: .925rem;
}

.chat-item-preview {
    color: #667781;
    font-size: .82rem;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e7f6f1;
    color: #128c7e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.chat-avatar-group {
    background: #ede7f6;
    color: #6a3fb5;
}

.chat-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #efeae2;
    height: 100%;
    min-height: 0;
}

.chat-pane-head {
    display: flex;
    align-items: center;
    padding: .55rem .9rem;
    background: #fff;
    border-bottom: 1px solid #e9edef;
    flex-shrink: 0;
}

.chat-pane .chat-window {
    flex: 1;
    min-height: 0;
    max-height: none;
    padding: .9rem;
    overflow-y: auto;
}

.chat-empty {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #f7f8f8;
}

.chat-reply {
    display: flex;
    gap: .5rem;
    padding: .6rem .75rem;
    background: #fff;
    border-top: 1px solid #e9edef;
    flex-shrink: 0;
}

.chat-reply textarea {
    resize: none;
    max-height: 120px;
}

@media (max-width: 991.98px) {
    .chat-app {
        grid-template-columns: 1fr;
        height: calc(100vh - 220px);
    }
    .chat-app.has-active .chat-list {
        display: none;
    }
    .chat-app:not(.has-active) .chat-pane {
        display: none;
    }
}

@media (max-width: 576px) {
    .qr-frame {
        width: 240px;
    }
    .chat-bubble {
        max-width: 90%;
    }
}
