/* Caja general del chat (modo normal en página) */
.ftc-chat-wrapper {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    max-width: 600px;
    margin: 20px auto;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Título CHAT EN VIVO */
.ftc-chat-title {
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
    color: #2e7d32;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ===========================
   MODO FLOTANTE + BOTÓN
   =========================== */

/* Contenedor fijo que agrupa el chat y el botón */
.ftc-chat-floating-box {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Posiciones posibles del contenedor flotante */
.ftc-chat-floating-box.ftc-pos-bottom-right {
    bottom: 20px;
    right: 20px;
}

.ftc-chat-floating-box.ftc-pos-bottom-left {
    bottom: 20px;
    left: 20px;
    align-items: flex-start;
}

.ftc-chat-floating-box.ftc-pos-top-right {
    top: 20px;
    right: 20px;
}

.ftc-chat-floating-box.ftc-pos-top-left {
    top: 20px;
    left: 20px;
    align-items: flex-start;
}

/* El chat flotante en sí (se esconde/muestra) */
.ftc-chat-floating {
    width: 320px;
    max-width: 90vw;
    margin: 0;
    margin-bottom: 10px;
}

/* Por defecto el chat flotante está oculto */
.ftc-chat-floating-box .ftc-chat-floating {
    display: none;
}

/* Cuando el contenedor tiene .ftc-open, se muestra la caja de chat */
.ftc-chat-floating-box.ftc-open .ftc-chat-floating {
    display: block;
}

/* Botón burbuja flotante: balón + texto CHAT */
.ftc-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: #2e7d32;
    color: #fff;
    font-size: 22px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.ftc-chat-toggle:hover {
    background: #1b5e20;
}

.ftc-chat-toggle-icon {
    font-size: 22px;
}

.ftc-chat-toggle-label {
    font-size: 10px;
    margin-top: 1px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ===========================
   ESTILOS COMUNES DEL CHAT
   =========================== */

.ftc-chat-messages {
    border: 1px solid #eee;
    border-radius: 8px;
    height: 260px;
    overflow-y: auto;
    padding: 8px;
    background: #fafafa;
    margin-bottom: 10px;
}

.ftc-message-item {
    margin-bottom: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: #ffffff;
    border-left: 3px solid #2e7d32;
}

.ftc-message-meta {
    font-size: 11px;
    color: #555;
    margin-bottom: 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}

.ftc-message-user {
    font-weight: 600;
}

.ftc-message-time {
    opacity: 0.8;
}

/* Botón eliminar para admin */
.ftc-msg-delete {
    background: transparent;
    border: none;
    color: #c62828;
    font-size: 14px;
    cursor: pointer;
    margin-left: 6px;
    padding: 0 4px;
    line-height: 1;
}
.ftc-msg-delete:hover {
    color: #b71c1c;
}

.ftc-message-text {
    font-size: 13px;
    color: #333;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.ftc-loading {
    text-align: center;
    color: #666;
    font-size: 13px;
    padding: 15px 0;
}

.ftc-chat-form {
    margin-top: 5px;
}

.ftc-form-row {
    margin-bottom: 8px;
}

.ftc-form-row label {
    display: block;
    font-size: 13px;
    margin-bottom: 3px;
    font-weight: 600;
}

.ftc-form-row input[type="text"],
.ftc-form-row textarea {
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 13px;
    box-sizing: border-box;
}

.ftc-form-row textarea {
    resize: vertical;
}

.ftc-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ftc-btn-send {
    background: #2e7d32;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
}

.ftc-btn-send:hover {
    background: #1b5e20;
}

.ftc-form-status {
    font-size: 12px;
    color: #555;
}

/* Responsive */
@media (max-width: 480px) {
    .ftc-chat-wrapper {
        padding: 10px;
        margin: 10px;
    }

    .ftc-chat-floating {
        width: 95vw;
        max-width: 95vw;
    }

    .ftc-chat-messages {
        height: 220px;
    }
}