.wa-chat-root {
    position: fixed;
    bottom: 15px;
    left: 15px;
    z-index: 999997;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Rubik", "Heebo", sans-serif;
    direction: rtl;
}

.wa-launcher-wrap {
    position: relative;
    display: inline-block;
}

.wa-launcher-btn {
    width: 58px;
    height: 58px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
    position: relative;
    border: 3px solid #ffffff;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    outline: none;
    padding: 0;
}

.wa-launcher-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45);
}

.wa-launcher-btn:active {
    transform: scale(0.96);
}

.wa-launcher-icon {
    width: 32px;
    height: 32px;
    fill: #ffffff;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.wa-launcher-close-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #374151;
    color: #ffffff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid #ffffff;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    z-index: 3;
    transition: transform 0.15s ease, background-color 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.wa-launcher-close-badge:hover {
    background: #111827;
    transform: scale(1.15);
}

.wa-chat-root.is-open .wa-launcher-close-badge {
    display: flex;
}

.wa-launcher-close-badge.is-hidden {
    display: none !important;
}

.wa-chat-panel {
    position: absolute;
    bottom: 74px;
    left: 0;
    width: 360px;
    max-width: calc(100vw - 30px);
    background: #ece5dd;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.96);
    transform-origin: bottom left;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.28s;
    display: flex;
    flex-direction: column;
}

.wa-chat-root.is-open .wa-chat-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.wa-panel-header {
    background: #064e3b;
    color: #ffffff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.wa-dismiss-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: background 0.2s ease, transform 0.15s ease;
    padding: 0;
    order: 3;
}

.wa-dismiss-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.wa-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    order: 1;
    flex: 1;
}

.wa-brand-avatar {
    width: 44px;
    height: 44px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.6);
    overflow: hidden;
    padding: 3px;
    box-sizing: border-box;
}

.wa-brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    display: block;
}

.wa-brand-meta {
    text-align: right;
}

.wa-brand-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.25;
}

.wa-brand-subtitle {
    margin: 3px 0 0;
    font-size: 12px;
    color: #a7f3d0;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.wa-pulse-indicator {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: waPulse 2s infinite;
}

@keyframes waPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.wa-panel-body {
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 490px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.wa-bubble-msg {
    background: #ffffff;
    color: #111b21;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    max-width: 86%;
    align-self: flex-start;
    animation: waBubbleIn 0.25s ease forwards;
    word-break: break-word;
}

.wa-bubble-user {
    background: #d9fdd3;
    color: #111b21;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    max-width: 86%;
    align-self: flex-end;
    animation: waBubbleIn 0.25s ease forwards;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

@keyframes waBubbleIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* WhatsApp Typing Indicator */
.wa-typing-indicator {
    background: #ffffff;
    color: #64748b;
    padding: 10px 16px;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    animation: waBubbleIn 0.2s ease forwards;
}

.wa-typing-label {
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}

.wa-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.wa-typing-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    animation: waTypingBounce 1.4s infinite ease-in-out;
}

.wa-typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.wa-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.wa-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes waTypingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

.wa-cards-container {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 4px;
}

.wa-option-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1),
                box-shadow 0.2s ease,
                border-color 0.2s ease;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    font-family: inherit;
    text-align: right;
}

button.wa-option-card {
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.wa-option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.09);
    border-color: #064e3b;
}

.wa-option-card:active {
    transform: translateY(0);
}

.wa-option-info {
    flex: 1;
    text-align: right;
}

.wa-option-title {
    color: #064e3b;
    font-size: 14.5px;
    font-weight: 800;
    margin-bottom: 3px;
    line-height: 1.25;
}

.wa-option-desc {
    color: #64748b;
    font-size: 11.5px;
    line-height: 1.35;
    margin: 0;
}

.wa-option-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.badge-bg-bubble {
    background: #ecfeff;
}

.badge-bg-bell {
    background: #fef3c7;
}

.badge-bg-users {
    background: #e0f2fe;
}

.badge-bg-telegram {
    background: #e0f2fe;
}

.badge-bg-share {
    background: #f5f3ff;
}

.wa-option-badge svg {
    width: 22px;
    height: 22px;
}

/* WhatsApp Input Simulation Card */
.wa-chat-input-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(226, 232, 240, 0.9);
    animation: waBubbleIn 0.25s ease forwards;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.wa-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wa-chat-text-input {
    flex: 1;
    border: 1.5px solid #d1d5db;
    border-radius: 14px;
    padding: 9px 12px;
    font-size: 14.5px;
    direction: ltr;
    text-align: right;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color: #111b21;
}

.wa-chat-text-input:focus {
    border-color: #25d366;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
}

.wa-chat-send-btn {
    background: #25d366;
    color: #ffffff;
    border: none;
    border-radius: 14px;
    padding: 9px 20px;
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.15s ease;
    font-family: inherit;
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.3);
}

.wa-chat-send-btn:hover {
    background: #20bd5a;
    transform: scale(1.02);
}

.wa-chat-send-btn:active {
    transform: scale(0.98);
}

.wa-chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wa-chat-consent-row {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
    font-size: 11.5px;
    color: #475569;
    cursor: pointer;
    margin: 0;
    user-select: none;
    line-height: 1.35;
}

.wa-chat-consent-row input[type="checkbox"] {
    accent-color: #25d366;
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 1px 0 0 0;
    flex-shrink: 0;
}

.wa-consent-text {
    flex: 1;
}

.wa-consent-optout {
    display: inline-block;
    color: #64748b;
    font-size: 11px;
}

/* Inline action button (Join telegram / Open coupons) */
.wa-share-action-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(226, 232, 240, 0.9);
    animation: waBubbleIn 0.25s ease forwards;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.wa-share-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.wa-share-btn-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease, opacity 0.2s ease;
}

.wa-share-btn-item:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

.wa-share-btn-wa {
    background: #25d366;
    color: #ffffff !important;
}

.wa-share-btn-tg {
    background: #229ed9;
    color: #ffffff !important;
}

.wa-share-btn-copy {
    background: #f1f5f9;
    color: #334155 !important;
    grid-column: span 2;
    border: 1px solid #cbd5e1;
}

.wa-share-btn-copy.copied {
    background: #ecfdf5;
    color: #065f46 !important;
    border-color: #a7f3d0;
}

.wa-chat-inline-action {
    background: #064e3b;
    color: #ffffff !important;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 14px;
    font-size: 13.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    align-self: flex-start;
    box-shadow: 0 2px 6px rgba(6, 78, 59, 0.25);
    transition: transform 0.2s ease, background 0.2s ease;
    animation: waBubbleIn 0.25s ease forwards;
}

.wa-chat-inline-action:hover {
    background: #047857;
    transform: translateY(-1px);
}

/* Return to Menu Button */
.wa-chat-back-wrap {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 4px;
    animation: waBubbleIn 0.25s ease forwards;
}

.wa-chat-back-btn {
    background: none;
    border: none;
    color: #4b5563;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    transition: color 0.2s ease, transform 0.15s ease;
    font-family: inherit;
}

.wa-chat-back-btn u {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.wa-chat-back-btn:hover {
    color: #064e3b;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .wa-chat-root {
        bottom: 75px;
        left: 15px;
        z-index: 1000000;
    }

    /* Accessibility toggle pinned right above chat button */
    #a11y-toggle {
        bottom: 135px !important;
        left: 15px !important;
        width: 50px !important;
        height: 50px !important;
        z-index: 1000001 !important;
        display: flex !important;
    }

    .wa-launcher-btn {
        width: 50px;
        height: 50px;
    }

    .wa-launcher-icon {
        width: 26px;
        height: 26px;
    }

    .wa-launcher-close-badge {
        width: 20px;
        height: 20px;
        font-size: 10px;
        top: -3px;
        right: -3px;
    }

    /* Compact Mobile Chat Panel */
    .wa-chat-panel {
        bottom: 58px;
        left: 0;
        width: calc(100vw - 36px);
        max-width: 330px;
        max-height: 62vh;
        border-radius: 18px;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
    }

    .wa-panel-header {
        padding: 11px 13px;
    }

    .wa-brand-avatar {
        width: 36px;
        height: 36px;
    }

    .wa-brand-title {
        font-size: 15px;
    }

    .wa-brand-subtitle {
        font-size: 11px;
    }

    .wa-panel-body {
        max-height: calc(62vh - 64px);
        padding: 11px 10px;
        gap: 8px;
    }

    .wa-bubble-msg,
    .wa-bubble-user {
        font-size: 13px;
        padding: 8px 11px;
        border-radius: 13px;
        max-width: 90%;
    }

    .wa-option-card {
        padding: 9px 11px;
        border-radius: 13px;
        gap: 9px;
    }

    .wa-option-title {
        font-size: 13px;
        margin-bottom: 2px;
    }

    .wa-option-desc {
        font-size: 10.5px;
    }

    .wa-option-badge {
        width: 36px;
        height: 36px;
    }

    .wa-option-badge svg {
        width: 18px;
        height: 18px;
    }

    .wa-chat-input-card {
        padding: 10px 11px;
        border-radius: 14px;
        gap: 8px;
    }

    .wa-chat-text-input {
        font-size: 13.5px;
        padding: 8px 10px;
        border-radius: 11px;
    }

    .wa-chat-send-btn {
        font-size: 13px;
        padding: 8px 15px;
        border-radius: 11px;
    }

    .wa-chat-consent-row {
        font-size: 10.5px;
    }

    .wa-share-action-card {
        padding: 10px;
        border-radius: 14px;
    }

    .wa-share-btn-item {
        font-size: 12px;
        padding: 7px 10px;
        border-radius: 10px;
    }

    .wa-chat-back-btn {
        font-size: 12px;
        padding: 4px 8px;
    }
}
