/* Variables Estilo WhatsApp & Premium */
:root {
    --wa-teal-dark: #075E54;
    --wa-teal-light: #128C7E;
    --wa-bg-color: #E5DDD5;
    --wa-message-in: #FFFFFF;
    --wa-message-out: #DCF8C6;
    --wa-header-text: #FFFFFF;
    --premium-gold: #ffbe0b;
    --premium-dark: #024212;
}

/* Widget Container */
.whatsapp-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2147483647;
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    pointer-events: none;
}

.whatsapp-widget>* {
    pointer-events: auto;
}

/* Launcher Button */
.wa-launcher {
    width: 60px;
    height: 60px;
    background-color: #25D366;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2147483648;
}

.wa-launcher:hover {
    transform: scale(1.1);
}

.wa-launcher i {
    color: white;
    font-size: 30px;
}

.wa-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff0000;
    color: white;
    font-size: 12px;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: bounce 2s infinite;
}

/* Ocultar launcher cuando el chat está abierto */
.whatsapp-widget:has(.wa-chat-window.active) .wa-launcher {
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

/* Chat Window */
.wa-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 550px;
    background-color: var(--wa-bg-color);
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-repeat: repeat;
    background-size: 400px;
    visibility: hidden;
    z-index: 2147483646;
}

.wa-chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
    visibility: visible;
}

/* Header */
.wa-header {
    background-color: var(--wa-teal-dark);
    padding: 12px 15px;
    display: flex;
    align-items: center;
    color: var(--wa-header-text);
    border-radius: 15px 15px 0 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
}

.wa-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 10px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.wa-avatar:hover {
    opacity: 0.9;
}

.wa-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wa-header-info {
    flex: 1;
    min-width: 0;
}

.wa-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.wa-header-info span {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
    display: block;
}

.wa-verified-badge {
    color: #1D9BF0;
    font-size: 16px;
    vertical-align: middle;
    filter: drop-shadow(0 0 1px rgba(29, 155, 240, 0.5));
}

.wa-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.9;
    padding: 6px 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.wa-close-btn:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Chat Body */
.wa-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Messages */
.wa-message {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.wa-message.incoming {
    background-color: var(--wa-message-in);
    align-self: flex-start;
    border-radius: 0 8px 8px 8px;
}

.wa-message.outgoing {
    background-color: var(--wa-message-out);
    align-self: flex-end;
    border-radius: 8px 0 8px 8px;
}

.wa-message-time {
    font-size: 10px;
    color: #999;
    float: right;
    margin-top: 5px;
    margin-left: 10px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.wa-double-check {
    color: #34B7F1;
}

/* Typing Indicator */
.wa-typing {
    align-self: flex-start;
    background-color: var(--wa-message-in);
    padding: 10px 15px;
    border-radius: 20px;
    display: none;
    align-items: center;
    gap: 5px;
    width: fit-content;
    margin-bottom: 10px;
}

.wa-typing span {
    width: 6px;
    height: 6px;
    background-color: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.wa-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.wa-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Input Area */
.wa-footer {
    background-color: #f0f0f0;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 0 0 15px 15px;
}

.wa-input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.wa-send-btn,
.wa-mic-btn {
    background: none;
    border: none;
    color: var(--wa-teal-dark);
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
}

.wa-send-btn:hover,
.wa-mic-btn:hover {
    transform: scale(1.1);
}

/* Options Buttons Grid */
.wa-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
    width: 100%;
}

/* General Button Style */
.wa-option-btn {
    background-color: white;
    border: 1px solid #e0e0e0;
    color: var(--wa-teal-dark);
    padding: 12px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    text-align: center;
    min-height: 50px;
    position: relative;
    overflow: hidden;
}

.wa-option-btn:hover {
    background-color: #f0fdf4;
    border-color: var(--wa-teal-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wa-option-btn:active {
    transform: translateY(0);
}

/* Image Button Specifics (Square & Thumbnail) */
.wa-option-btn.has-image {
    aspect-ratio: 1 / 1;
    padding: 8px;
    justify-content: space-between;
}

.wa-btn-img {
    width: 100%;
    height: 75%;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
}

.wa-btn-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.wa-option-btn:hover .wa-btn-img img {
    transform: scale(1.1);
}

.wa-option-btn span {
    font-size: 12px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wa-options> :last-child:nth-child(odd) {
    grid-column: span 2;
}

/* Modal de Vista de Perfil - Estilo WhatsApp */
.wa-profile-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 20, 26, 0.95);
    z-index: 2147483649;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wa-profile-modal.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.wa-profile-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--wa-teal-dark);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.wa-profile-header h3 {
    color: white;
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.wa-profile-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.wa-profile-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.wa-profile-content {
    max-width: 500px;
    max-height: 70vh;
    padding: 20px;
    animation: profileZoom 0.3s ease;
}

.wa-profile-img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

@keyframes profileZoom {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Media Query para Móviles */
@media (max-width: 768px) {
    .whatsapp-widget {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: 2147483647;
    }

    .wa-launcher {
        position: absolute;
        bottom: 20px;
        right: 20px;
        pointer-events: auto;
        z-index: 2147483648;
    }

    .wa-chat-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        transform: translateY(100%);
        z-index: 2147483646;
    }

    .wa-chat-window.active {
        transform: translateY(0);
    }

    .wa-header {
        padding-top: 15px;
        border-radius: 0;
    }

    .wa-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .wa-profile-content {
        max-width: 90%;
        padding: 10px;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}