/**
 * Burbuja flotante + panel (variables inyectadas desde React / Admin).
 */
#hj93-chat-bubble-root {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.hj93-chat-widget {
    --hj93-primary-from: #0078d4;
    --hj93-primary-to: #00bcf2;
    --hj93-chat-bg: #1e1e2e;
    --hj93-bot-msg-bg: #2a2a3e;
    --hj93-border: #3a3a4e;
    --hj93-text: #ffffff;
    --hj93-muted: #a0a0a0;
    --hj93-accent: #00bcf2;
    position: fixed;
    z-index: 999999;
    bottom: 0;
    right: 0;
    pointer-events: none;
}

.hj93-chat-launcher {
    pointer-events: auto;
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
    color: #fff;
    background: linear-gradient(135deg, var(--hj93-primary-from) 0%, var(--hj93-primary-to) 100%);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hj93-chat-launcher:hover {
    transform: scale(1.06);
    box-shadow: 0 10px 32px rgba(0, 120, 212, 0.45);
}

.hj93-chat-launcher:focus-visible {
    outline: 3px solid var(--hj93-accent);
    outline-offset: 2px;
}

.hj93-chat-panel {
    pointer-events: auto;
    position: absolute;
    bottom: 88px;
    right: 20px;
    width: min(100vw - 40px, 400px);
    max-height: min(72vh, 560px);
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    overflow: hidden;
    background: var(--hj93-chat-bg);
    border: 1px solid var(--hj93-border);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    animation: hj93-panel-in 0.22s ease;
}

@keyframes hj93-panel-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.hj93-chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--hj93-border);
    background: linear-gradient(135deg, rgba(0, 120, 212, 0.2) 0%, rgba(0, 188, 242, 0.12) 100%);
}

.hj93-chat-panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--hj93-text);
    background: linear-gradient(135deg, var(--hj93-primary-from) 0%, var(--hj93-primary-to) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hj93-chat-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--hj93-border);
    background: transparent;
    color: var(--hj93-text);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hj93-chat-close:hover {
    background: var(--hj93-border);
}

.hj93-chat-stream {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    min-height: 180px;
    max-height: 340px;
}

.hj93-chat-welcome {
    text-align: center;
    padding: 12px 8px 20px;
}

.hj93-chat-welcome-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: linear-gradient(135deg, var(--hj93-primary-from) 0%, var(--hj93-primary-to) 100%);
}

.hj93-chat-welcome h3 {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--hj93-text);
    background: linear-gradient(135deg, var(--hj93-primary-from) 0%, var(--hj93-primary-to) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hj93-chat-welcome p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--hj93-muted);
}

.hj93-chat-msg {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    max-width: 92%;
    animation: hj93-msg-in 0.25s ease;
}

@keyframes hj93-msg-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hj93-chat-msg.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.hj93-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--hj93-primary-from) 0%, var(--hj93-primary-to) 100%);
}

.hj93-chat-avatar.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.hj93-chat-bubble-text {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--hj93-text);
    background: var(--hj93-bot-msg-bg);
    border-bottom-left-radius: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}

.hj93-chat-msg.user .hj93-chat-bubble-text {
    background: linear-gradient(135deg, var(--hj93-primary-from) 0%, var(--hj93-primary-to) 100%);
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 14px;
}

.hj93-chat-meta {
    font-size: 10px;
    color: var(--hj93-muted);
    margin-bottom: 4px;
}

.hj93-chat-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: var(--hj93-bot-msg-bg);
    border-radius: 14px;
    width: fit-content;
}

.hj93-chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--hj93-accent);
    animation: hj93-dot 1.2s infinite;
}

.hj93-chat-typing span:nth-child(2) {
    animation-delay: 0.15s;
}
.hj93-chat-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes hj93-dot {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

.hj93-chat-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 12px 14px;
    border-top: 1px solid var(--hj93-border);
}

.hj93-chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    resize: none;
    border: 2px solid transparent;
    border-radius: 22px;
    padding: 11px 16px;
    font-size: 14px;
    font-family: inherit;
    color: var(--hj93-text);
    background: var(--hj93-border);
}

.hj93-chat-input::placeholder {
    color: var(--hj93-muted);
}

.hj93-chat-input:focus {
    outline: none;
    border-color: var(--hj93-accent);
    background: var(--hj93-chat-bg);
}

.hj93-chat-send {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--hj93-primary-from) 0%, var(--hj93-primary-to) 100%);
    transition: transform 0.15s ease;
}

.hj93-chat-send:hover:not(:disabled) {
    transform: scale(1.05);
}

.hj93-chat-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .hj93-chat-launcher {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    .hj93-chat-panel {
        right: 12px;
        bottom: 78px;
        width: min(100vw - 24px, 100%);
    }
}
