/**
 * Super Presell Ultimate - Floating WhatsApp Button
 * Frontend Styles - WhatsApp Chat Style
 */

/* ============================================
   FLOATING BUTTON
   ============================================ */
.spu-floating-btn {
    position: fixed;
    z-index: 999999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    outline: none;
}

.spu-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

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

/* Pulse Animation */
.spu-floating-btn-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    opacity: 0.4;
    animation: spu-pulse 2s infinite;
    pointer-events: none;
}

@keyframes spu-pulse {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.3);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* ============================================
   MODAL - WhatsApp Chat Style
   ============================================ */
.spu-floating-modal {
    position: fixed;
    z-index: 999998;
    width: 350px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.spu-floating-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Modal Header */
.spu-floating-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    color: #fff;
}

.spu-floating-modal-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.spu-floating-modal-info {
    flex: 1;
    min-width: 0;
}

.spu-floating-modal-info h4 {
    margin: 0 0 2px 0;
    font-size: 16px;
    font-weight: 600;
    color: inherit;
}

.spu-floating-modal-info p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
    color: inherit;
}

.spu-floating-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.spu-floating-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   CHAT AREA - WhatsApp Style
   ============================================ */
.spu-floating-chat {
    background: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4cdc4' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    padding: 16px;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Message Bubble */
.spu-floating-message {
    background: #fff;
    padding: 8px 12px;
    border-radius: 0 8px 8px 8px;
    margin-bottom: 8px;
    max-width: 85%;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    animation: spu-fb-fadeIn 0.3s ease;
    font-size: 14px;
    line-height: 1.4;
    color: #303030;
    position: relative;
    align-self: flex-start;
}

.spu-floating-message::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    border-width: 0 8px 8px 0;
    border-style: solid;
    border-color: transparent #fff transparent transparent;
}

@keyframes spu-fb-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   TYPING INDICATOR
   ============================================ */
.spu-floating-typing {
    display: none;
    background: #fff;
    padding: 12px 16px;
    border-radius: 0 8px 8px 8px;
    width: fit-content;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    margin-bottom: 8px;
    position: relative;
    align-self: flex-start;
}

.spu-floating-typing::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    border-width: 0 8px 8px 0;
    border-style: solid;
    border-color: transparent #fff transparent transparent;
}

.spu-floating-typing.active {
    display: block;
}

.spu-floating-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.spu-floating-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9e9e9e;
    animation: spu-fb-typing 1.4s infinite;
}

.spu-floating-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.spu-floating-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes spu-fb-typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* ============================================
   INPUT AREA
   ============================================ */
.spu-floating-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f0f0f0;
    border-top: 1px solid #e0e0e0;
}

.spu-floating-input {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    color: #303030;
    background: #fff;
    border: none;
    border-radius: 24px;
    outline: none;
    box-sizing: border-box;
}

.spu-floating-input::placeholder {
    color: #999;
}

.spu-floating-input:focus {
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
}

.spu-floating-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.spu-floating-send:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.spu-floating-send:active {
    transform: scale(0.95);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .spu-floating-btn {
        width: 54px;
        height: 54px;
    }

    .spu-floating-modal {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 120px);
    }

    .spu-floating-modal-header {
        padding: 14px;
    }

    .spu-floating-modal-avatar {
        width: 40px;
        height: 40px;
    }

    .spu-floating-modal-info h4 {
        font-size: 15px;
    }

    .spu-floating-modal-info p {
        font-size: 12px;
    }

    .spu-floating-chat {
        min-height: 150px;
        max-height: 250px;
        padding: 12px;
    }

    .spu-floating-message {
        font-size: 13px;
        padding: 6px 10px;
    }

    .spu-floating-input-area {
        padding: 10px;
    }

    .spu-floating-input {
        padding: 8px 14px;
        font-size: 13px;
    }

    .spu-floating-send {
        width: 40px;
        height: 40px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes spu-bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

.spu-floating-btn {
    animation: spu-bounce-in 0.6s ease-out;
}

/* Hide on print */
@media print {
    .spu-floating-btn,
    .spu-floating-modal {
        display: none !important;
    }
}
