/**
 * Frontend Styles for Floating WhatsApp Pulse Widget (WordPress Plugin)
 */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@400;500;600&display=swap');

.wa-widget-container {
    position: fixed;
    bottom: 28px;
    z-index: 999999;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    text-align: left;
    box-sizing: border-box;
}

.wa-widget-container * {
    box-sizing: border-box;
}

/* Positioning Options */
.wa-widget-container.fwp-pos-right {
    right: 28px;
}

.wa-widget-container.fwp-pos-left {
    left: 28px;
}

/* --- Floating Action Button --- */
.wa-floating-btn {
    width: 64px;
    height: 64px;
    background: #25D366;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
    position: relative;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
    padding: 0;
    margin: 0;
}

.wa-floating-btn:hover {
    transform: scale(1.08);
    background: #22c35e;
    box-shadow: 0 12px 28px rgba(37, 211, 102, 0.45);
}

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

/* Pulse Ripple Animation */
.wa-floating-btn::before,
.wa-floating-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: #25D366;
    border-radius: 50%;
    z-index: -1;
    opacity: 0.6;
    animation: fwp-pulse-ripple 2.5s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

.wa-floating-btn::after {
    animation-delay: 1.25s;
}

@keyframes fwp-pulse-ripple {
    0% {
        transform: scale(1);
        opacity: 0.75;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Disable pulse animation if toggled off in admin or modal is active */
.wa-floating-btn.fwp-no-pulse::before,
.wa-floating-btn.fwp-no-pulse::after,
.wa-floating-btn.active::before,
.wa-floating-btn.active::after {
    animation: none !important;
    opacity: 0 !important;
}

.wa-floating-btn.active {
    background: #22c55e;
    transform: rotate(180deg);
}

.wa-floating-btn.active:hover {
    transform: rotate(180deg) scale(1.08);
    background: #16a34a;
}

/* Icon Switching Inside Button */
.wa-icon-wrapper {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-icon-logo,
.wa-icon-close {
    position: absolute;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

.wa-floating-btn.active .wa-icon-logo {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
}

.wa-floating-btn.active .wa-icon-close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Unread Badge */
.wa-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    animation: fwp-badge-bounce 2s infinite;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 5;
}

@keyframes fwp-badge-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-4px) scale(1.1); }
    60% { transform: translateY(-2px) scale(1.05); }
}

.wa-floating-btn.active .wa-badge,
.wa-badge.hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

/* --- WhatsApp Chat Modal Card --- */
.wa-widget-modal {
    position: absolute;
    bottom: 80px;
    width: 370px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.18), 0 0 1px 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
    border: 1px solid rgba(0,0,0,0.06);
}

.wa-widget-container.fwp-pos-right .wa-widget-modal {
    right: 0;
    transform-origin: bottom right;
}

.wa-widget-container.fwp-pos-left .wa-widget-modal {
    left: 0;
    transform-origin: bottom left;
}

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

/* Modal Header */
.wa-modal-header {
    background: linear-gradient(135deg, #25D366 0%, #16a34a 100%);
    padding: 22px 20px;
    color: white;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 0;
}

.wa-header-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.wa-header-text {
    flex: 1;
}

.wa-header-text h3 {
    font-size: 19px;
    font-weight: 700;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    color: #ffffff !important;
    letter-spacing: -0.3px;
    line-height: 1.25;
}

.wa-header-text p {
    font-size: 13px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.92) !important;
    font-weight: 400;
    margin: 0 !important;
    padding: 0 !important;
}

/* Modal Body */
.wa-modal-body {
    padding: 18px 16px 22px;
    background-color: #F8FAFC;
    max-height: 420px;
    overflow-y: auto;
}

.wa-body-subtitle {
    text-align: center;
    font-size: 12.5px;
    color: #64748B;
    margin: 0 0 16px 0 !important;
    font-weight: 500;
    padding: 0 8px;
}

/* Agents List */
.wa-agent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wa-agent-card {
    background: white;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none !important;
    color: #1E293B !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    border: 1px solid #F1F5F9;
    border-left: 4px solid #25D366;
    transition: all 0.25s ease;
}

.wa-agent-card:hover {
    transform: translateX(4px);
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.15);
    border-color: #E2E8F0;
    border-left-color: #16A34A;
    color: #0f172a !important;
}

.wa-agent-info-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
}

.wa-agent-avatar {
    width: 42px;
    height: 42px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(37, 211, 102, 0.3);
    transition: transform 0.3s ease;
}

.wa-agent-card:hover .wa-agent-avatar {
    transform: scale(1.08) rotate(-5deg);
    background: #16a34a;
}

.wa-agent-details {
    display: flex;
    flex-direction: column;
}

.wa-agent-name {
    font-weight: 600;
    font-size: 14.5px;
    color: #1E293B;
    margin-bottom: 2px;
    line-height: 1.3;
}

.wa-agent-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: #16A34A;
    font-weight: 500;
}

.wa-status-dot {
    width: 7px;
    height: 7px;
    background-color: #22C55E;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.wa-status-dot::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background-color: #22C55E;
    border-radius: 50%;
    opacity: 0.4;
    animation: fwp-dot-pulse 1.5s infinite;
}

@keyframes fwp-dot-pulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(2.2); opacity: 0; }
}

.wa-agent-action {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F0FDF4;
    color: #25D366;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.wa-agent-card:hover .wa-agent-action {
    background: #25D366;
    color: white;
    transform: scale(1.1);
}

/* Modal Footer */
.wa-modal-footer {
    padding: 10px 16px;
    background: white;
    border-top: 1px solid #F1F5F9;
    text-align: center;
    font-size: 11px;
    color: #94A3B8;
    margin: 0;
}

.wa-modal-footer span,
.wa-modal-footer strong,
.wa-modal-footer a {
    color: #25D366;
    font-weight: 600;
    text-decoration: none;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .wa-widget-container {
        bottom: 20px;
    }
    .wa-widget-container.fwp-pos-right { right: 20px; }
    .wa-widget-container.fwp-pos-left { left: 20px; }

    .wa-widget-modal {
        position: fixed;
        bottom: 90px;
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
        max-width: calc(100vw - 32px);
    }
}
