/**
 * Mi Chat Pro - Frontend Styles
 */

.mcp-widget {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: none;
}

.mcp-widget.mcp-visible {
    display: block;
}

/* Botón principal */
.mcp-button {
    background-color: var(--mcp-button-color, #25D366);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 14px 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 56px;
}

.mcp-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.mcp-button svg {
    flex-shrink: 0;
}

.mcp-button-text {
    white-space: nowrap;
}

/* Tooltip */
.mcp-tooltip {
    position: absolute;
    bottom: 100%;
    margin-bottom: 10px;
    background: #fff;
    color: #333;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.mcp-widget[data-position="right"] .mcp-tooltip {
    right: 0;
}

.mcp-widget[data-position="left"] .mcp-tooltip {
    left: 0;
}

.mcp-widget.mcp-tooltip-visible .mcp-tooltip {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Ventana de chat */
.mcp-window {
    position: fixed;
    bottom: 90px;
    width: 340px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.mcp-window.mcp-window-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.mcp-window-header {
    background: var(--mcp-header-color, #075E54);
    color: #fff;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mcp-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mcp-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    padding: 4px;
    box-sizing: border-box;
}

.mcp-avatar img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.mcp-avatar svg {
    background: rgba(255, 255, 255, 0.2);
    width: 100%;
    height: 100%;
}

.mcp-header-info strong {
    display: block;
    font-size: 15px;
    margin-bottom: 2px;
}

.mcp-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mcp-online,
.mcp-offline {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.mcp-online {
    background: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

.mcp-offline {
    background: #999;
}

.mcp-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.mcp-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.mcp-window-body {
    padding: 20px 16px;
    background: #ECE5DD;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill='%23d4cdc1' fill-opacity='0.4'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm56-76c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z'/%3E%3C/g%3E%3C/svg%3E");
    max-height: 60vh;
    overflow-y: auto;
}

.mcp-welcome {
    background: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    color: #303030;
    font-size: 14px;
    line-height: 1.5;
}

.mcp-welcome p {
    margin: 0 0 8px;
}

.mcp-welcome p:last-child {
    margin-bottom: 0;
}

.mcp-welcome::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 12px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 10px 10px 0;
    border-color: transparent #fff transparent transparent;
}

/* Canales */
.mcp-channels {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mcp-channel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border-radius: 8px;
    text-decoration: none;
    color: #303030;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mcp-channel:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.mcp-channel-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.mcp-channel-whatsapp .mcp-channel-icon { background: #25D366; }
.mcp-channel-instagram .mcp-channel-icon { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.mcp-channel-telegram .mcp-channel-icon { background: #0088cc; }
.mcp-channel-messenger .mcp-channel-icon { background: #006AFF; }
.mcp-channel-phone .mcp-channel-icon { background: #4285f4; }
.mcp-channel-sms .mcp-channel-icon { background: #34a853; }
.mcp-channel-email .mcp-channel-icon { background: #ea4335; }

/* GDPR */
.mcp-gdpr {
    margin-top: 16px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    font-size: 11px;
    color: #555;
    line-height: 1.4;
}

/* Mobile */
@media (max-width: 480px) {
    .mcp-window {
        width: calc(100vw - 20px);
        right: 10px !important;
        left: 10px !important;
        bottom: 80px;
    }

    .mcp-button-text {
        display: none;
    }

    .mcp-button {
        padding: 14px;
        border-radius: 50%;
        min-width: 56px;
        justify-content: center;
    }

    /* Tooltip en móvil: ARRIBA del botón, extendiéndose hacia el lado opuesto del borde
       para que el texto completo sea visible */
    .mcp-tooltip {
        bottom: 100%;
        margin-bottom: 12px;
        font-size: 12px;
        padding: 8px 14px;
        white-space: nowrap;
        width: auto;
    }

    /* Cuando el botón está a la DERECHA en móvil, el tooltip se ancla a la derecha
       y crece hacia la izquierda (lejos del borde) */
    .mcp-widget[data-position-mobile="right"] .mcp-tooltip {
        right: 0;
        left: auto;
    }

    /* Cuando el botón está a la IZQUIERDA en móvil, el tooltip se ancla a la izquierda
       y crece hacia la derecha (lejos del borde) */
    .mcp-widget[data-position-mobile="left"] .mcp-tooltip {
        left: 0;
        right: auto;
    }

    /* Flecha apuntando hacia el botón abajo */
    .mcp-widget[data-position-mobile="right"] .mcp-tooltip::after {
        content: '';
        position: absolute;
        bottom: -6px;
        right: 18px;
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 6px 6px 0 6px;
        border-color: #fff transparent transparent transparent;
    }

    .mcp-widget[data-position-mobile="left"] .mcp-tooltip::after {
        content: '';
        position: absolute;
        bottom: -6px;
        left: 18px;
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 6px 6px 0 6px;
        border-color: #fff transparent transparent transparent;
    }
}
