/* Squembri Chat Widget — Estilos
   La posición del bubble y la ventana se inyecta dinámicamente desde JS
   usando los valores configurados en el panel de WP.
*/

/* ── Botón flotante ─────────────────────────────────────── */
#sq-bubble {
    position: fixed;
    right: 24px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #1a1a1a;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#sq-bubble:hover {
    transform: scale(1.07);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
}

#sq-bubble svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Ventana del chat ───────────────────────────────────── */
#sq-window {
    position: fixed;
    right: 24px;
    width: 340px;
    max-height: 560px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
    display: flex;
    flex-direction: column;
    z-index: 99998;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    transform: translateY(12px) scale(0.97);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

#sq-window.sq-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* ── Cabecera ───────────────────────────────────────────── */
#sq-header {
    background: #1a1a1a;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

#sq-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #333;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

#sq-header-info span {
    font-size: 14px;
    font-weight: 500;
    display: block;
    line-height: 1.3;
}

#sq-header-info small {
    font-size: 11px;
    color: #aaa;
    line-height: 1;
}

#sq-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 4px;
    transition: color 0.1s;
}

#sq-close:hover {
    color: #fff;
}

/* ── Área de mensajes ───────────────────────────────────── */
#sq-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.sq-msg {
    max-width: 84%;
    font-size: 13.5px;
    line-height: 1.55;
    padding: 9px 13px;
    border-radius: 12px;
    word-break: break-word;
}

.sq-msg.sq-bot {
    background: #f2f2f2;
    color: #1a1a1a;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

.sq-msg.sq-user {
    background: #1a1a1a;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}

.sq-msg.sq-typing {
    color: #888;
    font-style: italic;
}

/* ── Formulario de lead ─────────────────────────────────── */
#sq-lead {
    background: #f7f7f7;
    border-top: 1px solid #eee;
    padding: 14px 16px;
    display: none;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

#sq-lead p {
    font-size: 13px;
    color: #555;
    margin: 0 0 4px;
    font-weight: 500;
}

#sq-lead input {
    font-size: 13px;
    padding: 8px 11px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    color: #1a1a1a;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

#sq-lead input:focus {
    outline: none;
    border-color: #1a1a1a;
}

#sq-lead-btn {
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 2px;
    transition: background 0.15s;
}

#sq-lead-btn:hover {
    background: #333;
}

#sq-lead-btn:disabled {
    background: #888;
    cursor: not-allowed;
}

/* ── Área de entrada ────────────────────────────────────── */
#sq-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

#sq-input {
    flex: 1;
    font-size: 13.5px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.15s;
}

#sq-input:focus {
    outline: none;
    border-color: #1a1a1a;
}

#sq-input:disabled {
    background: #f5f5f5;
}

#sq-send {
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 38px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

#sq-send:hover {
    background: #333;
}

#sq-send:disabled {
    background: #888;
    cursor: not-allowed;
}

#sq-send svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 420px) {
    #sq-window {
        width: calc(100vw - 24px);
        right: 12px;
    }

    #sq-bubble {
        right: 12px;
    }
}
