/* --- Contenedor Principal --- */
.med-wa-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    font-family: system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none; 
}

/* --- Ventana de Chat --- */
.med-wa-chat-window {
    width: 300px;
    background-color: #ECE5DD;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    margin-bottom: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: none;
}

.med-wa-chat-window.show-chat {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto; 
}

/* --- Cabecera del Chat --- */
.med-wa-header {
    background-color: #075E54;
    color: #ffffff;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.med-wa-avatar {
    width: 40px;
    height: 40px;
    background-color: #25D366;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.med-wa-info {
    display: flex;
    flex-direction: column;
}

.med-wa-info strong {
    font-size: 15px;
    line-height: 1.2;
}

.med-wa-info span {
    font-size: 12px;
    color: #e0e0e0;
}

/* --- Cuerpo del Chat --- */
.med-wa-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-image: radial-gradient(#d3cbc1 1px, transparent 1px);
    background-size: 20px 20px;
}

/* --- Burbujas de Chat (Enlaces) --- */
.med-wa-bubble-link {
    background-color: #DCF8C6 !important;
    color: #128C7E !important;
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 12px 12px 0 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    align-self: flex-end;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.med-wa-bubble-link:hover {
    background-color: #c8e8b0 !important;
    transform: translateY(-2px);
}

/* --- Botón Principal Flotante --- */
.med-wa-main-btn {
    background-color: #25D366 !important;
    border: none !important;
    border-radius: 50%;
    width: 65px;
    height: 65px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 20px rgba(37,211,102,0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    pointer-events: auto; 
}

.med-wa-main-btn:hover {
    background-color: #128C7E !important; 
    transform: scale(1.05);
}

/* --- Logo de WhatsApp 100% en CSS --- */
.med-wa-css-logo {
    width: 34px;
    height: 34px;
    background: transparent;
    border: 3px solid #ffffff;
    border-radius: 50%;
    position: relative;
    transform: rotate(10deg); 
}

.med-wa-css-logo::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: -4px;
    width: 0;
    height: 0;
    border-top: 10px solid #ffffff;
    border-left: 10px solid transparent;
    transform: rotate(30deg);
}

.med-wa-css-logo::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    width: 14px;
    height: 14px;
    border: 3px solid transparent;
    border-top-color: #ffffff;
    border-right-color: #ffffff;
    border-radius: 50%;
    transform: rotate(45deg);
}

/* --- Botón Rojo de Llamada (Flotante a la Izquierda) --- */
.med-btn-llamar-izq {
    position: fixed;
    bottom: 30px;
    left: 30px; 
    z-index: 999999;
    background-color: #FF0000 !important;
    color: #ffffff !important;
    padding: 12px 28px;
    border-radius: 50px; 
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 0.5px;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(255, 0, 0, 0.4);
    transition: all 0.3s ease;
    animation: pulse-phone-izq 2s infinite;
    pointer-events: auto;
}

.med-btn-llamar-izq:hover {
    background-color: #cc0000 !important;
    transform: scale(1.05);
    animation: none; 
}

/* Keyframes para el pulso rojo de la izquierda */
@keyframes pulse-phone-izq {
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.6); }
    70% { box-shadow: 0 0 0 15px rgba(255, 0, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); }
}

/* --- Ajuste Responsive para Móviles --- */
@media (max-width: 768px) {
    .med-btn-llamar-izq {
        bottom: 20px;
        left: 15px; 
        padding: 10px 20px;
        font-size: 14px; 
    }
    .med-wa-container {
        bottom: 20px;
        right: 15px;
    }
    .med-wa-chat-window {
        width: 280px;
    }
}