/* =========================================================================
 * WhatsApp & Telegram floating widget — self-contained, no external image dependencies.
 * RTL-aware via inset-inline-end.
 * ========================================================================= */

/* ------------- 1. WHATSAPP STYLES (ORIGINAL) ------------- */
.whatsapp-chat-button {
    position: fixed;
    bottom: 24px;
    inset-inline-end: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #fff;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(37, 211, 102, 0.42),
                0 0 0 6px rgba(37, 211, 102, 0.12);
    z-index: 1050;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}
.whatsapp-chat-button:hover,
.whatsapp-chat-button:focus-visible {
    transform: scale(1.07);
    box-shadow: 0 14px 32px rgba(37, 211, 102, 0.55),
                0 0 0 10px rgba(37, 211, 102, 0.18);
    outline: none;
}
.whatsapp-chat-button i { font-size: 30px; line-height: 1; }
@keyframes whatsappPulse {
    0%   { box-shadow: 0 10px 28px rgba(37, 211, 102, 0.42), 0 0 0 0   rgba(37, 211, 102, 0.45); }
    70%  { box-shadow: 0 10px 28px rgba(37, 211, 102, 0.42), 0 0 0 18px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 10px 28px rgba(37, 211, 102, 0.42), 0 0 0 0   rgba(37, 211, 102, 0); }
}
.whatsapp-chat-button { animation: whatsappPulse 2.4s ease-out infinite; }
@media (prefers-reduced-motion: reduce) {
    .whatsapp-chat-button { animation: none; }
}

.whatsapp-chat-widget {
    position: fixed;
    bottom: 96px;
    inset-inline-end: 24px;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    color: #0b0e17;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
    display: none;
    flex-direction: column;
    z-index: 1050;
    font-family: 'Poppins', system-ui, -apple-system, Arial, sans-serif;
    overflow: hidden;
    transform: translateY(16px) scale(0.97);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.whatsapp-chat-widget.show {
    display: flex;
    transform: translateY(0) scale(1);
    opacity: 1;
}

.whatsapp-chat-widget .widget-header {
    background: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.whatsapp-chat-widget .widget-header .profile-pic {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    flex: 0 0 auto;
}
.whatsapp-chat-widget .widget-header .profile-info h4 {
    margin: 0 0 2px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}
.whatsapp-chat-widget .widget-header .profile-info p {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.95;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.whatsapp-chat-widget .widget-header .status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #b6ffb6;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.whatsapp-chat-widget .widget-body {
    padding: 18px;
    flex-grow: 1;
    background:
        radial-gradient(circle at 20% 20%, rgba(37, 211, 102, 0.08) 0 1px, transparent 2px),
        radial-gradient(circle at 80% 60%, rgba(18, 140, 126, 0.07) 0 1px, transparent 2px),
        linear-gradient(180deg, #ECE5DD 0%, #E5DDD5 100%);
    background-size: 22px 22px, 18px 18px, auto;
}
.whatsapp-chat-widget .message-container {
    background: #fff;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    position: relative;
    color: #1f2937;
}
.whatsapp-chat-widget .message-container::before {
    content: "";
    position: absolute;
    top: 10px;
    inset-inline-start: -6px;
    width: 0; height: 0;
    border-style: solid;
    border-width: 0 10px 10px 0;
    border-color: transparent #fff transparent transparent;
}
html[dir="rtl"] .whatsapp-chat-widget .message-container::before {
    inset-inline-start: auto;
    inset-inline-end: -6px;
    border-width: 0 0 10px 10px;
    border-color: transparent transparent transparent #fff;
}
.whatsapp-chat-widget .message-container p {
    margin: 0;
    line-height: 1.5;
    font-size: 0.92rem;
}

.whatsapp-chat-widget .widget-footer {
    padding: 14px;
    background: #f6f6f6;
}
.whatsapp-chat-widget .widget-footer .btn-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #fff !important;
    text-align: center;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    transition: filter 0.2s ease, transform 0.2s ease;
    box-shadow: 0 8px 18px rgba(37, 211, 102, 0.35);
}
.whatsapp-chat-widget .widget-footer .btn-chat:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}
.whatsapp-chat-widget .widget-footer .btn-chat i {
    font-size: 1.05rem;
}

/* Common Widget Channels (Social Links) */
.widget-channels {
    list-style: none;
    margin: 12px 0 0;
    padding: 10px 0 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.widget-channels li { margin: 0; }
.widget-channels a {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #475569;
    text-decoration: none;
    font-size: 0.95rem;
    transition: transform 0.18s ease, background 0.18s ease,
                border-color 0.18s ease, color 0.18s ease,
                box-shadow 0.18s ease;
}
.widget-channels a:hover {
    transform: translateY(-2px);
    background: #f89c2d;
    border-color: #f89c2d;
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(248, 156, 45, 0.35);
}

/* ------------- 2. TELEGRAM STYLES (NEW) ------------- */
.telegram-chat-button {
    position: fixed;
    bottom: 24px;
    inset-inline-end: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2AABEE 0%, #229ED9 100%);
    color: #fff;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(34, 158, 217, 0.42),
                0 0 0 6px rgba(34, 158, 217, 0.12);
    z-index: 1050;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}
.telegram-chat-button:hover,
.telegram-chat-button:focus-visible {
    transform: scale(1.07);
    box-shadow: 0 14px 32px rgba(34, 158, 217, 0.55),
                0 0 0 10px rgba(34, 158, 217, 0.18);
    outline: none;
}
.telegram-chat-button i { font-size: 30px; line-height: 1; margin-inline-end: 2px; }

@keyframes telegramPulse {
    0%   { box-shadow: 0 10px 28px rgba(34, 158, 217, 0.42), 0 0 0 0   rgba(34, 158, 217, 0.45); }
    70%  { box-shadow: 0 10px 28px rgba(34, 158, 217, 0.42), 0 0 0 18px rgba(34, 158, 217, 0); }
    100% { box-shadow: 0 10px 28px rgba(34, 158, 217, 0.42), 0 0 0 0   rgba(34, 158, 217, 0); }
}
.telegram-chat-button { animation: telegramPulse 2.4s ease-out infinite; }
@media (prefers-reduced-motion: reduce) {
    .telegram-chat-button { animation: none; }
}

.telegram-chat-widget {
    position: fixed;
    bottom: 96px;
    inset-inline-end: 24px;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    color: #0b0e17;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
    display: none;
    flex-direction: column;
    z-index: 1050;
    font-family: 'Poppins', system-ui, -apple-system, Arial, sans-serif;
    overflow: hidden;
    transform: translateY(16px) scale(0.97);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.telegram-chat-widget.show {
    display: flex;
    transform: translateY(0) scale(1);
    opacity: 1;
}

.telegram-chat-widget .widget-header {
    background: linear-gradient(135deg, #229ED9 0%, #33A0D6 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.telegram-chat-widget .widget-header .profile-pic {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    flex: 0 0 auto;
}
.telegram-chat-widget .widget-header .profile-info h4 {
    margin: 0 0 2px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}
.telegram-chat-widget .widget-header .profile-info p {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.95;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.telegram-chat-widget .widget-header .status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #b6ffb6;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.telegram-chat-widget .widget-body {
    padding: 18px;
    flex-grow: 1;
    /* Telegram subtle background */
    background:
        radial-gradient(circle at 20% 20%, rgba(34, 158, 217, 0.06) 0 1px, transparent 2px),
        radial-gradient(circle at 80% 60%, rgba(34, 158, 217, 0.04) 0 1px, transparent 2px),
        linear-gradient(180deg, #e4edf5 0%, #d1e2f0 100%);
    background-size: 22px 22px, 18px 18px, auto;
}
.telegram-chat-widget .message-container {
    background: #fff;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    position: relative;
    color: #1f2937;
}
.telegram-chat-widget .message-container::before {
    content: "";
    position: absolute;
    top: 10px;
    inset-inline-start: -6px;
    width: 0; height: 0;
    border-style: solid;
    border-width: 0 10px 10px 0;
    border-color: transparent #fff transparent transparent;
}
html[dir="rtl"] .telegram-chat-widget .message-container::before {
    inset-inline-start: auto;
    inset-inline-end: -6px;
    border-width: 0 0 10px 10px;
    border-color: transparent transparent transparent #fff;
}
.telegram-chat-widget .message-container p {
    margin: 0;
    line-height: 1.5;
    font-size: 0.92rem;
}

.telegram-chat-widget .widget-footer {
    padding: 14px;
    background: #f6f6f6;
}
.telegram-chat-widget .widget-footer .btn-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    background: linear-gradient(135deg, #2AABEE 0%, #229ED9 100%);
    color: #fff !important;
    text-align: center;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    transition: filter 0.2s ease, transform 0.2s ease;
    box-shadow: 0 8px 18px rgba(34, 158, 217, 0.35);
}
.telegram-chat-widget .widget-footer .btn-chat:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}
.telegram-chat-widget .widget-footer .btn-chat i {
    font-size: 1.05rem;
}


/* ------------- 3. DARK THEME PARITY (BOTH WIDGETS) ------------- */
[data-theme="dark"] .whatsapp-chat-widget,
body.dark-theme .whatsapp-chat-widget,
[data-theme="dark"] .telegram-chat-widget,
body.dark-theme .telegram-chat-widget {
    background: #11151f;
    color: #e6e8ee;
}

[data-theme="dark"] .whatsapp-chat-widget .message-container,
body.dark-theme .whatsapp-chat-widget .message-container,
[data-theme="dark"] .telegram-chat-widget .message-container,
body.dark-theme .telegram-chat-widget .message-container {
    background: #1f2533;
    color: #e6e8ee;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.40);
}

[data-theme="dark"] .whatsapp-chat-widget .message-container::before,
body.dark-theme .whatsapp-chat-widget .message-container::before,
[data-theme="dark"] .telegram-chat-widget .message-container::before,
body.dark-theme .telegram-chat-widget .message-container::before {
    border-right-color: #1f2533;
}

html[dir="rtl"][data-theme="dark"] .whatsapp-chat-widget .message-container::before,
html[dir="rtl"] body.dark-theme .whatsapp-chat-widget .message-container::before,
html[dir="rtl"][data-theme="dark"] .telegram-chat-widget .message-container::before,
html[dir="rtl"] body.dark-theme .telegram-chat-widget .message-container::before {
    border-right-color: transparent;
    border-left-color: #1f2533;
}

[data-theme="dark"] .whatsapp-chat-widget .widget-footer,
body.dark-theme .whatsapp-chat-widget .widget-footer,
[data-theme="dark"] .telegram-chat-widget .widget-footer,
body.dark-theme .telegram-chat-widget .widget-footer {
    background: #161a25;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .widget-channels,
body.dark-theme  .widget-channels {
    border-top-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .widget-channels a,
body.dark-theme  .widget-channels a {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

[data-theme="dark"] .widget-channels a:hover,
body.dark-theme  .widget-channels a:hover {
    background: #f89c2d;
    border-color: #f89c2d;
    color: #11151f;
}