/* ============================================================
   Chat Widget — SunoBackup2026
   ============================================================ */

/* ── BOTÓN FLOTANTE ──────────────────────────────────────── */
#sb-chat-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9000;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.55);
    transition: transform 0.2s, box-shadow 0.2s;
    outline: none;
}
#sb-chat-btn:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(124,58,237,0.7); }
#sb-chat-btn svg { width: 26px; height: 26px; fill: white; }
#sb-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ec4899;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #1a0b2e;
    display: none;
}

/* ── PANEL ───────────────────────────────────────────────── */
#sb-chat-panel {
    position: fixed;
    bottom: 94px;
    left: 20px;
    z-index: 9001;
    width: 340px;
    max-width: calc(100vw - 24px);
    max-height: 520px;
    background: #1a0b2e;
    border: 1px solid rgba(167,124,202,0.22);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.7);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: "Manrope", sans-serif;
    animation: sbSlideUp 0.22s ease;
}
#sb-chat-panel.open { display: flex; }
@keyframes sbSlideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── CABECERA ────────────────────────────────────────────── */
#sb-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #241640, #1a0b2e);
    border-bottom: 1px solid rgba(167,124,202,0.15);
}
#sb-chat-header .sb-chat-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#sb-chat-header .sb-chat-logo svg { width: 18px; height: 18px; fill: white; }
#sb-chat-header .sb-chat-info { flex: 1; }
#sb-chat-header .sb-chat-title { font-size: 14px; font-weight: 700; color: #f5f3ff; }
#sb-chat-header .sb-chat-status { font-size: 11px; color: #a78bca; margin-top: 1px; }
#sb-chat-header .sb-chat-status.online { color: #34d399; }
#sb-chat-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #a78bca;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
#sb-chat-close:hover { color: #f5f3ff; }
#sb-chat-close svg { width: 18px; height: 18px; }

/* ── CUERPO / MENSAJES ───────────────────────────────────── */
#sb-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 200px;
    scrollbar-width: thin;
    scrollbar-color: rgba(167,124,202,0.3) transparent;
}
.sb-msg {
    max-width: 80%;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}
.sb-msg-visitor {
    background: #241640;
    color: #f5f3ff;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}
.sb-msg-admin {
    background: linear-gradient(135deg, #7c3aed22, #ec489922);
    border: 1px solid rgba(124,58,237,0.35);
    color: #f5f3ff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}
.sb-msg-admin-label {
    font-size: 10px;
    font-weight: 700;
    color: #a78bca;
    text-align: right;
    margin-bottom: 3px;
}
.sb-msg-system {
    font-size: 11px;
    color: #a78bca;
    text-align: center;
    align-self: center;
    padding: 4px 10px;
}
.sb-msg-time {
    font-size: 10px;
    color: #a78bca;
    margin-top: 3px;
}

/* ── FORMULARIO INICIAL ──────────────────────────────────── */
#sb-chat-form {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid rgba(167,124,202,0.15);
}
.sb-field-label {
    font-size: 11px;
    font-weight: 600;
    color: #a78bca;
    margin-bottom: 2px;
}
.sb-input, .sb-select, .sb-textarea {
    width: 100%;
    background: #241640;
    border: 1px solid rgba(167,124,202,0.25);
    border-radius: 8px;
    color: #f5f3ff;
    font-family: inherit;
    font-size: 13px;
    padding: 8px 10px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.sb-input:focus, .sb-select:focus, .sb-textarea:focus {
    border-color: rgba(124,58,237,0.6);
}
.sb-select { cursor: pointer; }
.sb-select option { background: #241640; }
.sb-textarea { resize: none; height: 72px; }
.sb-btn-send {
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}
.sb-btn-send:hover { opacity: 0.88; }
.sb-btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── FOOTER DE CONVERSACIÓN (input de respuesta) ─────────── */
#sb-chat-reply {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid rgba(167,124,202,0.15);
}
#sb-chat-reply input {
    flex: 1;
    background: #241640;
    border: 1px solid rgba(167,124,202,0.25);
    border-radius: 8px;
    color: #f5f3ff;
    font-family: inherit;
    font-size: 13px;
    padding: 8px 10px;
    outline: none;
}
#sb-chat-reply input:focus { border-color: rgba(124,58,237,0.6); }
#sb-chat-reply button {
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 14px;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

/* ── RESUELTO ────────────────────────────────────────────── */
.sb-resolved-note {
    text-align: center;
    font-size: 12px;
    color: #34d399;
    padding: 10px;
    border-top: 1px solid rgba(167,124,202,0.15);
}

/* ── MOBILE ──────────────────────────────────────────────── */
@media (max-width: 400px) {
    #sb-chat-panel { left: 8px; right: 8px; width: auto; }
    #sb-chat-btn   { bottom: 16px; left: 16px; }
}
