/**
 * Contact WA - Modern Frontend Stylesheet
 * Author: Afghan Awalfajari
 */

:root {
    --cwa-bg: #25D366;
    --cwa-header: #128C7E;
    --cwa-icon: #FFFFFF;
    --cwa-pulse: rgba(37, 211, 102, 0.45);
    --cwa-offset-x: 24px;
    --cwa-offset-y: 24px;
    --cwa-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* =========================================================================
 * Responsive Device Visibility Rules
 * ========================================================================= */
@media (min-width: 1025px) {
    .cwa-hide-desktop {
        display: none !important;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .cwa-hide-tablet {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .cwa-hide-mobile {
        display: none !important;
    }
}

/* =========================================================================
 * Floating Container Wrapper
 * ========================================================================= */
.cwa-widget-wrapper {
    position: fixed;
    z-index: 999999;
    font-family: var(--cwa-font);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
}

.cwa-pos-bottom-right {
    bottom: var(--cwa-offset-y);
    right: var(--cwa-offset-x);
    align-items: flex-end;
}

.cwa-pos-bottom-left {
    bottom: var(--cwa-offset-y);
    left: var(--cwa-offset-x);
    align-items: flex-start;
}

.cwa-widget-wrapper button.cwa-floating-btn,
.cwa-widget-wrapper a.cwa-floating-btn,
.cwa-floating-btn {
    pointer-events: auto;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: pointer;
    text-decoration: none !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cwa-widget-wrapper button.cwa-floating-btn:hover,
.cwa-widget-wrapper button.cwa-floating-btn:focus,
.cwa-widget-wrapper button.cwa-floating-btn:focus-visible,
.cwa-widget-wrapper button.cwa-floating-btn:active,
.cwa-widget-wrapper a.cwa-floating-btn:hover,
.cwa-widget-wrapper a.cwa-floating-btn:focus,
.cwa-widget-wrapper a.cwa-floating-btn:focus-visible,
.cwa-widget-wrapper a.cwa-floating-btn:active,
.cwa-floating-btn:hover,
.cwa-floating-btn:focus,
.cwa-floating-btn:focus-visible,
.cwa-floating-btn:active {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    text-decoration: none !important;
}

.cwa-floating-btn:hover {
    transform: scale(1.06);
}

.cwa-floating-btn:active {
    transform: scale(0.95);
}

.cwa-btn-circle {
    width: 60px;
    height: 60px;
    background-color: var(--cwa-bg);
    color: var(--cwa-icon);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18), 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
    transition: background-color 0.2s ease;
}

.cwa-wa-icon {
    width: 34px;
    height: 34px;
    fill: var(--cwa-icon);
}

/* CTA Text Label / Tooltip */
.cwa-btn-label {
    background: #FFFFFF;
    color: #1F2937;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 30px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
    pointer-events: auto;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.cwa-pos-bottom-right .cwa-btn-label {
    order: -1;
}

/* Pulse Ripple Animation */
.cwa-pulse-ring {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--cwa-pulse);
    animation: cwaPulse 2.2s infinite cubic-bezier(0.45, 0, 0.55, 1);
    z-index: 1;
}

.cwa-pos-bottom-right .cwa-pulse-ring {
    right: 0;
}

.cwa-pos-bottom-left .cwa-pulse-ring {
    left: 0;
}

@keyframes cwaPulse {
    0% {
        transform: scale(0.95);
        opacity: 0.9;
    }

    70% {
        transform: scale(1.6);
        opacity: 0;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* =========================================================================
 * Multi-Agent Popup Card
 * ========================================================================= */
.cwa-popup-card {
    pointer-events: auto;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 16px;
    animation: cwaPopupSlide 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

@keyframes cwaPopupSlide {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.cwa-popup-header {
    background-color: var(--cwa-header);
    color: #FFFFFF;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.cwa-popup-badge-online {
    width: 10px;
    height: 10px;
    background: #25D366;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.4);
}

.cwa-popup-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    color: #FFFFFF;
}

.cwa-popup-subtitle {
    margin: 3px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.3;
}

.cwa-popup-close-btn {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    color: #FFFFFF !important;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 0 4px !important;
    margin: 0 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.cwa-popup-close-btn:hover,
.cwa-popup-close-btn:focus,
.cwa-popup-close-btn:active {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    opacity: 1;
    color: #FFFFFF !important;
}

.cwa-popup-body {
    padding: 12px;
    max-height: 320px;
    overflow-y: auto;
}

.cwa-agent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cwa-agent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #F9FAFB !important;
    text-decoration: none !important;
    color: #1F2937 !important;
    transition: all 0.2s ease;
    border: 1px solid #F3F4F6 !important;
    outline: none !important;
    box-shadow: none !important;
}

.cwa-agent-item:hover,
.cwa-agent-item:focus {
    background: #E8F8F0 !important;
    border-color: #A7F3D0 !important;
    color: #1F2937 !important;
    transform: translateX(3px);
    text-decoration: none !important;
    outline: none !important;
}

.cwa-agent-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    background: #E5E7EB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    flex-shrink: 0;
}

.cwa-agent-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.cwa-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    background: #25D366;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    z-index: 2;
}

.cwa-agent-meta {
    flex: 1;
    min-width: 0;
}

.cwa-agent-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cwa-agent-role {
    display: block;
    font-size: 12px;
    color: #6B7280;
    margin-top: 1px;
}

.cwa-agent-wa-icon {
    display: flex;
    align-items: center;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.cwa-agent-item:hover .cwa-agent-wa-icon {
    opacity: 1;
    transform: scale(1.1);
}