/*--------------------------------------------------------------
# Conversation Page - WhatsApp Style
--------------------------------------------------------------*/

.conversation-page {
    background:
        radial-gradient(circle at top right, rgba(80, 197, 255, 0.08), transparent 28%),
        linear-gradient(180deg, #f6fafc 0%, #edf3f7 100%);
}

.conversation-shell {
    padding: 70px 0;
}


/*--------------------------------------------------------------
# Main Layout
--------------------------------------------------------------*/

.conversation-layout {
    display: block;
}

.conversation-main {
    min-width: 0;
}


/*--------------------------------------------------------------
# Chat Card
--------------------------------------------------------------*/

.wa-chat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 82vh;
    background: #efeae2;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}


/*--------------------------------------------------------------
# Header
--------------------------------------------------------------*/

.wa-chat-head {
    position: sticky;
    top: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    background: #f0f2f5;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(12px);
}

.wa-chat-user {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.wa-chat-avatar {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #50c5ff 0%, #1fa9ea 100%);
    color: #fff;
    font-size: 1.12rem;
    font-weight: 800;
    box-shadow: 0 12px 26px rgba(80, 197, 255, 0.28);
}

.wa-chat-user-copy {
    min-width: 0;
}

.wa-chat-user-copy h3 {
    margin: 0 0 4px;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
    color: #0f172a;
    word-break: break-word;
}

.wa-chat-subline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-size: 0.84rem;
    color: #64748b;
}

.wa-chat-subline span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.wa-chat-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.wa-head-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.wa-head-badge.is-public {
    background: rgba(80, 197, 255, 0.12);
    color: #0f6fa0;
    border-color: rgba(80, 197, 255, 0.18);
}

.wa-head-badge.is-private {
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.12);
}

.wa-head-badge.is-open {
    background: rgba(34, 197, 94, 0.10);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.18);
}

.wa-head-badge.is-closed {
    background: rgba(239, 68, 68, 0.10);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.18);
}


/*--------------------------------------------------------------
# Toolbar
--------------------------------------------------------------*/

.wa-chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 20px;
    background: #f7f8fa;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.wa-toolbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(80, 197, 255, 0.10);
    border: 1px solid rgba(80, 197, 255, 0.14);
    color: #0f172a;
    font-size: 0.82rem;
    font-weight: 500;
}

.wa-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    font-size: 0.88rem;
    font-weight: 600;
    transition: 0.2s ease;
}

.wa-toolbar-btn:hover {
    background: #eef8fd;
    border-color: rgba(80, 197, 255, 0.24);
}


/*--------------------------------------------------------------
# Chat Body
--------------------------------------------------------------*/

.wa-chat-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 420px;
    max-height: 72vh;
    overflow-y: auto;
    padding: 18px 16px 24px;
    background:
        linear-gradient(rgba(239, 234, 226, 0.92), rgba(239, 234, 226, 0.92)),
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.55) 0 1px, transparent 1px),
        radial-gradient(circle at 80% 40%, rgba(255, 255, 255, 0.35) 0 1px, transparent 1px);
    background-size: auto, 22px 22px, 28px 28px;
    scroll-behavior: smooth;
}

.wa-chat-body::-webkit-scrollbar {
    width: 8px;
}

.wa-chat-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 999px;
}

.wa-chat-body::-webkit-scrollbar-track {
    background: transparent;
}


/*--------------------------------------------------------------
# Date Separator
--------------------------------------------------------------*/

.wa-date-pill {
    display: flex;
    justify-content: center;
    margin: 8px 0 14px;
}

.wa-date-pill span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(15, 23, 42, 0.07);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.05);
    color: #475569;
    font-size: 0.78rem;
    font-weight: 700;
}


/*--------------------------------------------------------------
# Message Rows
--------------------------------------------------------------*/

.wa-msg-row {
    display: flex;
    margin-bottom: 10px;
    transition: transform 0.18s ease, background 0.2s ease;
}

.wa-msg-row.wa-msg-in {
    justify-content: flex-start;
}

.wa-msg-row.wa-msg-out {
    justify-content: flex-end;
}

.wa-msg-bubble-wrap {
    max-width: min(78%, 720px);
}

.wa-msg-meta {
    margin-bottom: 2px;
    padding: 0 6px;
}

.wa-msg-row.wa-msg-out .wa-msg-meta {
    text-align: right;
}

.wa-msg-name {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
}

.wa-msg-role {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.07);
    color: #64748b;
    font-size: 0.64rem;
    letter-spacing: 0.04em;
}

.wa-msg-bubble {
    position: relative;
    padding: 10px 12px 8px;
    border-radius: 12px;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.08);
}

.wa-msg-in .wa-msg-bubble {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-top-left-radius: 4px;
}

.wa-msg-out .wa-msg-bubble {
    background: #d9fdd3;
    border: 1px solid rgba(16, 185, 129, 0.10);
    border-top-right-radius: 4px;
}

.wa-msg-in .wa-msg-bubble::before,
.wa-msg-out .wa-msg-bubble::before {
    content: "";
    position: absolute;
    top: 0;
    width: 12px;
    height: 14px;
}

.wa-msg-in .wa-msg-bubble::before {
    left: -6px;
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 60%, transparent 60%);
}

.wa-msg-out .wa-msg-bubble::before {
    right: -6px;
    background: linear-gradient(225deg, #d9fdd3 0%, #d9fdd3 60%, transparent 60%);
}

.wa-msg-text {
    font-size: 0.94rem;
    line-height: 1.55;
    color: #0f172a;
    white-space: pre-wrap;
    word-break: break-word;
}


/*--------------------------------------------------------------
# Quoted Reply Block
--------------------------------------------------------------*/

.wa-quoted-link {
    display: block;
    text-decoration: none;
    margin-bottom: 10px;
}

.wa-quoted-box {
    padding: 10px 12px;
    border-radius: 14px;
    border-left: 4px solid #50c5ff;
    background: rgba(80, 197, 255, 0.10);
}

.wa-msg-in .wa-quoted-box {
    background: rgba(80, 197, 255, 0.08);
}

.wa-msg-out .wa-quoted-box {
    background: rgba(255, 255, 255, 0.42);
}

.wa-quoted-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
    color: #0f6fa0;
    font-size: 0.76rem;
    font-weight: 700;
}

.wa-quoted-text {
    color: #475569;
    font-size: 0.85rem;
    line-height: 1.55;
}


/*--------------------------------------------------------------
# Message Footer & Actions
--------------------------------------------------------------*/

.wa-msg-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.wa-msg-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.wa-msg-action-btn,
.wa-msg-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    background: rgba(255, 255, 255, 0.82);
    color: #0f172a;
    transition: 0.2s ease;
}

.wa-msg-action-btn {
    gap: 6px;
    padding: 0 12px;
    font-size: 0.82rem;
    font-weight: 600;
}

.wa-msg-icon-btn {
    width: 34px;
    min-width: 34px;
    padding: 0;
    font-size: 0.9rem;
}

.wa-msg-action-btn:hover,
.wa-msg-icon-btn:hover {
    background: #f8fafc;
    border-color: rgba(80, 197, 255, 0.22);
    color: #0f6fa0;
}

.wa-msg-time {
    flex-shrink: 0;
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}

.wa-reply-menu {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.10);
}

.wa-reply-menu .dropdown-item {
    border-radius: 10px;
    font-size: 0.9rem;
    padding: 10px 12px;
}


/*--------------------------------------------------------------
# Composer
--------------------------------------------------------------*/

.wa-composer-shell {
    position: sticky;
    bottom: 0;
    z-index: 8;
    padding: 12px 14px 14px;
    background: #f0f2f5;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(12px);
}

.wa-composer-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wa-reply-preview {
    display: none;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(80, 197, 255, 0.10);
    border: 1px solid rgba(80, 197, 255, 0.16);
}

.wa-reply-preview.show {
    display: flex;
}

.wa-reply-preview-bar {
    width: 4px;
    min-width: 4px;
    border-radius: 999px;
    background: #50c5ff;
}

.wa-reply-preview-main {
    flex: 1;
    min-width: 0;
}

.wa-reply-preview-title {
    margin-bottom: 4px;
    color: #0f6fa0;
    font-size: 0.8rem;
    font-weight: 700;
}

.wa-reply-preview-text {
    color: #475569;
    font-size: 0.88rem;
    line-height: 1.55;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-reply-preview-close {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: #64748b;
    transition: 0.2s ease;
}

.wa-reply-preview-close:hover {
    color: #0f172a;
    border-color: rgba(80, 197, 255, 0.20);
}

.wa-composer-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wa-role-picker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.wa-role-picker-label {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
}

.wa-role-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: #334155;
    font-size: 0.84rem;
    font-weight: 700;
    transition: 0.2s ease;
}

.wa-role-pill:hover {
    border-color: rgba(80, 197, 255, 0.22);
    color: #0f6fa0;
}

.wa-role-pill.active {
    background: linear-gradient(180deg, #50c5ff 0%, #2bb4f2 100%);
    border-color: #2bb4f2;
    color: #fff;
    box-shadow: 0 10px 24px rgba(80, 197, 255, 0.22);
}

.wa-role-guest-note {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 500;
}

.wa-role-guest-note a {
    color: #0f6fa0;
    font-weight: 700;
    text-decoration: none;
}

.wa-composer-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.wa-composer-input-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-end;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 26px;
    background: #ffffff;
    min-height: 54px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.wa-composer-input-wrap:focus-within {
    border-color: rgba(80, 197, 255, 0.55);
    box-shadow: 0 0 0 4px rgba(80, 197, 255, 0.10);
}

.wa-composer-input {
    width: 100%;
    min-height: 54px;
    max-height: 160px;
    resize: none;
    border: 0;
    outline: none;
    background: transparent;
    padding: 14px 18px;
    color: #0f172a;
    font-size: 0.94rem;
    line-height: 1.55;
    border-radius: 26px;
}

.wa-composer-input::placeholder {
    color: #94a3b8;
}

.wa-composer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wa-small-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #ffffff;
    color: #334155;
    font-size: 1rem;
    transition: 0.2s ease;
}

.wa-small-btn:hover {
    background: #f3faff;
    border-color: rgba(80, 197, 255, 0.22);
    color: #0f6fa0;
}

.wa-send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 136px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid #00a884;
    background: #00a884;
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(0, 168, 132, 0.20);
    transition: 0.22s ease;
}

.wa-send-btn:hover {
    background: #019270;
    border-color: #019270;
    color: #ffffff;
    transform: translateY(-1px);
}

.wa-send-btn-default,
.wa-send-btn-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wa-send-btn.is-loading .wa-send-btn-default {
    display: none;
}

.wa-send-btn.is-loading .wa-send-btn-loading {
    display: inline-flex !important;
}

.wa-send-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wa-send-btn:disabled:hover {
    background: #00a884;
    border-color: #00a884;
}

.wa-role-pill:disabled,
.wa-small-btn:disabled {
    opacity: 0.6;
    pointer-events: none;
}


/*--------------------------------------------------------------
# Floating Button
--------------------------------------------------------------*/

.wa-floating-latest {
    position: absolute;
    right: 18px;
    bottom: 104px;
    z-index: 9;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 0;
    background: #0f172a;
    color: #fff;
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: 0.22s ease;
}

.wa-floating-latest.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.wa-floating-latest:hover {
    background: #1e293b;
}


/*--------------------------------------------------------------
# Empty State
--------------------------------------------------------------*/

.wa-empty-state {
    padding: 42px 20px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px dashed rgba(15, 23, 42, 0.10);
    text-align: center;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.wa-empty-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 16px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(80, 197, 255, 0.12);
    color: #1fa9ea;
    font-size: 1.45rem;
}

.wa-empty-state h5 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 1.08rem;
    font-weight: 700;
}

.wa-empty-state p {
    margin: 0;
    color: #64748b;
    font-size: 0.94rem;
    line-height: 1.7;
}


/*--------------------------------------------------------------
# Bottom Actions
--------------------------------------------------------------*/

.conversation-bottom-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.conversation-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 700;
    transition: 0.22s ease;
}

.conversation-nav-btn-light {
    background: #fff;
    border-color: rgba(15, 23, 42, 0.08);
    color: #0f172a;
}

.conversation-nav-btn-light:hover {
    background: #f3faff;
    border-color: rgba(80, 197, 255, 0.20);
    color: #0f172a;
}

.conversation-nav-btn-primary {
    background: linear-gradient(180deg, #50c5ff 0%, #26b0f1 100%);
    border-color: #26b0f1;
    color: #fff;
    box-shadow: 0 12px 26px rgba(80, 197, 255, 0.22);
}

.conversation-nav-btn-primary:hover {
    background: linear-gradient(180deg, #42bdf8 0%, #1fa9ea 100%);
    border-color: #1fa9ea;
    color: #fff;
}


/*--------------------------------------------------------------
# Highlight
--------------------------------------------------------------*/

.wa-highlight .wa-msg-bubble {
    box-shadow: 0 0 0 3px rgba(80, 197, 255, 0.18), 0 12px 24px rgba(15, 23, 42, 0.08);
    animation: waPulseHighlight 1.25s ease;
}

@keyframes waPulseHighlight {
    0% {
        transform: scale(1);
    }

    35% {
        transform: scale(1.01);
    }

    100% {
        transform: scale(1);
    }
}


/*--------------------------------------------------------------
# Tablet
--------------------------------------------------------------*/

@media (max-width: 991.98px) {
    .conversation-shell {
        padding: 60px 0;
    }

    .wa-chat-card {
        min-height: 74vh;
        border-radius: 22px;
    }

    .wa-chat-head {
        flex-direction: column;
        align-items: stretch;
    }

    .wa-chat-badges {
        justify-content: flex-start;
    }

    .wa-chat-body {
        max-height: 66vh;
    }

    .wa-msg-bubble-wrap {
        max-width: min(88%, 760px);
    }
}


/*--------------------------------------------------------------
# Mobile
--------------------------------------------------------------*/

@media (max-width: 767.98px) {
    .conversation-shell {
        padding: 56px 0;
    }

    .wa-chat-card {
        min-height: calc(100vh - 170px);
        border-radius: 18px;
    }

    .wa-chat-head {
        padding: 14px;
        gap: 14px;
    }

    .wa-chat-avatar {
        width: 46px;
        height: 46px;
        min-width: 46px;
        font-size: 1rem;
    }

    .wa-chat-user-copy h3 {
        font-size: 0.98rem;
    }

    .wa-chat-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 14px;
    }

    .wa-toolbar-right,
    .wa-toolbar-btn {
        width: 100%;
    }

    .wa-chat-body {
        padding: 14px 10px 18px;
        max-height: 60vh;
    }

    .wa-msg-bubble-wrap {
        max-width: 95%;
    }

    .wa-msg-bubble {
        padding: 11px 12px 9px;
        border-radius: 16px;
    }

    .wa-msg-text {
        font-size: 0.92rem;
    }

    .wa-msg-foot {
        flex-direction: column;
        align-items: flex-start;
    }

    .wa-msg-time {
        align-self: flex-end;
    }

    .wa-composer-shell {
        padding: 10px;
    }

    .wa-composer-topline {
        flex-direction: column;
        align-items: stretch;
    }

    .wa-role-picker {
        width: 100%;
    }

    .wa-role-pill {
        flex: 1 1 auto;
        justify-content: center;
    }

    .wa-role-guest-note {
        width: 100%;
    }

    .wa-composer-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .wa-composer-actions {
        width: 100%;
    }

    .wa-send-btn {
        width: 100%;
        min-width: 0;
    }

    .wa-floating-latest {
        right: 14px;
        bottom: 92px;
        width: 44px;
        height: 44px;
    }

    .conversation-bottom-actions {
        flex-direction: column;
    }

    .conversation-nav-btn {
        width: 100%;
    }
}


/*--------------------------------------------------------------
# Small Phones
--------------------------------------------------------------*/

@media (max-width: 479.98px) {

    .wa-chat-head,
    .wa-chat-toolbar,
    .wa-composer-shell {
        padding-left: 12px;
        padding-right: 12px;
    }

    .wa-chat-body {
        padding-left: 10px;
        padding-right: 10px;
    }

    .wa-msg-bubble-wrap {
        max-width: 96%;
    }

    .wa-msg-action-btn {
        font-size: 0.78rem;
        padding: 0 10px;
    }

    .wa-msg-icon-btn {
        width: 32px;
        min-width: 32px;
        height: 32px;
    }

    .wa-send-btn {
        min-height: 46px;
        padding: 0 14px;
        font-size: 0.9rem;
    }
}