/**
 * ImpulaPress WhatsApp Float Button - Premium Design
 */

.impula-whatsapp-container {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.impula-whatsapp-container[data-position="right"] {
    right: 20px;
}

.impula-whatsapp-container[data-position="left"] {
    left: 20px;
}

/* Main Button */
.impula-wa-button {
    position: relative;
    width: 56px;
    height: 56px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15), 0 4px 24px rgba(37, 211, 102, 0.25);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 3;
}

.impula-wa-button:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 8px 32px rgba(37, 211, 102, 0.35);
    background: #22c55e;
}

.impula-wa-button:active {
    transform: scale(0.96);
}

.impula-wa-button.active {
    background: #22c55e;
    transform: rotate(90deg) scale(0.9);
}

.impula-wa-button.active .impula-wa-icon {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

.impula-wa-button.active .impula-wa-close {
    opacity: 1;
    transform: scale(1) rotate(90deg);
}

/* Button Icon */
.impula-wa-icon,
.impula-wa-close {
    width: 28px;
    height: 28px;
    color: #fff;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 2;
}

/* Multiple icon types animation */
.impula-wa-icon svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
}

/* Phone icon starts hidden */
.impula-wa-icon svg.icon-phone {
    opacity: 0;
    transform: scale(0.8);
}

/* WhatsApp icon starts visible */
.impula-wa-icon svg.icon-whatsapp {
    opacity: 1;
    transform: scale(1);
}

/* Animate both icons when both types exist */
.impula-wa-icon svg.icon-whatsapp.animate-icons {
    animation: iconSwitchOut 4s ease-in-out infinite;
}

.impula-wa-icon svg.icon-phone.animate-icons {
    animation: iconSwitchIn 4s ease-in-out infinite;
}

@keyframes iconSwitchOut {
    0%, 45% {
        opacity: 1;
        transform: scale(1);
    }
    50%, 95% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes iconSwitchIn {
    0%, 45% {
        opacity: 0;
        transform: scale(0.8);
    }
    50%, 95% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

.impula-wa-close {
    position: absolute;
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
    z-index: 2;
}

/* Pulse Animation */
.impula-wa-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #25D366;
    animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 0;
        transform: scale(1.4);
    }
}

/* Notification Badge */
.impula-wa-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ef4444;
    border-radius: 10px;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: badge-pulse 2s ease-in-out infinite;
    z-index: 3;
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.impula-whatsapp-container.chat-open .impula-wa-badge {
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

/* Chat Box */
.impula-wa-chat-box {
    position: absolute;
    bottom: 70px;
    width: 340px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.92) translateY(10px);
    transform-origin: bottom;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.impula-whatsapp-container[data-position="right"] .impula-wa-chat-box {
    right: 0;
    transform-origin: bottom right;
}

.impula-whatsapp-container[data-position="left"] .impula-wa-chat-box {
    left: 0;
    transform-origin: bottom left;
}

.impula-whatsapp-container.chat-open .impula-wa-chat-box {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* Chat Header */
.impula-wa-chat-header {
    background: #f5a623;
    padding: 20px 18px;
    color: #fff;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.impula-wa-chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 120%;
    height: 200%;
    background: 
        radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
    pointer-events: none;
}

.impula-wa-header-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.impula-wa-header-icon svg {
    width: 26px;
    height: 26px;
    color: #f5a623;
}

.impula-wa-header-text {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.impula-wa-header-text h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.impula-wa-header-text p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
}

/* Chat Body */
.impula-wa-chat-body {
    padding: 16px;
    background: #fff;
    min-height: 120px;
    max-height: 320px;
    overflow-y: auto;
}

.impula-wa-info-text {
    font-size: 12px;
    color: #666;
    text-align: center;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: #f5f5f5;
    border-radius: 6px;
    line-height: 1.4;
}

/* Account Item */
.impula-wa-account {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin-bottom: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.impula-wa-account:last-child {
    margin-bottom: 0;
}

.impula-wa-account:hover {
    background: #f9fafb;
    border-color: #25D366;
    transform: translateX(2px);
}

.impula-wa-account-avatar {
    width: 40px;
    height: 40px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.impula-wa-account-avatar svg {
    width: 22px;
    height: 22px;
    color: #fff;
}

.impula-wa-account-info {
    flex: 1;
    min-width: 0;
}

.impula-wa-account-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.impula-wa-account-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

.impula-wa-account-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.impula-wa-account:hover .impula-wa-account-icon {
    opacity: 1;
}

.impula-wa-account-icon svg {
    width: 18px;
    height: 18px;
    color: #25D366;
}

/* Responsive */
@media (max-width: 480px) {
    .impula-whatsapp-container {
        bottom: 16px;
    }
    
    .impula-whatsapp-container[data-position="right"] {
        right: 16px;
    }
    
    .impula-whatsapp-container[data-position="left"] {
        left: 16px;
    }
    
    .impula-wa-chat-box {
        width: calc(100vw - 32px);
        max-width: 340px;
    }
    
    .impula-wa-button {
        width: 52px;
        height: 52px;
    }
    
    .impula-wa-icon,
    .impula-wa-close {
        width: 26px;
        height: 26px;
    }
}

/* Smooth scrollbar */
.impula-wa-chat-body::-webkit-scrollbar {
    width: 5px;
}

.impula-wa-chat-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.impula-wa-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

.impula-wa-chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Prevent text selection on button */
.impula-wa-button {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Smooth transitions for all interactive elements */
.impula-wa-send-button,
.impula-wa-button,
.impula-wa-badge {
    will-change: transform;
}
