* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    background: #f5f5f5;
    position: relative;
}

/* Contenedor del widget */
.whatsapp-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* Botón principal */
.whatsapp-button {
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    bottom: 0;
    right: 0;
    border: none;
    outline: none;
    opacity: 1;
    transform: scale(1);
}

.whatsapp-button:hover {
    background: #20BA5A;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.whatsapp-button.pre-open {
    background: #1FAD52;
    animation: darkPulse 3s ease-out;
}

@keyframes darkPulse {
    0% {
        background: #25D366;
    }
    50% {
        background: #1A9448;
    }
    100% {
        background: #1FAD52;
    }
}

/* Ocultar botón principal cuando se abre el chat */
.whatsapp-button.hidden {
    opacity: 0;
    transform: scale(0.3);
    pointer-events: none;
}

/* SVG del botón */
.whatsapp-button svg {
    width: 36px;
    height: 36px;
    fill: white;
}

/* Ventana del chat */
.whatsapp-chat {
    position: absolute;
    bottom: -10px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.1);
    transform-origin: bottom right;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.whatsapp-chat.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* Sombra inferior adicional */
.whatsapp-chat::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 10%;
    right: 10%;
    height: 20px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    filter: blur(10px);
    z-index: -1;
}

@media (max-width: 480px) {
    .whatsapp-chat {
        width: calc(100vw - 40px);
        right: -10px;
    }
}

/* Header del chat */
.chat-header {
    background: #25D366;
    padding: 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.whatsapp-logo {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.whatsapp-logo svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.chat-title {
    font-size: 18px;
    font-weight: 500;
}

/* Botón cerrar */
.close-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

.close-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Cuerpo del chat */
.chat-body {
    padding: 24px;
    padding-bottom: 20px;
    background: #f5f5f5;
    border-radius: 0 0 16px 16px;
    position: relative;
}

.chat-message {
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    border-bottom-left-radius: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
    margin-bottom: 20px;
}

.chat-message::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent white transparent transparent;
}

.chat-message-text {
    color: #303030;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message-text span {
    font-size: 16px;
    margin-right: 4px;
}

/* Contenedor del botón de abrir chat */
.open-chat-btn-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    margin-bottom: 8px;
}

/* Botón de abrir chat */
.open-chat-btn {
    background: #25D366;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 3px 10px rgba(37, 211, 102, 0.3);
    opacity: 0;
    transform: translateY(10px);
    animation: slideUpIn 0.4s ease-out 0.3s forwards;
    white-space: nowrap;
    min-width: 140px;
}

@keyframes slideUpIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.open-chat-btn:hover {
    background: #20BA5A;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.4);
}

.open-chat-btn:active {
    transform: translateY(0);
}

@keyframes popIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.open-chat-btn:hover {
    background: #20BA5A;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* SVG container para animación */
.chat-icon-svg {
    width: 28px;
    height: 28px;
    position: relative;
}

.svg-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.3s ease;
}

.svg-icon svg {
    width: 100%;
    height: 100%;
}

.svg-icon.arrow {
    opacity: 0;
}

.chat-icon-svg.show-arrow .paper {
    opacity: 0;
}

.chat-icon-svg.show-arrow .arrow {
    opacity: 1;
}

/* Path styles for custom SVG */
.joinchat_svg__plain {
    fill: white;
    stroke: none;
}

.joinchat_svg__chat {
    fill: none;
    stroke: white;
    stroke-width: 33;
}

/* Animación de entrada */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.whatsapp-widget {
    animation: slideIn 0.5s ease forwards;
}

/* Pulsación inicial */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.6);
    }
    100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
}

.whatsapp-button.pulse {
    animation: pulse 2s infinite;
}

/* Animación de expansión del chat más fluida */
@keyframes smoothExpand {
    0% {
        opacity: 0;
        transform: scale(0.2) translateY(30px);
    }
    60% {
        opacity: 1;
        transform: scale(1.01) translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.whatsapp-chat.show {
    animation: smoothExpand 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}