/* ==========================================================================
   WhatsApp Chat — Frontend Widget Styles
   ========================================================================== */

/* Widget Container */
.wac-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    direction: ltr;
}

.wac-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Device Targeting */
@media (max-width: 768px) {
    .wac-desktop-only { display: none !important; }
}

@media (min-width: 769px) {
    .wac-mobile-only { display: none !important; }
}

/* FAB Button */
.wac-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16), 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
    position: relative;
    outline: none;
}

.wac-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2), 0 3px 8px rgba(0, 0, 0, 0.1);
}

.wac-fab:active {
    transform: scale(0.95);
}

.wac-fab-icon {
    transition: transform 0.3s, opacity 0.3s;
    position: absolute;
}

.wac-fab-icon-wa {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.wac-fab-icon-close {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

.wac-widget.wac-open .wac-fab-icon-wa {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
}

.wac-widget.wac-open .wac-fab-icon-close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Pulse Animation */
.wac-fab-pulse::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    opacity: 0;
    animation: wacPulse 2s infinite;
    z-index: -1;
}

@keyframes wacPulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* Popup */
.wac-popup {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 360px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    visibility: hidden;
}

.wac-widget.wac-open .wac-popup {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
}

/* Popup Header */
.wac-popup-header {
    padding: 20px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wac-popup-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wac-popup-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.wac-popup-avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.3);
}

.wac-popup-brand {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.wac-popup-tagline {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
}

.wac-popup-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.wac-popup-close:hover {
    background: rgba(255,255,255,0.3);
}

/* Popup Body */
.wac-popup-body {
    padding: 12px;
    max-height: 320px;
    overflow-y: auto;
}

/* Agent Card */
.wac-agent-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    cursor: pointer;
}

.wac-agent-card:hover {
    background: #f0f2f5;
}

.wac-agent-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

.wac-agent-info {
    flex: 1;
    min-width: 0;
}

.wac-agent-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a;
    line-height: 1.3;
}

.wac-agent-message {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wac-agent-arrow {
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.wac-agent-card:hover .wac-agent-arrow {
    transform: translateX(2px);
    color: #6b7280;
}

/* Popup Footer */
.wac-popup-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    font-size: 11px;
    color: #6c7b6b;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

/* Mobile Bottom Sheet */
@media (max-width: 480px) {
    .wac-widget {
        bottom: 16px;
        right: 16px;
    }

    .wac-popup {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .wac-widget.wac-open .wac-popup {
        transform: translateY(0);
    }
}

/* Widget Position */
.wac-position-left {
    right: auto !important;
    left: 24px;
}

.wac-position-left .wac-popup {
    right: auto !important;
    left: 0;
    transform-origin: bottom left;
}

@media (max-width: 480px) {
    .wac-position-left {
        right: auto;
        left: 16px;
    }
}

/* Scrollbar Styling */
.wac-popup-body::-webkit-scrollbar {
    width: 4px;
}

.wac-popup-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.wac-popup-body::-webkit-scrollbar-track {
    background: transparent;
}
