/* ═══════════════════════════════════════════════════════════════════
   WhatsApp Floating Widget v4.0
   Official WhatsApp Colors + Noto Sans Devanagari + Premium Animations
   
   Official WhatsApp Color Palette:
   --wa-green:        #25D366  (Primary Green)
   --wa-teal:         #128C7E  (Dark Teal)
   --wa-dark-teal:    #075E54  (Darker Teal)
   --wa-light-green:  #DCF8C6  (Light Green / Message bubble)
   --wa-bg:           #ECE5DD  (Chat background)
   --wa-dark-bg:      #0D1117  (Dark mode background)
   --wa-header:       #075E54  (Header background)
   
   Font: Noto Sans Devanagari (Google Fonts)
═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700;800;900&family=Noto+Serif+Devanagari:wght@600;700&display=swap');

:root {
    --wa-green:       #25D366;
    --wa-teal:        #128C7E;
    --wa-dark-teal:   #075E54;
    --wa-light-green: #DCF8C6;
    --wa-bg:          #ECE5DD;
    --wa-dark:        #0A1628;
    --wa-panel-bg:    #111B21;
    --wa-header-bg:   #202C33;
    --wa-bubble-out:  #005C4B;
    --wa-bubble-in:   #202C33;
    --wa-text:        #E9EDEF;
    --wa-text-dim:    #8696A0;
    --wa-divider:     #2A3942;
    --wa-shadow:      rgba(0,0,0,0.6);
    --wa-glow:        rgba(37,211,102,0.25);
}

/* ── Font override for widget ── */
#wgw-floating-root,
#wgw-floating-root * {
    font-family: 'Noto Sans Devanagari', 'Noto Sans', sans-serif !important;
    -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════
   ROOT CONTAINER
══════════════════════════════ */
#wgw-floating-root {
    position: fixed;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2147483647;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 14px;
    pointer-events: none;
}

/* ══════════════════════════════
   FAB BUTTON
══════════════════════════════ */
#wgw-fab {
    pointer-events: all;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(145deg, #25D366 0%, #128C7E 60%, #075E54 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 13px 20px 13px 13px;
    cursor: pointer;
    box-shadow:
        0 4px 24px rgba(37,211,102,0.5),
        0 2px 8px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.2);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
    animation: wgwFabIn 1s cubic-bezier(0.34, 1.56, 0.64, 1) 1.5s both;
    border: 1.5px solid rgba(255,255,255,0.15);
}

@keyframes wgwFabIn {
    0%   { opacity: 0; transform: translateX(80px) scale(0.5) rotate(15deg); }
    60%  { opacity: 1; transform: translateX(-8px) scale(1.05) rotate(-2deg); }
    100% { opacity: 1; transform: translateX(0) scale(1) rotate(0deg); }
}

#wgw-fab:hover {
    transform: translateX(-4px) scale(1.05);
    box-shadow:
        0 8px 36px rgba(37,211,102,0.6),
        0 4px 16px rgba(0,0,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.25);
}

#wgw-fab:active {
    transform: scale(0.95) translateX(0);
    transition-duration: 0.1s;
}

/* Pulsing glow rings — 3 layers */
.wgw-fab-rings {
    position: absolute;
    inset: -2px;
    border-radius: 52px;
    pointer-events: none;
}
.wgw-ring {
    position: absolute;
    inset: 0;
    border-radius: 52px;
    border: 2px solid var(--wa-green);
    animation: wgwRingOut 2.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.wgw-ring1 { animation-delay: 0s; }
.wgw-ring2 { animation-delay: 0.9s; }
.wgw-ring3 { animation-delay: 1.8s; }

@keyframes wgwRingOut {
    0%   { transform: scale(1);    opacity: 0.8; border-color: var(--wa-green); }
    100% { transform: scale(1.8);  opacity: 0;   border-color: var(--wa-teal); }
}

/* FAB Icon circle */
.wgw-fab-icon {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255,255,255,0.2);
}

#wgw-fab.wgw-open .wgw-fab-icon {
    transform: rotate(180deg) scale(0.88);
    background: rgba(255,255,255,0.1);
}

/* FAB Label */
.wgw-fab-label {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    transition: all 0.3s ease;
    max-width: 120px;
    overflow: hidden;
}

#wgw-fab.wgw-open .wgw-fab-label {
    opacity: 0;
    max-width: 0;
    margin: 0;
    padding: 0;
}

/* ══════════════════════════════
   PANEL
══════════════════════════════ */
#wgw-panel {
    pointer-events: all;
    width: 330px;
    background: var(--wa-panel-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow:
        0 24px 70px rgba(0,0,0,0.7),
        0 0 0 1px rgba(255,255,255,0.06),
        0 0 100px rgba(37,211,102,0.07);
    transform-origin: bottom right;
    transition:
        opacity  0.4s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.45s cubic-bezier(0.34, 1.2, 0.64, 1),
        visibility 0.4s;
    will-change: transform, opacity;
}

.wgw-panel-hidden {
    opacity: 0 !important;
    transform: scale(0.7) translateY(24px) !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
.wgw-panel-visible {
    opacity: 1 !important;
    transform: scale(1) translateY(0) !important;
    visibility: visible !important;
    pointer-events: all !important;
}

/* ── HEADER — Official WhatsApp dark teal ── */
.wgw-panel-header {
    background: var(--wa-header-bg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--wa-divider);
    position: relative;
    overflow: hidden;
}

/* Subtle animated gradient shimmer on header */
.wgw-panel-header::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37,211,102,0.06), transparent);
    animation: wgwShimmer 3.5s ease-in-out infinite 2s;
    pointer-events: none;
}
@keyframes wgwShimmer {
    0%   { left: -60%; }
    100% { left: 160%; }
}

.wgw-panel-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wgw-panel-avatar {
    background: linear-gradient(145deg, var(--wa-green), var(--wa-teal));
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 3px 12px rgba(37,211,102,0.4);
    animation: wgwAvatarPulse 3s ease-in-out infinite;
}
@keyframes wgwAvatarPulse {
    0%, 100% { box-shadow: 0 3px 12px rgba(37,211,102,0.4); }
    50%       { box-shadow: 0 3px 20px rgba(37,211,102,0.7); }
}

.wgw-panel-title {
    color: var(--wa-text);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.1px;
    line-height: 1.2;
}

.wgw-panel-online {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--wa-text-dim);
    font-size: 12px;
    margin-top: 2px;
    font-weight: 500;
}

.wgw-online-dot {
    width: 8px;
    height: 8px;
    background: var(--wa-green);
    border-radius: 50%;
    flex-shrink: 0;
    animation: wgwDotPulse 1.8s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(37,211,102,0.8);
}
@keyframes wgwDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.7); }
}

.wgw-panel-close {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--wa-text-dim);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}
.wgw-panel-close:hover {
    background: rgba(255,255,255,0.16);
    color: #fff;
    transform: rotate(90deg);
}

/* ── CHAT AREA — WhatsApp wallpaper style ── */
.wgw-chat-bubble-wrap {
    padding: 14px 14px 6px;
    background: var(--wa-panel-bg);
    background-image:
        radial-gradient(circle at 20% 80%, rgba(37,211,102,0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(7,94,84,0.05) 0%, transparent 50%);
    position: relative;
}

/* Typing dots animation — appears before bubble */
.wgw-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--wa-bubble-in);
    border-radius: 0 12px 12px 12px;
    padding: 10px 14px;
    width: fit-content;
    margin-bottom: 6px;
    animation: wgwTypingAppear 0.3s ease both, wgwTypingFade 0.4s ease 1.2s forwards;
}
@keyframes wgwTypingAppear {
    from { opacity: 0; transform: scale(0.8) translateX(-8px); }
    to   { opacity: 1; transform: scale(1) translateX(0); }
}
@keyframes wgwTypingFade {
    to { opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden; }
}

.wgw-typing-dot {
    width: 7px; height: 7px;
    background: var(--wa-text-dim);
    border-radius: 50%;
    animation: wgwDotBounce 1s ease-in-out infinite;
}
.wgw-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.wgw-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes wgwDotBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%            { transform: translateY(-6px); opacity: 1; }
}

/* Actual chat bubble */
.wgw-chat-bubble {
    background: var(--wa-bubble-in);
    border-radius: 0 14px 14px 14px;
    padding: 10px 14px;
    color: var(--wa-text);
    font-size: 13.5px;
    line-height: 1.55;
    position: relative;
    width: fit-content;
    max-width: 100%;
    animation: wgwBubbleIn 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) 1.4s both;
    border: 1px solid rgba(255,255,255,0.05);
}
@keyframes wgwBubbleIn {
    from { opacity: 0; transform: translateX(-12px) scale(0.92); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

.wgw-chat-bubble::before {
    content: '';
    position: absolute;
    top: 0; left: -9px;
    border-right: 9px solid var(--wa-bubble-in);
    border-top: 9px solid transparent;
}

.wgw-chat-time {
    color: var(--wa-text-dim);
    font-size: 10.5px;
    text-align: left;
    padding: 5px 3px 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
/* Double tick */
.wgw-chat-time::after {
    content: '✓✓';
    color: #53bdeb;
    font-size: 10px;
    letter-spacing: -2px;
}

/* ── STATS STRIP ── */
.wgw-panel-stats {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.03);
    border-top: 1px solid var(--wa-divider);
    border-bottom: 1px solid var(--wa-divider);
    padding: 9px 16px;
}

.wgw-pstat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--wa-text-dim);
    font-size: 11.5px;
    font-weight: 500;
    flex: 1;
    justify-content: center;
}
.wgw-pstat svg { opacity: 0.6; }

.wgw-pstat span {
    color: var(--wa-green);
    font-weight: 800;
    font-size: 15px;
    transition: transform 0.3s ease;
    display: inline-block;
}
.wgw-pstat span.wgw-pop {
    animation: wgwNumPop 0.5s cubic-bezier(0.34, 1.8, 0.64, 1);
}
@keyframes wgwNumPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.5) rotate(-5deg); }
    70%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.wgw-pstat-div {
    width: 1px;
    height: 24px;
    background: var(--wa-divider);
}

/* ── GROUP BUTTONS ── */
.wgw-panel-groups {
    padding: 10px 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    background: var(--wa-panel-bg);
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(37,211,102,0.2) transparent;
}
.wgw-panel-groups::-webkit-scrollbar { width: 3px; }
.wgw-panel-groups::-webkit-scrollbar-thumb {
    background: rgba(37,211,102,0.3);
    border-radius: 3px;
}

.wgw-panel-group-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-decoration: none !important;
    background: var(--wa-header-bg);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 13px;
    padding: 12px 14px;
    transition: all 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
    animation: wgwBtnSlide 0.5s cubic-bezier(0.34, 1.2, 0.64, 1) both;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Shine sweep on hover */
.wgw-panel-group-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -80%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
    transition: left 0.4s ease;
    pointer-events: none;
}
.wgw-panel-group-btn:hover::before { left: 130%; }

@keyframes wgwBtnSlide {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0); }
}

.wgw-panel-group-btn:hover {
    background: #2A3942;
    border-color: rgba(37,211,102,0.3);
    transform: translateX(-4px) scale(1.01);
    box-shadow: 0 4px 20px rgba(37,211,102,0.1), 4px 0 0 var(--wa-green);
}

.wgw-group-btn-primary {
    background: linear-gradient(135deg,
        rgba(37,211,102,0.12) 0%,
        rgba(18,140,126,0.08) 100%
    ) !important;
    border-color: rgba(37,211,102,0.2) !important;
}
.wgw-group-btn-primary:hover {
    border-color: rgba(37,211,102,0.45) !important;
    box-shadow: 0 4px 20px rgba(37,211,102,0.18), 4px 0 0 var(--wa-green) !important;
}

.wgw-pgb-left {
    display: flex;
    align-items: center;
    gap: 11px;
    overflow: hidden;
}

.wgw-pgb-num {
    background: rgba(37,211,102,0.12);
    color: var(--wa-green);
    font-size: 11px;
    font-weight: 800;
    border-radius: 8px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(37,211,102,0.2);
    font-family: monospace !important;
}

.wgw-pgb-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.wgw-pgb-label {
    color: var(--wa-text);
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    letter-spacing: 0.1px;
}

.wgw-pgb-name {
    color: var(--wa-text-dim);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    font-weight: 500;
}

.wgw-pgb-arrow {
    color: var(--wa-green);
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0.7;
}
.wgw-panel-group-btn:hover .wgw-pgb-arrow {
    transform: translateX(5px);
    opacity: 1;
}

/* Click ripple */
.wgw-panel-group-btn.wgw-clicked {
    animation: wgwClickPulse 0.4s ease;
}
@keyframes wgwClickPulse {
    0%   { background: rgba(37,211,102,0.25); }
    100% { background: var(--wa-header-bg); }
}

/* ── PANEL FOOTER ── */
.wgw-panel-footer {
    background: var(--wa-header-bg);
    border-top: 1px solid var(--wa-divider);
    color: var(--wa-text-dim);
    font-size: 10.5px;
    text-align: center;
    padding: 9px;
    letter-spacing: 0.3px;
    font-weight: 500;
}

/* ══════════════════════════════
   MOBILE
══════════════════════════════ */
@media (max-width: 500px) {
    #wgw-floating-root {
        right: 12px;
        top: auto;
        bottom: 16px;
        transform: none;
        flex-direction: column-reverse;
        align-items: flex-end;
    }
    #wgw-panel {
        width: calc(100vw - 24px);
        max-width: 340px;
    }
    .wgw-panel-groups { max-height: 220px; }
}
