/* ============================================================
CHAT DE SOPORTE
============================================================ */

.contenedor-chat {
    position: fixed;

    right: 24px;
    bottom: 24px;

    z-index: 2000;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, Helvetica, Arial, sans-serif;
}

/* Botón flotante */

.boton-chat {
    width: 58px;
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 50%;

    background-color: #2563eb;
    color: #ffffff;

    cursor: pointer;

    box-shadow:
        0 6px 18px rgba(15, 23, 42, 0.18);

    transform: translateY(-48px);

    transition:
        background-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.boton-chat svg {
    width: 27px;
    height: 27px;
    display: block;
    fill: #ffffff;
}

.boton-chat:hover {
    background-color: #1d4ed8;

    transform: translateY(-50px);

    box-shadow:
        0 8px 22px rgba(15, 23, 42, 0.22);
}

/* Ventana */

.ventana-chat {
    position: absolute;

    right: 0;
    bottom: 70px;

    width: 360px;
    height: 500px;

    display: none;
    flex-direction: column;

    background-color: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    overflow: hidden;

    box-shadow:
        0 15px 40px rgba(15, 23, 42, 0.14),
        0 3px 8px rgba(15, 23, 42, 0.06);
}

/* Encabezado */

.encabezado-chat {
    min-height: 70px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 14px 18px;

    background-color: #ffffff;

    border-bottom: 1px solid #e5e7eb;
}

.encabezado-chat div {
    min-width: 0;
}

.encabezado-chat strong {
    display: block;

    margin-bottom: 3px;

    color: #111827;

    font-size: 14px;
    font-weight: 600;
}

.encabezado-chat small {
    display: block;

    color: #6b7280;

    font-size: 12px;
}

.cerrar-chat {
    width: 32px;
    height: 32px;

    flex: 0 0 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 7px;

    background-color: transparent;
    color: #6b7280;

    font-size: 22px;
    line-height: 1;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.cerrar-chat:hover {
    background-color: #f3f4f6;

    color: #111827;
}

/* Datos del visitante */

.datos-visitante-chat {
    padding: 24px 20px;
}

.datos-visitante-chat p {
    margin: 0 0 20px;

    color: #374151;

    font-size: 13px;
    line-height: 1.5;
}

.campo-chat {
    margin-bottom: 14px;
}

.campo-chat label {
    display: block;

    margin-bottom: 6px;

    color: #374151;

    font-size: 12px;
    font-weight: 600;
}

.campo-chat input {
    width: 100%;
    height: 40px;

    box-sizing: border-box;

    padding: 0 11px;

    border: 1px solid #d1d5db;
    border-radius: 7px;

    outline: 0;

    background-color: #ffffff;
    color: #111827;

    font-family: inherit;
    font-size: 13px;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.campo-chat input:focus {
    border-color: #2563eb;

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.12);
}

.campo-chat input::placeholder {
    color: #9ca3af;
}

/* Botón continuar */

.boton-continuar-chat {
    width: 100%;
    height: 40px;

    margin-top: 4px;

    border: 1px solid #2563eb;
    border-radius: 7px;

    background-color: #2563eb;
    color: #ffffff;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.boton-continuar-chat:hover {
    background-color: #1d4ed8;

    border-color: #1d4ed8;
}

/* Selección del motivo */

.seleccion-tipo-chat {
    padding: 24px 20px;
}

.seleccion-tipo-chat p {
    margin: 0 0 18px;

    color: #374151;

    font-size: 13px;
    line-height: 1.5;
}

.seleccion-tipo-chat button {
    width: 100%;

    min-height: 44px;

    display: flex;
    align-items: center;
    justify-content: flex-start;

    margin-bottom: 10px;

    padding: 10px 14px;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    background-color: #ffffff;
    color: #374151;

    font-size: 13px;
    font-weight: 500;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.seleccion-tipo-chat button:hover {
    background-color: #eff6ff;

    border-color: #2563eb;

    color: #2563eb;
}

/* Contenido de la conversación */

.contenido-conversacion {
    min-height: 0;

    flex: 1;

    flex-direction: column;
}

/* Mensajes */

.mensajes-chat {
    min-height: 0;

    flex: 1;

    overflow-y: auto;

    padding: 16px;

    background-color: #f5f6f8;
}

.mensaje {
    max-width: 82%;

    margin-bottom: 10px;

    padding: 9px 11px;

    border-radius: 10px;

    font-size: 13px;
    line-height: 1.45;
}

.mensaje-usuario {
    margin-left: auto;

    background-color: #2563eb;

    color: #ffffff;

    border-bottom-right-radius: 3px;
}

.mensaje-administrador {
    margin-right: auto;

    background-color: #ffffff;

    color: #374151;

    border: 1px solid #e5e7eb;

    border-bottom-left-radius: 3px;
}

.mensaje-texto {
    word-break: break-word;
}

.mensaje-hora {
    margin-top: 4px;

    font-size: 10px;

    opacity: 0.65;

    text-align: right;
}

/* Entrada */

#formulario-chat {
    background-color: #ffffff;

    border-top: 1px solid #e5e7eb;

    padding: 10px;
}

.entrada-chat {
    display: flex;

    align-items: center;

    gap: 8px;
}

.entrada-chat input {
    min-width: 0;

    flex: 1;

    height: 40px;

    padding: 0 11px;

    border: 1px solid #d1d5db;

    border-radius: 7px;

    outline: 0;

    background-color: #ffffff;

    color: #111827;

    font-family: inherit;

    font-size: 13px;
}

.entrada-chat input:focus {
    border-color: #2563eb;

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.12);
}

.entrada-chat input::placeholder {
    color: #9ca3af;
}

.entrada-chat button {
    height: 40px;

    padding: 0 14px;

    border: 1px solid #2563eb;

    border-radius: 7px;

    background-color: #2563eb;

    color: #ffffff;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.entrada-chat button:hover {
    background-color: #1d4ed8;

    border-color: #1d4ed8;
}

/* ============================================================
CHAT - MÓVIL
============================================================ */

@media (max-width: 767.98px) {

    .contenedor-chat {
        right: 14px;
        bottom: 76px;          /* barra inferior (~56px) + 20px de aire */
    }

    .boton-chat {
        width: 46px;           /* más pequeña */
        height: 46px;
        transform: none;
    }

    .boton-chat:hover {
        transform: none;
    }

    .boton-chat svg {
        width: 22px;
        height: 22px;
    }

    .ventana-chat {
        right: 0;
        bottom: 56px;          /* justo encima del botón */

        width: min(360px, calc(100vw - 28px));
        height: min(500px, calc(100dvh - 170px));

        border-radius: 12px;
    }

}

.contenedor-chat { pointer-events: none; }
.boton-chat,
.ventana-chat { pointer-events: auto; }