/* ========================================
   WhatsApp Widget Styles
   ======================================== */

.hidroplus-whatsapp-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Botón flotante de WhatsApp */
.whatsapp-button {
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    border: none;
    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 ease;
    position: relative;
    z-index: 1000000;
}

.whatsapp-button:hover {
    background: #20BA5A;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transform: scale(1.1);
}

.whatsapp-button .whatsapp-icon {
    width: 32px;
    height: 32px;
    color: white;
}

.whatsapp-button.active {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

/* Botón de cerrar (en la misma posición que el botón de WhatsApp) */
.whatsapp-close-button {
    width: 60px;
    height: 60px;
    background: #DC3545;
    border-radius: 50%;
    border: none;
    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 ease;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000000;
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
    color: white;
}

.whatsapp-close-button:hover {
    background: #C82333;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transform: scale(1.1);
}

.whatsapp-close-button.active {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Ventana de chat (aparece arriba del botón) */
.whatsapp-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: scale(0) translateY(20px);
    transform-origin: bottom right;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999998;
    pointer-events: none;
}

.whatsapp-chat-window.active {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.whatsapp-header {
    background: #075E54;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.whatsapp-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.whatsapp-avatar {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.whatsapp-avatar .avatar-icon {
    width: 28px;
    height: 28px;
    color: #075E54;
}

.whatsapp-avatar .avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.whatsapp-info {
    flex: 1;
    min-width: 0;
}

.whatsapp-name {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.whatsapp-status {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}



/* Body */
.whatsapp-body {
    background: #E5DDD5;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect fill="%23E5DDD5" width="100" height="100"/><circle fill="%23D1D1D1" cx="50" cy="50" r="1" opacity="0.1"/></svg>');
    padding: 20px;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.whatsapp-message {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
}

.message-bubble {
    background: white;
    border-radius: 8px;
    padding: 8px 12px;
    max-width: 75%;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-bubble::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent white transparent transparent;
}

.message-bubble p {
    margin: 0 0 4px 0;
    color: #000;
    font-size: 14px;
    line-height: 1.5;
}

.message-time {
    font-size: 11px;
    color: #667781;
    display: block;
    text-align: right;
}

/* Footer */
.whatsapp-footer {
    background: white;
    padding: 12px 16px;
    border-top: 1px solid #E9EDEF;
}

.whatsapp-start-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #25D366;
    color: white !important;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    width: 100%;
}

.whatsapp-start-chat:hover {
    background: #20BA5A;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 211, 102, 0.3);
}

.whatsapp-start-chat .chat-icon {
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 480px) {
    .hidroplus-whatsapp-widget {
        bottom: 16px;
        right: 16px;
    }

    .whatsapp-button {
        width: 56px;
        height: 56px;
    }

    .whatsapp-button .whatsapp-icon {
        width: 28px;
        height: 28px;
    }

    .whatsapp-close-button {
        width: 56px;
        height: 56px;
        bottom: 16px;
        right: 16px;
    }

    .whatsapp-chat-window {
        width: calc(100vw - 32px);
        max-width: 100%;
        bottom: 82px;
        right: 16px;
        left: 16px;
        transform-origin: bottom center;
    }
}

/* Scrollbar personalizado para el body */
.whatsapp-body::-webkit-scrollbar {
    width: 6px;
}

.whatsapp-body::-webkit-scrollbar-track {
    background: transparent;
}

.whatsapp-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.whatsapp-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}