/* ── BOTÓN FLOTANTE ── */
.chat-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #005c48;
    color: white;
    font-size: 22px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 92, 72, 0.45);
    z-index: 1000;
    transition: background 0.2s, transform 0.2s;
}

.chat-btn:hover {
    background: #00382c;
    transform: scale(1.08);
}

/* ── OVERLAY MÓVIL ── */
.chat-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1001;
    backdrop-filter: blur(2px);
}

.chat-overlay.open {
    display: block;
}

/* ── VENTANA FLOTANTE ── */
.chat-float {
    position: fixed;
    bottom: 96px;
    /* justo encima del botón */
    right: 24px;
    width: 390px;
    height: 600px;
    z-index: 1002;
    border-radius: 24px;
    box-shadow: 0 12px 48px rgba(0, 92, 72, 0.22);
    overflow: hidden;

    /* Estado inicial: oculto */
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-float.open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}


/* El chat-wrapper ocupa todo el flotante */
.chat-float .chat-wrapper {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
}

/* ── BOTÓN CERRAR EN EL HEADER ── */
.chat-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.18s;
    flex-shrink: 0;
    margin-left: auto;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* ── RESPONSIVE MÓVIL ── */
@media (max-width: 820px) {
    .chat-float {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chat-float .chat-wrapper {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .chat-btn {
        bottom: 16px;
        right: 16px;
    }

    #messages {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }

    .chat-input-area {
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
        background: white;
    }
}