/* =============================================================================
   WHATSAPP POPUP WIDGET - Realnih Digital
   ============================================================================= */

/* Container */
.wa-widget-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 9998;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Popup Box */
.wa-widget-popup {
    width: 340px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.wa-widget-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.wa-widget-header {
    background: linear-gradient(135deg, #075E54 0%, #128C7E 100%);
    padding: 20px 20px 18px;
    position: relative;
}

.wa-widget-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.wa-widget-avatar-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wa-widget-avatar-placeholder svg {
    width: 28px;
    height: 28px;
    color: white;
}

.wa-widget-header-info {
    flex: 1;
}

.wa-widget-name {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 6px 0;
    line-height: 1.4;
    padding-right: 30px;
}

.wa-widget-status {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wa-widget-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ADE80;
    border-radius: 50%;
    display: inline-block;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.wa-widget-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    padding: 0;
}

.wa-widget-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.wa-widget-close svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

/* Body / Chat Area */
.wa-widget-body {
    padding: 20px;
    background: linear-gradient(180deg, #E5DDD5 0%, #D1C9BE 100%);
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23C5BDAE' fill-opacity='0.2'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    min-height: 120px;
}

/* Chat Bubble */
.wa-widget-message {
    background: #DCF8C6;
    padding: 12px 16px;
    border-radius: 0 12px 12px 12px;
    max-width: 90%;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: messageSlide 0.4s ease-out 0.2s both;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wa-widget-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 8px solid #DCF8C6;
    border-left: 8px solid transparent;
}

.wa-widget-message p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #111B21;
}

.wa-widget-message-time {
    display: block;
    text-align: right;
    font-size: 11px;
    color: #667781;
    margin-top: 4px;
}

/* Footer / CTA Area */
.wa-widget-footer {
    padding: 16px 20px 20px;
    background: #fff;
}

.wa-widget-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
}

.wa-widget-cta:hover {
    background: #22c55e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.wa-widget-cta svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* Online Status Footer */
.wa-widget-online {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 13px;
    color: #667781;
}

.wa-widget-online-dot {
    width: 10px;
    height: 10px;
    background: #25D366;
    border-radius: 50%;
    display: inline-block;
    animation: dotPulse 1.5s infinite;
}

@keyframes dotPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 0 4px rgba(37, 211, 102, 0);
    }
}

/* Floating Button (Enhanced) */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    z-index: 9999;
    cursor: pointer;
    border: none;
    transition: box-shadow 0.3s ease, background 0.3s ease;
    animation: none !important;
    transform: none !important;
}

.whatsapp-float:hover {
    transform: none !important;
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.5);
    background: #22c55e;
}

.whatsapp-float:active,
.whatsapp-float:focus,
.whatsapp-float.has-popup,
.whatsapp-float.popup-open {
    animation: none !important;
    transform: none !important;
}

.whatsapp-float svg {
    width: 32px;
    height: 32px;
    fill: white;
    transform: none !important;
    transition: none !important;
}

.whatsapp-float:hover svg,
.whatsapp-float:active svg,
.whatsapp-float:focus svg,
.whatsapp-float.popup-open svg {
    transform: none !important;
}

/* Notification Badge */
.wa-notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #EF4444;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: badgeBounce 0.5s ease;
}

@keyframes badgeBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Responsive */
@media (max-width: 480px) {
    .wa-widget-container {
        bottom: 90px;
        right: 15px;
        left: 15px;
    }
    
    .wa-widget-popup {
        width: 100%;
        max-width: none;
        border-radius: 12px;
    }
    
    .whatsapp-float {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
        transform: none !important;
        animation: none !important;
    }
    
    .whatsapp-float svg {
        width: 28px;
        height: 28px;
        transform: none !important;
    }
    
    .wa-widget-header {
        padding: 14px 16px;
    }
    
    .wa-widget-body {
        padding: 16px;
    }
    
    .wa-widget-footer {
        padding: 14px 16px 16px;
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .wa-widget-popup {
        /* Uncomment if you want dark mode support */
        /* background: #1e293b; */
    }
}

/* Animation for initial popup */
.wa-widget-popup.first-load {
    animation: popupEntrance 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes popupEntrance {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

