﻿.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, .wa-header-left {
    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);
    color: white;
    font-size: 1.1rem;
}

.wa-header {
    box-shadow: 0 12px 16px -12px rgba(133,133,133,.75);
}

/* 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 */

/* 09/09/2026: PG - WhatsApp-style composer */
.wa-input-wrapper {
    padding: 8px 12px 12px 12px;
    background: #f0f2f5;
}

.wa-composer-row {
    padding: 0 0 8px 0;
}

.wa-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #fff;
    border: 1px solid #e2e4e9;
    border-radius: 24px;
    padding: 6px 8px 6px 12px;
}

.wa-composer-btn {
    color: #54656f;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px 4px;
    line-height: 1;
}

    .wa-composer-btn:hover {
        color: var(--tc-color-pk);
    }

.wa-textbox {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font: inherit;
    font-size: .95rem;
    line-height: 1.4;
    padding: 8px 4px;
    max-height: 160px;
    overflow-y: auto;
}

    .wa-textbox:disabled {
        background: transparent;
        color: #888;
        cursor: not-allowed;
    }

.wa-send-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--tc-color-ba);
    color: var(--crm-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background .15s;
}

    .wa-send-btn:hover {
        background: var(--tc-color-pk);
        color: #fff;
    }

    .wa-send-btn.disabled {
        background: #d5d9dd;
        color: #fff;
        cursor: not-allowed;
        pointer-events: none;
    }

/* template combo as a pill matching the composer */
.wa-template-combo {
    border: 1px solid #e2e4e9 !important;
    border-radius: 20px !important;
    background: #fff !important;
    box-shadow: none !important;
    overflow: hidden;
    margin-bottom: 10px;
}

    .wa-template-combo .dxbl-text-edit-input {
        padding: 8px 4px 8px 16px;
        font: inherit;
        font-size: .95rem;
        border: none;
        background: transparent;
        box-shadow: none;
    }

    .wa-template-combo .dxbl-btn {
        border: none;
        background: transparent;
        color: #54656f;
        padding-right: 12px;
    }

    .wa-template-combo:focus-within {
        border-color: var(--tc-color-ba) !important;
        box-shadow: 0 0 0 2px rgba(186,218,85,.35) !important;
    }

.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;
}

/* 09/09/2026: PG - settings cog + template manager */

/* header icons (top-right is scoped in MainLayout.razor.css, so redeclare here) */
.wa-header .top-right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* settings dropdown — ported from thePortal portal-nav__account */
.wa-nav__account {
    position: relative;
}

.wa-nav__account-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: #ffffff;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    transition: background 0.15s;
    user-select: none;
}

    .wa-nav__account-summary:hover {
        background: rgba(255,255,255,0.1);
    }

.wa-nav__account-icon {
    font-size: 1.3rem;
}

.wa-nav__account-name {
    font-size: 1.1rem;
    font-weight: 400;
}

.wa-nav__chevron {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.wa-nav__chevron--open {
    transform: rotate(180deg);
}

.wa-nav__dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid #e2e4e9;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 300;
    overflow: hidden;
}

.wa-nav__dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    color: #1a1a2e;
    cursor: pointer;
    transition: background 0.1s;
}

    .wa-nav__dropdown-item:hover {
        background: #f5f6f8;
    }

.wa-nav__dropdown-divider {
    margin: 0.25rem 0;
    border: none;
    border-top: 1px solid #e2e4e9;
}

.wa-nav__backdrop {
    position: fixed;
    inset: 0;
    z-index: 150;
}

/* template manager window — uses global crm-window / crm-win-* chrome from site.css */
.wa-tpl-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-tpl-window {
    width: 1000px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wa-tpl-body {
    padding: 0;
}

.wa-tpl-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e2e4e9;
}

/* list rows — same feel as Bookmark Manager */
.wa-tpl-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #e2e4e9;
    font-size: 1rem;
}

.wa-tpl-row--empty {
    color: #666;
}

.wa-tpl-row-icon {
    color: #25D366;
    font-size: 1.3rem;
    flex: 0 0 auto;
}

.wa-tpl-row-main {
    flex: 1 1 auto;
    min-width: 0;
}

.wa-tpl-row-name {
    font-weight: 500;
    color: #1a1a2e;
}

.wa-tpl-row-preview {
    font-size: .8rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-tpl-row-meta {
    color: var(--tc-color-pk);
    white-space: nowrap;
    font-size: .9rem;
}

.wa-tpl-row-action {
    color: var(--tc-color-pk);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 4px;
}

    .wa-tpl-row-action:hover {
        color: #000;
    }

.wa-tpl-status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: .75rem;
    text-transform: capitalize;
    background: #eee;
    white-space: nowrap;
}

    .wa-tpl-status.approved {
        background: #d9f7e5;
        color: #157347;
    }

    .wa-tpl-status.rejected {
        background: #fde2e2;
        color: #b02a37;
    }

    .wa-tpl-status.pending, .wa-tpl-status.received {
        background: #fff3cd;
        color: #997404;
    }

/* editor */
.wa-tpl-form {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 12px;
    align-items: center;
    padding: 16px;
    background: #fff;
}

    .wa-tpl-form label {
        font-weight: 600;
    }

    .wa-tpl-form input[type=text], .wa-tpl-form textarea {
        width: 100%;
        padding: 6px 8px;
        border: 1px solid #ccc;
        border-radius: 4px;
        font: inherit;
    }

    .wa-tpl-form textarea {
        min-height: 180px;
        resize: vertical;
    }

.wa-tpl-varbar {
    display: flex;
    gap: 8px;
    align-items: center;
    grid-column: 2;
}

.wa-tpl-hint {
    font-size: .8rem;
    color: #666;
    grid-column: 2;
}

.wa-tpl-error {
    color: #b02a37;
    padding: 8px 16px;
    white-space: pre-wrap;
}

.wa-tpl-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid #e2e4e9;
    background: #fff;
}

/* 09/09/2026: PG - template send */
.wa-template-bar {
    display: flex;
    align-items: center;
    /*gap: 10px;*/
    padding: 6px 0px 0 0px;
}

.wa-template-combo {
    flex: 1 1 auto;
}

.wa-window-closed {
    color: #b02a37;
    font-size: .85rem;
    white-space: nowrap;
    margin: 0 0 0 10px;
}

.wa-template-panel {
    margin: 8px 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e2e4e9;
    border-radius: 8px;
}

.wa-template-var {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

    .wa-template-var label {
        font-size: .85rem;
        color: #444;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .wa-template-var input {
        padding: 5px 8px;
        border: 1px solid #ccc;
        border-radius: 4px;
        font: inherit;
    }

.wa-template-preview {
    margin: 10px 0;
    padding: 10px;
    background: #e7ffdb;
    border-radius: 8px;
    white-space: pre-wrap;
    font-size: .95rem;
}

.wa-template-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.wa-textbox:disabled {
    background: #eee;
    color: #888;
    cursor: not-allowed;
}

.wa-composer-btn.active {
    color: var(--tc-color-pk);
}

.wa-open-contact {
    margin-left: .6rem;
    font-size: 1.1rem;
}

/* 10/09/2026: PG - left toolbar + contact picker */
.wa-left-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
}

.wa-left-search {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f2f5;
    border-radius: 18px;
    padding: 6px 12px;
    color: #54656f;
}

    .wa-left-search input {
        flex: 1;
        border: none;
        outline: none;
        background: transparent;
        font: inherit;
        font-size: .9rem;
    }

.wa-conversation-grid .dxbl-grid-header {
    display: none !important;
}

.wa-picker {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
}

.wa-picker-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px;
    background: #f0f2f5;
    border-radius: 18px;
    padding: 8px 14px;
    color: #54656f;
}

    .wa-picker-search input {
        flex: 1;
        border: none;
        outline: none;
        background: transparent;
        font: inherit;
    }

.wa-picker-list {
    flex: 1 1 auto;
    overflow: auto;
}

.wa-picker-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #f2f2f2;
    cursor: pointer;
}

    .wa-picker-row:hover {
        background: #f5f6f8;
    }

.wa-picker-row-icon {
    color: var(--tc-color-pk);
    font-size: 1.2rem;
}

.wa-picker-row-main {
    flex: 1 1 auto;
    min-width: 0;
}

.wa-picker-row-name {
    font-weight: 500;
    color: #1a1a2e;
}

.wa-picker-row-sub {
    font-size: .8rem;
    color: #666;
}

.wa-picker-row-phone {
    color: #54656f;
    white-space: nowrap;
    font-size: .9rem;
}

.wa-picker-empty,
.wa-picker-more {
    padding: 16px;
    text-align: center;
    color: #666;
}

/* 10/09/2026: PG - left panel: fixed height, grid scrolls inside it */
.wa-left {
    height: 100vh;
    overflow: hidden;
}

.wa-conversation-grid {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
}

.wa-conversation-grid .dxbl-grid-header-row,
.wa-conversation-grid .dxbl-grid-header-content {
    display: none !important;
    height: 0 !important;
}

/* no link underline on icon buttons */
.wa-fab,
.wa-fab:hover,
.wa-composer-btn,
.wa-composer-btn:hover,
.wa-send-btn,
.wa-send-btn:hover,
.wa-open-contact,
.wa-open-contact:hover,
.wa-tpl-row-action,
.wa-tpl-row-action:hover,
.wa-nav__account-summary,
.wa-nav__account-summary:hover,
.wa-nav__dropdown-item,
.wa-nav__dropdown-item:hover {
    text-decoration: none !important;
}

/* 10/09/2026: PG - new-message button, inline with the search box */
.wa-fab {
    position: static;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--tc-color-ba);
    color: var(--crm-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: none;
    text-decoration: none !important;
    transition: background .15s;
}

.wa-fab:hover {
    background: var(--tc-color-pk);
    color: #fff;
    text-decoration: none !important;
}

mark.wa-hit {
    background: var(--tc-color-pk);
    color: #FFF;
    padding: 2px 4px;
    border-radius: 3px;
}

.wa-left-search-clear {
    color: #54656f;
    cursor: pointer;
    text-decoration: none !important;
    padding: 0 2px;
}

.wa-left-search-clear:hover {
    color: var(--tc-color-pk);
}

.wa-tpl-row-reason {
    font-size: .8rem;
    color: #b02a37;
    margin-top: 2px;
}