/* Font import for clean premium typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

#wac-wrapper {
    position: fixed;
    bottom: 24px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
}

#wac-wrapper[data-position="right"] {
    right: 24px;
    align-items: flex-end;
}

#wac-wrapper[data-position="left"] {
    left: 24px;
    align-items: flex-start;
}

#wac-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

#wac-bubble i {
    font-size: 28px;
    color: white;
    display: block;
}

#wac-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

#wac-bubble:active {
    transform: scale(0.95);
}

#wac-box {
    width: 320px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    background: #fff;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

/* Keyframe animation for a smooth slide-up and fade-in entry when opened */
@keyframes wacSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#wac-box:not(.wac-hidden) {
    animation: wacSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.wac-hidden {
    display: none !important;
}

#wac-header {
    background: linear-gradient(135deg, #25D366 0%, #1ebe5d 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

#wac-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.wac-avatar-fa {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex-shrink: 0;
}

.wac-avatar-fa i {
    font-size: 20px;
}

/* Avatar Badge Background Colors */
.wac-avatar-fa.default { background: #edf2f7; color: #4a5568; }
.wac-avatar-fa.avatar1 { background: #ebf8ff; color: #3182ce; }
.wac-avatar-fa.avatar2 { background: #e6fffa; color: #319795; }
.wac-avatar-fa.avatar3 { background: #faf5ff; color: #805ad5; }
.wac-avatar-fa.avatar4 { background: #fff5f5; color: #e53e3e; }
.wac-avatar-fa.avatar5 { background: #fffaf0; color: #dd6b20; }

#wac-agent-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

#wac-agent-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.3;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

#wac-agent-status {
    color: rgba(255, 255, 255, 0.88);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
}

#wac-agent-status::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

#wac-agent-status.wac-status-online::before {
    background: #69f0ae;
    box-shadow: 0 0 0 2px rgba(105, 240, 174, 0.35), 0 0 6px rgba(105, 240, 174, 0.7);
}

#wac-agent-status.wac-status-offline::before {
    background: rgba(255, 255, 255, 0.4);
}

#wac-agent-status.wac-status-typing::before {
    background: #ffeb3b;
    box-shadow: 0 0 0 2px rgba(255, 235, 59, 0.35), 0 0 6px rgba(255, 235, 59, 0.6);
}

/* Typing Indicator Animation Styles */
.wac-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
}

.wac-typing-indicator span {
    width: 6px;
    height: 6px;
    background: #718096;
    border-radius: 50%;
    display: block;
    animation: wacBounce 1.4s infinite ease-in-out both;
}

.wac-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.wac-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes wacBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

#wac-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    opacity: 1;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    padding: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    margin-left: auto;
}

#wac-close:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.55);
    transform: scale(1.1) rotate(90deg);
}

#wac-greeting {
    padding: 16px;
    font-size: 14px;
    color: #333;
    background: #f5f7f6;
    margin: 12px;
    border-radius: 12px;
    line-height: 1.5;
    border-left: 3px solid #25D366;
}

#wac-input-area {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

#wac-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    resize: none;
    height: 40px;
    max-height: 120px;
    overflow: hidden;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#wac-input:focus {
    border-color: #25D366;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.15);
}

#wac-input:disabled {
    background: #edf2f7;
    color: #a0aec0;
    cursor: not-allowed;
}

#wac-send {
    background: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#wac-send:hover {
    background: #20ba5a;
}

#wac-send:active {
    transform: scale(0.96);
}

#wac-send:disabled {
    background: #cbd5e0 !important;
    color: #a0aec0 !important;
    cursor: not-allowed;
    transform: none !important;
}

/* Error CSS rule */
.wac-input-error {
    border-color: #e53e3e !important;
    outline-color: #e53e3e !important;
    box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.15) !important;
}

#wac-footer {
    background: #fafafa;
    padding: 5px 16px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    line-height: 1.2;
}

#wac-footer span {
    color: #000;
    font-size: 9.5px;
    font-weight: 500;
}

#wac-footer a {
    font-size: 9.5px;
    text-decoration: none;
    transition: opacity 0.2s ease;
    font-weight: 600;
    margin-left: 2px;
}

#wac-footer a:hover {
    opacity: 0.8;
}

@media (max-width: 480px) {
    #wac-wrapper {
        bottom: 16px;
    }
    #wac-wrapper[data-position="right"] {
        right: 16px;
    }
    #wac-wrapper[data-position="left"] {
        left: 16px;
    }
    #wac-box {
        width: calc(100vw - 32px);
    }
    #wac-cta {
        max-width: calc(100vw - 110px);
        white-space: normal;
        font-size: 12px;
        padding: 8px 12px;
        line-height: 1.3;
    }
    #wac-wrapper[data-position="right"] #wac-cta {
        right: 68px;
    }
    #wac-wrapper[data-position="left"] #wac-cta {
        left: 68px;
    }
}

/* Call-To-Action (CTA) Notification Bubble Styling */
#wac-cta {
    position: absolute;
    bottom: 16px;
    background: #fff;
    color: #2d3748;
    padding: 10px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9998;
    animation: wacPulse 2s infinite ease-in-out;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#wac-wrapper[data-position="right"] #wac-cta {
    right: 76px;
    transform-origin: right center;
}

#wac-wrapper[data-position="right"] #wac-cta::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 6px solid #fff;
}

#wac-wrapper[data-position="left"] #wac-cta {
    left: 76px;
    transform-origin: left center;
}

#wac-wrapper[data-position="left"] #wac-cta::after {
    content: "";
    position: absolute;
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid #fff;
}

#wac-cta-close {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.2s ease;
}

#wac-cta-close:hover {
    color: #4a5568;
}

/* Pulse bouncing animation to draw eye attention softly */
@keyframes wacPulse {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}
