/* ==========================================================================
   Aesthetic First - WhatsApp Chat ([generate_chat], whatsapp_chat.js)
   WhatsApp layout with the portal design: Rose Gold for our messages and actions.
   ========================================================================== */

.wa-chat {
    --wa-primary: var(--color-primary, #936179);
    --wa-primary-hover: #7d4f64;
    --wa-primary-soft: #f6ecf1;
    --wa-text: var(--color-text, #1e293b);
    --wa-muted: var(--color-text-muted, #64748b);
    --wa-border: #e2e8f0;
    --wa-input-border: var(--color-border, #cbd5e1);
    --wa-bg: var(--color-bg-light, #f8fafc);
    --wa-hover: var(--color-bg-hover, #f1f5f9);
    --wa-read: var(--color-secondary, #3b82f6);
    --wa-error: var(--color-error, #ef4444);
    --wa-whatsapp: #25d366;
    --wa-radius: 12px;

    position: relative;
    display: flex;
    flex-direction: column;
    /* --wa-chat-height: shortcode parameter height */
    height: var(--wa-chat-height, min(78vh, 820px));
    min-height: 480px;
    margin: 1.5rem 0;
    background: var(--color-bg-white, #ffffff);
    border: 1px solid var(--wa-border);
    border-radius: var(--wa-radius);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
    overflow: hidden;
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
    font-size: 14px;
    color: var(--wa-text);
    box-sizing: border-box;
}

.wa-chat *,
.wa-chat *::before,
.wa-chat *::after {
    box-sizing: border-box;
}

.wa-chat [hidden] {
    display: none !important;
}

.wa-chat button {
    font-family: inherit !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    min-height: 0 !important;
    margin: 0;
    cursor: pointer;
}

.wa-chat button:disabled {
    cursor: not-allowed;
}

/* --- Header --- */
.wa-chat-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-bg-white, #ffffff);
    border-bottom: 1px solid var(--wa-border);
}

/* Optional back button ([generate_chat back_url="…"]) */
.wa-chat-back {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin-right: -4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    color: var(--wa-muted) !important;
    font-size: 16px;
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.wa-chat-back:hover,
.wa-chat-back:focus-visible {
    background: var(--wa-hover);
    color: var(--wa-primary) !important;
}

.wa-chat-avatar {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wa-primary), #b98aa0);
    color: #ffffff;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-chat-contact {
    min-width: 0;
    flex: 1;
}

.wa-chat-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-chat-phone {
    font-size: 12.5px;
    color: var(--wa-muted);
}

.wa-chat-phone i {
    color: var(--wa-whatsapp);
}

/* "schreibt …" replaces the phone number while new messages appear (whatsapp_chat.js, showTyping) */
.wa-chat-typing-label {
    display: none;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--wa-primary);
}

.wa-chat.is-typing .wa-chat-phone {
    display: none;
}

.wa-chat.is-typing .wa-chat-typing-label {
    display: block;
}

.wa-chat-window {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--border-radius-full, 100px);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid transparent;
}

.wa-chat-window.is-open {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.wa-chat-window.is-closed {
    background: var(--wa-hover);
    border-color: var(--wa-border);
    color: var(--wa-muted);
}

.wa-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

/* --- Message area --- */
.wa-chat-main {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
}

.wa-chat-body {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 20px 20px;
    background-color: var(--wa-bg);
    background-image: radial-gradient(rgba(147, 97, 121, 0.08) 1px, transparent 1px);
    background-size: 18px 18px;
}

/* Thin Rose Gold scrollbar, like in the emoji picker (EMOJI_PICKER_STYLE in whatsapp_chat.js) */
.wa-chat-body::-webkit-scrollbar {
    width: 10px;
}

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

.wa-chat-body::-webkit-scrollbar-button {
    display: none;
}

.wa-chat-body::-webkit-scrollbar-thumb {
    background-color: rgba(147, 97, 121, 0.3);
    background-clip: padding-box;
    border: 3px solid transparent;
    border-radius: var(--border-radius-full, 100px);
}

.wa-chat-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(147, 97, 121, 0.55);
}

@supports not selector(::-webkit-scrollbar) {
    .wa-chat-body {
        scrollbar-width: thin;
        scrollbar-color: rgba(147, 97, 121, 0.35) transparent;
    }
}

.wa-chat-messages {
    display: flex;
    flex-direction: column;
}

.wa-chat-load-more {
    display: block;
    margin: 4px auto 8px !important;
    padding: 6px 14px !important;
    background: var(--color-bg-white, #ffffff) !important;
    border: 1px solid var(--wa-input-border) !important;
    border-radius: var(--border-radius-full, 100px) !important;
    color: var(--wa-text) !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    box-shadow: none !important;
}

.wa-chat-load-more:hover {
    background: var(--wa-hover) !important;
    border-color: var(--color-border-hover, #94a3b8) !important;
    color: var(--wa-text) !important;
}

.wa-chat-empty-state,
.wa-chat-empty {
    margin: auto;
    padding: 48px 16px;
    text-align: center;
    color: var(--wa-muted);
}

.wa-chat-empty-state i {
    font-size: 36px;
    color: var(--wa-whatsapp);
    opacity: 0.7;
}

.wa-chat-empty-state p {
    margin: 10px 0 0;
}

.wa-chat-empty i {
    color: #f59e0b;
}

/* --- Day separator & unread divider --- */
.wa-day {
    display: flex;
    justify-content: center;
    margin: 14px 0 6px;
}

.wa-day span {
    padding: 4px 12px;
    background: var(--color-bg-white, #ffffff);
    border: 1px solid var(--wa-border);
    border-radius: var(--border-radius-full, 100px);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
    font-size: 12px;
    font-weight: 500;
    color: var(--wa-muted);
}

.wa-unread-divider {
    max-height: 40px;
    margin: 12px -20px 4px;
    padding: 5px 0;
    overflow: hidden;
    text-align: center;
    background: rgba(147, 97, 121, 0.1);
    transition: opacity 0.4s ease, max-height 0.4s ease, margin 0.4s ease, padding 0.4s ease;
}

.wa-unread-divider.is-hiding {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.wa-unread-divider span {
    font-size: 12px;
    font-weight: 600;
    color: var(--wa-primary);
}

/* --- Messages --- */
.wa-msg {
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 72%;
    margin-top: 2px;
}

.wa-msg.is-group-start {
    margin-top: 10px;
}

.wa-msg-in {
    align-self: flex-start;
    align-items: flex-start;
}

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

.wa-bubble {
    position: relative;
    display: flow-root;
    min-width: 80px;
    max-width: 100%;
    padding: 6px 9px 6px 10px;
    border-radius: 10px;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.1);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.wa-msg-in .wa-bubble {
    background: var(--color-bg-white, #ffffff);
}

.wa-msg-out .wa-bubble {
    background: var(--wa-primary-soft);
}

/* Tail on the first message of a group */
.wa-msg-in.is-group-start .wa-bubble {
    border-top-left-radius: 0;
}

.wa-msg-out.is-group-start .wa-bubble {
    border-top-right-radius: 0;
}

.wa-msg.is-group-start .wa-bubble::before {
    content: "";
    position: absolute;
    top: 0;
    width: 8px;
    height: 12px;
}

.wa-msg-in.is-group-start .wa-bubble::before {
    left: -7px;
    background: var(--color-bg-white, #ffffff);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.wa-msg-out.is-group-start .wa-bubble::before {
    right: -7px;
    background: var(--wa-primary-soft);
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.wa-msg-out .wa-bubble.is-failed,
.wa-msg-out.is-group-start .wa-bubble.is-failed::before {
    background: #fef2f2;
}

/* Messages of the queue still to be sent: pill at the end of the chat, opened as dashed "ghost" bubbles */
.wa-scheduled {
    display: flex;
    flex-direction: column;
    margin-top: 16px;
}

.wa-scheduled-toggle {
    align-self: center;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 5px 12px !important;
    background: var(--color-bg-white, #ffffff) !important;
    border: 1px dashed rgba(147, 97, 121, 0.55) !important;
    border-radius: var(--border-radius-full, 100px) !important;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1)) !important;
    color: var(--wa-primary) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
}

.wa-scheduled-toggle:hover {
    background: var(--wa-primary-soft) !important;
    color: var(--wa-primary) !important;
}

.wa-scheduled-chevron {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.wa-scheduled.is-open .wa-scheduled-chevron {
    transform: rotate(180deg);
}

.wa-scheduled-list {
    display: flex;
    flex-direction: column;
    margin-top: 4px;
}

.wa-msg.is-scheduled {
    margin-top: 8px;
}

.wa-msg.is-scheduled .wa-bubble {
    background: rgba(246, 236, 241, 0.5);
    border: 1px dashed rgba(147, 97, 121, 0.5);
    box-shadow: none;
}

.wa-msg.is-scheduled .wa-bubble > :not(.wa-template-label):not(.wa-meta) {
    opacity: 0.8;
}

a.wa-template-label.is-scheduled {
    text-decoration: none !important;
    color: var(--wa-primary) !important;
}

a.wa-template-label.is-scheduled:hover {
    text-decoration: underline !important;
}

/* Typing bubble with three bouncing dots, then new messages slide in */
.wa-typing .wa-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 12px 14px;
}

.wa-typing .wa-bubble span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--wa-muted);
    opacity: 0.5;
    animation: wa-typing-dot 1.2s ease-in-out infinite;
}

.wa-typing .wa-bubble span:nth-child(2) {
    animation-delay: 0.15s;
}

.wa-typing .wa-bubble span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes wa-typing-dot {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.wa-typing {
    animation: wa-msg-in 0.2s ease-out both;
}

.wa-msg.is-new {
    animation: wa-msg-in 0.28s ease-out both;
    animation-delay: var(--wa-delay, 0ms);
}

@keyframes wa-msg-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wa-typing .wa-bubble span,
    .wa-typing,
    .wa-msg.is-new {
        animation: none;
    }
}

.wa-msg.is-highlighted .wa-bubble {
    animation: wa-highlight 1.6s ease;
}

@keyframes wa-highlight {
    0%,
    40% {
        box-shadow: 0 0 0 3px rgba(147, 97, 121, 0.45);
    }
    100% {
        box-shadow: 0 1px 1px rgba(15, 23, 42, 0.1);
    }
}

.wa-text {
    display: inline;
    white-space: pre-wrap;
    font-size: 14.2px;
}

.wa-text.is-unsupported {
    font-style: italic;
    color: var(--wa-muted);
}

.wa-text a {
    color: var(--wa-read);
    text-decoration: underline;
}

.wa-text code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    padding: 0 4px;
    background: rgba(15, 23, 42, 0.06);
    border-radius: 4px;
}

.wa-template-label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--wa-primary);
}

/* Template parts: bold header, small footer (with the time next to it), buttons at the bottom of the bubble */
.wa-template-header {
    margin-bottom: 2px;
    font-weight: 700;
    font-size: 14.5px;
}

.wa-bubble.has-footer .wa-text {
    display: block;
}

.wa-template-footer {
    display: inline;
    font-size: 12.5px;
    color: var(--wa-muted);
}

.wa-template-buttons {
    clear: both;
    margin: 6px -9px -6px -10px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

.wa-template-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    color: var(--wa-read) !important;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none !important;
}

.wa-template-button + .wa-template-button {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

a.wa-template-button:hover {
    background: rgba(15, 23, 42, 0.04);
    color: var(--wa-read) !important;
}

/* Time and status, next to the last line of text like in WhatsApp */
.wa-meta {
    float: right;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 5px 0 -3px 12px;
    font-size: 11px;
    line-height: 1.2;
    color: var(--wa-muted);
    white-space: nowrap;
}

.wa-tick {
    font-size: 11px;
}

.wa-tick.is-read {
    color: var(--wa-read);
}

.wa-tick.is-failed {
    color: var(--wa-error);
}

/* --- Quotes --- */
.wa-quote,
.wa-chat-reply-quote {
    display: flex !important;
    flex-direction: column;
    gap: 1px;
    width: 100%;
    min-width: 180px;
    margin: 0 0 5px !important;
    padding: 5px 9px !important;
    text-align: left;
    background: rgba(15, 23, 42, 0.05) !important;
    border: none !important;
    border-left: 3px solid var(--wa-read) !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    color: var(--wa-text) !important;
    line-height: 1.35 !important;
}

.wa-quote:hover {
    background: rgba(15, 23, 42, 0.09) !important;
    color: var(--wa-text) !important;
}

.wa-quote.is-out,
.wa-chat-reply-quote.is-out {
    border-left-color: var(--wa-primary) !important;
}

.wa-msg-out .wa-quote {
    background: rgba(147, 97, 121, 0.1) !important;
}

.wa-quote.is-missing {
    border-left-color: var(--wa-border) !important;
    font-style: italic;
}

.wa-quote-author {
    font-size: 12px;
    font-weight: 600;
    color: var(--wa-read);
}

.is-out > .wa-quote-author {
    color: var(--wa-primary);
}

.wa-quote-text {
    font-size: 12.5px;
    color: var(--wa-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
}

/* --- Files --- */
.wa-bubble.has-media {
    padding: 4px 4px 6px;
}

.wa-bubble.has-media .wa-text,
.wa-bubble.has-media .wa-template-label {
    padding: 0 6px;
}

.wa-bubble.has-media .wa-meta {
    margin-right: 6px;
}

.wa-media-link {
    display: block;
}

.wa-media {
    display: block;
    width: 100%;
    max-width: 300px;
    max-height: 340px;
    object-fit: cover;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.06);
}

.wa-bubble.is-sticker {
    background: transparent !important;
    box-shadow: none;
    padding: 0;
}

.wa-bubble.is-sticker::before {
    display: none;
}

.wa-media-sticker {
    max-width: 140px;
    object-fit: contain;
    background: transparent;
}

.wa-audio {
    display: block;
    width: 270px;
    max-width: 100%;
    height: 40px;
    margin: 2px 0;
}

.wa-file {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    margin-bottom: 2px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.05);
    border-radius: 8px;
    color: var(--wa-text) !important;
    text-decoration: none !important;
    transition: background 0.15s ease;
}

a.wa-file:hover {
    background: rgba(15, 23, 42, 0.09);
}

.wa-file-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-white, #ffffff);
    color: var(--wa-primary);
    font-size: 16px;
}

.wa-file-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.wa-file-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-file.is-unavailable .wa-file-name {
    font-weight: 400;
    font-style: italic;
    white-space: normal;
    color: var(--wa-muted);
}

.wa-file-size {
    font-size: 11.5px;
    color: var(--wa-muted);
}

.wa-file-download {
    color: var(--wa-muted);
}

/* --- Reactions --- */
.wa-reactions {
    display: flex;
    gap: 3px;
    margin-top: -5px;
    padding: 0 8px;
    position: relative;
    z-index: 1;
}

.wa-reaction {
    display: inline-flex !important;
    align-items: center;
    padding: 1px 6px !important;
    background: var(--color-bg-white, #ffffff) !important;
    border: 1px solid var(--wa-border) !important;
    border-radius: var(--border-radius-full, 100px) !important;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1)) !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    color: var(--wa-text) !important;
}

button.wa-reaction:hover {
    border-color: var(--wa-primary) !important;
    background: var(--wa-primary-soft) !important;
    color: var(--wa-text) !important;
}

.wa-chat.is-closed button.wa-reaction {
    pointer-events: none;
}

/* --- Actions on hover (reply, react) --- */
.wa-msg-actions {
    position: absolute;
    top: 4px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.wa-msg-in .wa-msg-actions {
    left: 100%;
    margin-left: 8px;
}

.wa-msg-out .wa-msg-actions {
    right: 100%;
    margin-right: 8px;
}

.wa-msg:hover .wa-msg-actions,
.wa-msg:focus-within .wa-msg-actions {
    opacity: 1;
}

.wa-chat.is-closed .wa-msg-actions {
    display: none;
}

.wa-action {
    width: 28px;
    height: 28px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-white, #ffffff) !important;
    border: 1px solid var(--wa-border) !important;
    border-radius: 50% !important;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1)) !important;
    color: var(--wa-muted) !important;
    font-size: 12px !important;
    line-height: 1 !important;
}

.wa-action:hover {
    background: var(--color-bg-white, #ffffff) !important;
    border-color: var(--wa-primary) !important;
    color: var(--wa-primary) !important;
}

.wa-reaction-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    z-index: 20;
    display: flex;
    gap: 2px;
    margin-bottom: 6px;
    padding: 4px 6px;
    background: var(--color-bg-white, #ffffff);
    border: 1px solid var(--wa-border);
    border-radius: var(--border-radius-full, 100px);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05));
    animation: wa-pop 0.15s ease-out;
}

.wa-reaction-picker button {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    font-size: 20px !important;
    line-height: 1 !important;
    color: var(--wa-text) !important;
    transition: transform 0.12s ease, background 0.12s ease;
}

.wa-reaction-picker button:hover {
    transform: scale(1.2);
    background: var(--wa-hover) !important;
    color: var(--wa-text) !important;
}

.wa-reaction-picker button.is-active {
    background: var(--wa-primary-soft) !important;
}

.wa-reaction-picker .wa-reaction-more {
    margin-left: 2px;
    background: var(--wa-hover) !important;
    color: var(--wa-muted) !important;
    font-size: 14px !important;
}

.wa-reaction-picker .wa-reaction-more:hover {
    transform: none;
    background: var(--wa-primary-soft) !important;
    color: var(--wa-primary) !important;
}

@keyframes wa-pop {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.wa-msg-error {
    margin-top: 3px;
    font-size: 12px;
    color: var(--wa-error);
}

/* --- Floating controls --- */
.wa-chat-scroll-down {
    position: absolute;
    right: 18px;
    bottom: 16px;
    z-index: 5;
    width: 40px;
    height: 40px;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-white, #ffffff) !important;
    border: 1px solid var(--wa-border) !important;
    border-radius: 50% !important;
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)) !important;
    color: var(--wa-muted) !important;
}

.wa-chat-scroll-down:hover {
    background: var(--color-bg-white, #ffffff) !important;
    color: var(--wa-primary) !important;
}

.wa-chat-scroll-badge {
    position: absolute;
    top: -6px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--border-radius-full, 100px);
    background: var(--wa-primary);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

.wa-chat-toast {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    max-width: 90%;
    padding: 9px 14px;
    background: var(--wa-text);
    color: #ffffff;
    border-radius: var(--border-radius-md, 8px);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05));
    font-size: 13px;
    animation: wa-pop 0.15s ease-out;
}

/* --- Footer: notice, reply bar, composer --- */
.wa-chat-footer {
    padding: 10px 12px 12px;
    background: var(--color-bg-white, #ffffff);
    border-top: 1px solid var(--wa-border);
}

.wa-chat-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--border-radius-md, 8px);
    color: #92400e;
    font-size: 13px;
    line-height: 1.45;
}

.wa-chat-notice i {
    margin-top: 2px;
}

.wa-chat-reply {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.wa-chat-reply-quote {
    flex: 1;
    min-width: 0;
    margin: 0 !important;
}

.wa-chat-composer {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 0;
}

.wa-chat-input {
    flex: 1;
    min-height: 44px !important;
    max-height: 140px;
    height: 44px;
    margin: 0 !important;
    padding: 11px 16px !important;
    resize: none !important;
    background: var(--color-bg-white, #ffffff) !important;
    border: 1px solid var(--wa-input-border) !important;
    border-radius: 22px !important;
    box-shadow: none !important;
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
    color: var(--wa-text) !important;
    outline: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wa-chat-input:hover {
    border-color: var(--color-border-hover, #94a3b8) !important;
}

.wa-chat-input:focus {
    border-color: var(--wa-primary) !important;
    box-shadow: 0 0 0 3px rgba(147, 97, 121, 0.15) !important;
}

.wa-chat-input:disabled {
    background: var(--wa-hover) !important;
    border-color: var(--wa-border) !important;
    color: var(--wa-muted) !important;
    cursor: not-allowed;
}

.wa-chat-icon-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    color: var(--wa-muted) !important;
    font-size: 20px !important;
}

.wa-chat-icon-btn:hover {
    background: var(--wa-hover) !important;
    color: var(--wa-primary) !important;
}

.wa-chat-icon-btn:disabled {
    opacity: 0.45;
    background: transparent !important;
    color: var(--wa-muted) !important;
}

.wa-chat-reply .wa-chat-icon-btn {
    width: 32px;
    height: 32px;
    font-size: 15px !important;
}

.wa-chat-send {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: var(--wa-primary) !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    color: #ffffff !important;
    font-size: 16px !important;
    transition: background 0.2s ease, transform 0.1s ease;
}

.wa-chat-send:hover {
    background: var(--wa-primary-hover) !important;
    color: #ffffff !important;
}

.wa-chat-send:active:not(:disabled) {
    transform: scale(0.94);
}

.wa-chat-send:disabled {
    background: var(--color-border, #cbd5e1) !important;
    color: #ffffff !important;
}

/* --- Emoji pickers (emoji-picker-element): composer panel and reactions --- */
.wa-chat-emoji-panel,
.wa-emoji-popover {
    z-index: 25;
    width: 360px;
    max-width: calc(100% - 16px);
    height: 400px;
    overflow: hidden;
    background: var(--color-bg-white, #ffffff);
    border: 1px solid var(--wa-border);
    border-radius: var(--wa-radius);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05));
    animation: wa-pop 0.15s ease-out;
}

.wa-chat-emoji-panel {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
}

.wa-emoji-popover {
    position: absolute;
    z-index: 30;
}

.wa-emoji-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    color: var(--wa-muted);
    font-size: 13px;
}

.wa-chat emoji-picker {
    --background: var(--color-bg-white, #ffffff);
    --border-color: var(--wa-border);
    --border-size: 1px;
    --button-active-background: var(--wa-primary-soft);
    --button-hover-background: var(--wa-hover);
    --category-font-color: var(--wa-muted);
    --category-font-size: 0.8rem;
    --emoji-padding: 0.35rem;
    --emoji-size: 1.5rem;
    --indicator-color: var(--wa-primary);
    --input-border-color: var(--wa-input-border);
    --input-border-radius: var(--border-radius-full, 100px);
    --input-font-color: var(--wa-text);
    --input-font-size: 14px;
    --input-padding: 0.45rem 0.9rem;
    --input-placeholder-color: var(--wa-muted);
    --num-columns: 8;
    --outline-color: var(--wa-primary);
    width: 100%;
    height: 100%;
    border: none;
    font-family: inherit;
}

/* --- Small screens --- */
@media (max-width: 640px) {
    .wa-chat {
        height: var(--wa-chat-height, calc(100vh - 140px));
        min-height: 420px;
    }

    .wa-chat-body {
        padding: 10px 12px 16px;
    }

    .wa-unread-divider {
        margin-left: -12px;
        margin-right: -12px;
    }

    .wa-msg {
        max-width: 86%;
    }

    .wa-msg-actions {
        flex-direction: column;
    }

    .wa-chat emoji-picker {
        --num-columns: 7;
    }

    .wa-chat-emoji-panel,
    .wa-emoji-popover {
        height: 340px;
    }

    .wa-chat-window {
        order: 3;
        width: 100%;
        justify-content: center;
    }
}

/* Touch screens have no hover: keep the actions visible */
@media (hover: none) {
    .wa-msg-actions {
        opacity: 0.85;
    }
}
