/**
 * DigiFlow WhatsApp Chat Widget Styles
 */
:root {
    --wa-color: #25D366;
}

#wa-widget-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#wa-chat-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 48px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

#wa-chat-panel.wa-open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.wa-header {
    background: var(--wa-color);
    color: #fff;
    padding: 24px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
}

.wa-header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

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

.wa-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.wa-avatar svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.wa-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #4ADE80;
    border: 2px solid var(--wa-color);
    border-radius: 50%;
}

.wa-header-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wa-business-name {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.3px;
    color: #fff;
}

.wa-status-text {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.9;
    font-weight: 400;
    color: #fff;
}

.wa-close-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: -8px -8px -8px 0;
}

.wa-close-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.wa-body {
    background: #E5DDD5;
    padding: 24px 20px;
    position: relative;
    min-height: 140px;
}

.wa-body::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="%23ffffff" fill-opacity="0.4"%3E%3Cpath d="M10 10h10v10H10zM30 30h10v10H30z"/%3E%3C/g%3E%3C/svg%3E');
    background-size: 100px 100px;
    opacity: 0.5;
}

.wa-message-bubble {
    background: #fff;
    padding: 14px 18px;
    border-radius: 0 16px 16px 16px;
    font-size: 15px;
    color: #111b21;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    position: relative;
    max-width: 85%;
    animation: waFadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.1s;
    opacity: 0;
    z-index: 1;
    margin-bottom: 15px;
    line-height: 1.5;
    font-weight: 400;
}

.wa-message-bubble::before {
    content: "";
    position: absolute;
    top: 0;
    left: -10px;
    width: 0;
    height: 0;
    border-top: 0px solid transparent;
    border-right: 14px solid #fff;
    border-bottom: 14px solid transparent;
}

.wa-replies {
    padding: 16px 20px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid #f0f0f0;
}

.wa-reply-btn {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #374151;
    padding: 12px 18px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.wa-reply-btn:hover {
    background: #f0fdf4;
    border-color: var(--wa-color);
    color: #166534;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.wa-reply-btn::after {
    content: "\2192";
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s;
    font-size: 16px;
    color: var(--wa-color);
}

.wa-reply-btn:hover::after {
    opacity: 1;
    transform: translateX(0);
}

#wa-trigger-btn {
    width: 64px;
    height: 64px;
    background: var(--wa-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    border: none;
    outline: none;
    position: relative;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 999;
}

#wa-trigger-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

#wa-trigger-btn svg {
    width: 36px;
    height: 36px;
    fill: currentColor;
}

.wa-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: waScaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 1.5s;
    opacity: 0;
    transform: scale(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@keyframes waFadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes waScaleIn {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes waPing {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    80%, 100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

.wa-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--wa-color);
    z-index: -1;
    animation: waPing 2.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@media (max-width: 480px) {
    #wa-chat-panel {
        width: calc(100vw - 32px);
        bottom: 90px;
    }

    #wa-widget-container {
        bottom: 16px;
        right: 16px;
    }

    .wa-header {
        padding: 20px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #wa-chat-panel,
    .wa-message-bubble,
    .wa-badge,
    .wa-pulse,
    #wa-trigger-btn {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
