﻿.wa-layout {
    display: flex;
    height: 100vh;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* LEFT PANEL */

.wa-left {
    width: 320px;
    border-right: 1px solid #e5e5e5;
    background: #ffffff;
    display: flex;
    flex-direction: column;
}

    .wa-left .dxbl-grid-header-content {
        position: sticky;
        top: 0;
        z-index: 2;
        height: var(--header-h);
        flex: 0 0 var(--header-h);
        grid-template-columns: auto 1fr auto;
        column-gap: 1rem;
        align-items: center;
        padding: 0 .75rem !important;
        background-color: #103c52 !important;
        border-bottom: 1px solid var(--tc-color-ba) !important;
        border-top: 2px solid var(--tc-color-ba) !important;
        box-shadow: 0 12px 16px -12px rgba(133,133,133,.75);
        color: white;
        font-size: 1.1rem;
    }

    .wa-left .dxbl-grid,
    .wa-left .dxbl-grid-header,
    .wa-left .dxbl-grid-table,
    .wa-left .dxbl-grid-action {
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

/* THREAD ITEM */

.wa-thread {
    padding: 10px 12px;
    border-bottom: 1px solid #f2f2f2;
    cursor: pointer;
    transition: background 0.15s ease;
}

    .wa-thread:hover {
        background: #f6f6f6;
    }

.dxbl-selected-row .wa-thread {
    background: #e9edef !important;
}

.wa-thread-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wa-thread-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3px;
}

.wa-thread-name {
    font-weight: 600;
    font-size: 14px;
}

.wa-thread-time {
    font-size: 12px;
    color: #888;
}

.wa-thread-preview {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

/* UNREAD STYLING */

.wa-unread-badge {
    background: #e03131;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.wa-thread.unread .wa-thread-name,
.wa-thread.unread .wa-thread-preview {
    font-weight: 700;
    color: #000;
}

.wa-thread.unread .wa-thread-time {
    color: #25D366;
}

/* RIGHT PANEL */

.wa-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
}

.wa-header {
    position: sticky;
    top: 0;
    z-index: 2;
    height: var(--header-h);
    flex: 0 0 var(--header-h);
    display: grid;
    grid-template-columns: auto 1fr auto;
    column-gap: 1rem;
    align-items: center;
    padding: 0 .75rem;
    background-color: #103c52 !important;
    border-bottom: 1px solid var(--tc-color-ba);
    border-top: 2px solid var(--tc-color-ba);
    box-shadow: 0 12px 16px -12px rgba(133,133,133,.75);
    color: white;
    font-size: 1.1rem;
}

/* MESSAGES AREA */

.wa-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.wa-message {
    margin-bottom: 12px;
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

    .wa-message.left {
        align-self: flex-start;
        margin-left: 3%;
    }

    .wa-message.right {
        align-self: flex-end;
        margin-right: 3%;
    }

.wa-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
    backdrop-filter: blur(4px);
    box-shadow: 0 3px 12px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
}

.wa-message.left .wa-bubble {
    background: #ffffff;
    border-top-left-radius: 4px;
    border: 2px solid var(--tc-color-ba);
}

.wa-message.right .wa-bubble {
    border-top-right-radius: 4px;
    border: 2px solid var(--tc-color-ba);
    background: rgba(16, 60, 82, 0.85);
    color: white;
}

.wa-time {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    padding: 0 4px;
}

/* INPUT AREA */

.wa-input {
    padding: 12px;
    background: #ffffff;
    display: flex;
    gap: 10px;
    border-top: 1px solid #e5e5e5;
}

.wa-textbox {
    flex: 1;
}

.wa-input .dxbl-button {
    border-radius: 20px;
}

.wa-status {
    align-self: flex-end;
    margin-top: 4px;
    font-size: 0.75rem;
}

.wa-status-sent {
    color: #999;
}

.wa-status-read {
    color: #25D366; /* WhatsApp green */
}

.wa-status-undelivered {
    color: #e53935;
}

.wa-message.wa-undelivered {
    opacity: 0.5;
}

.wa-image {
    max-width: 240px;
    max-height: 320px;
    border-radius: 8px;
    margin-top: 6px;
    cursor: pointer;
}

.wa-media img:hover {
    opacity: 0.8;
}
.wa-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.wa-preview-content {
    max-width: 90%;
    max-height: 90%;
}

.wa-preview-image {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.wa-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60; /* above preview (50) */
}

.wa-upload-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.wa-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 11px;
    margin-top: 4px;
}

.wa-message.left .wa-meta {
    justify-content: flex-start;
    margin-left: 4px;
}

.wa-message.right .wa-meta {
    justify-content: flex-end;
    margin-right: 4px;
}

.wa-time {
    color: #888;
}

.wa-status {
    font-size: 0.75rem;
}

.wa-optout-icon {
    margin-left: 6px;
    color: #d9534f; /* soft red */
    font-size: 0.85rem;
    vertical-align: middle;
}

.wa-optout-panel {
    padding: 14px;
    background: #fff3f3;
    border-top: 1px solid #f5c2c2;
    color: #a94442;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
