/* ============================================================
 * BizkaiaTalent - Widget de ChatBot
 * Widget flotante en bottom-right, minimizable.
 * ============================================================ */

:root {
    --bt-chat-primary: #003a6c;
    --bt-chat-primary-hover: #002e57;
    --bt-chat-accent: #ffce00;
    --bt-chat-bg: #ffffff;
    --bt-chat-text: #1d1d1f;
    --bt-chat-muted: #6b7280;
    --bt-chat-border: #e5e7eb;
    --bt-chat-user-bg: #003a6c;
    --bt-chat-user-text: #ffffff;
    --bt-chat-assist-bg: #f3f4f6;
    --bt-chat-assist-text: #1d1d1f;
    --bt-chat-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.bt-chatbot-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--bt-chat-primary);
    color: #fff;
    box-shadow: var(--bt-chat-shadow);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, background 0.18s ease;
}

.bt-chatbot-toggle:hover {
    background: var(--bt-chat-primary-hover);
    transform: scale(1.05);
}

.bt-chatbot-toggle svg {
    width: 28px;
    height: 28px;
}

.bt-chatbot-toggle[hidden] {
    display: none;
}

.bt-chatbot-window {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 64px);
    background: var(--bt-chat-bg);
    border-radius: 16px;
    box-shadow: var(--bt-chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--bt-chat-text);
}

.bt-chatbot-window[hidden] {
    display: none;
}

.bt-chatbot-header {
    background: var(--bt-chat-primary);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bt-chatbot-header .bt-chatbot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bt-chat-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bt-chat-primary);
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.bt-chatbot-header .bt-chatbot-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.bt-chatbot-header .bt-chatbot-title strong {
    font-size: 14px;
    font-weight: 600;
}

.bt-chatbot-header .bt-chatbot-title span {
    font-size: 11px;
    opacity: 0.8;
}

.bt-chatbot-header .bt-chatbot-actions {
    display: flex;
    gap: 4px;
}

.bt-chatbot-header button {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.bt-chatbot-header button:hover {
    background: rgba(255, 255, 255, 0.18);
}

.bt-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bt-chatbot-msg {
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.bt-chatbot-msg.user {
    align-self: flex-end;
    background: var(--bt-chat-user-bg);
    color: var(--bt-chat-user-text);
    border-bottom-right-radius: 4px;
}

.bt-chatbot-msg.assistant {
    align-self: flex-start;
    background: var(--bt-chat-assist-bg);
    color: var(--bt-chat-assist-text);
    border-bottom-left-radius: 4px;
}

.bt-chatbot-msg.error {
    align-self: flex-start;
    background: #fee2e2;
    color: #991b1b;
    border-bottom-left-radius: 4px;
}

.bt-chatbot-msg-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    max-width: 85%;
}

.bt-chatbot-msg-wrap.user {
    align-self: flex-end;
    align-items: flex-end;
}

.bt-chatbot-msg-wrap .bt-chatbot-msg {
    max-width: 100%;
}

.bt-chatbot-feedback {
    display: flex;
    gap: 4px;
    padding: 0 4px;
    opacity: 0.55;
    transition: opacity 0.15s ease;
}

.bt-chatbot-msg-wrap:hover .bt-chatbot-feedback,
.bt-chatbot-feedback.sent {
    opacity: 1;
}

.bt-chatbot-feedback button {
    background: transparent;
    border: 1px solid var(--bt-chat-border);
    border-radius: 999px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bt-chat-muted);
    font-size: 13px;
    line-height: 1;
    padding: 0;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.bt-chatbot-feedback button:hover:not(:disabled) {
    background: #f3f4f6;
    color: var(--bt-chat-text);
}

.bt-chatbot-feedback button:disabled {
    cursor: default;
}

.bt-chatbot-feedback button.active.up {
    background: #d1fae5;
    border-color: #34d399;
    color: #065f46;
}

.bt-chatbot-feedback button.active.down {
    background: #fee2e2;
    border-color: #f87171;
    color: #991b1b;
}

.bt-chatbot-feedback-thanks {
    font-size: 11px;
    color: var(--bt-chat-muted);
    padding: 0 4px;
}

.bt-chatbot-handoff-cta {
    align-self: flex-start;
    background: transparent;
    border: 1px solid var(--bt-chat-primary);
    color: var(--bt-chat-primary);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
    margin-top: 2px;
}

.bt-chatbot-handoff-cta:hover:not(:disabled) {
    background: var(--bt-chat-primary);
    color: #fff;
}

.bt-chatbot-handoff-cta:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bt-chatbot-handoff-form {
    align-self: stretch;
    background: #f9fafb;
    border: 1px solid var(--bt-chat-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bt-chatbot-handoff-form label {
    font-size: 12px;
    color: var(--bt-chat-muted);
    margin: 0;
}

.bt-chatbot-handoff-form input,
.bt-chatbot-handoff-form textarea {
    border: 1px solid var(--bt-chat-border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    resize: vertical;
    transition: border-color 0.15s ease;
}

.bt-chatbot-handoff-form input:focus,
.bt-chatbot-handoff-form textarea:focus {
    border-color: var(--bt-chat-primary);
}

.bt-chatbot-handoff-form .bt-chatbot-handoff-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.bt-chatbot-handoff-form button {
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid var(--bt-chat-border);
    background: #fff;
    color: var(--bt-chat-text);
}

.bt-chatbot-handoff-form button.primary {
    background: var(--bt-chat-primary);
    color: #fff;
    border-color: var(--bt-chat-primary);
}

.bt-chatbot-handoff-form button.primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bt-chatbot-handoff-status {
    align-self: flex-start;
    font-size: 12px;
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #34d399;
    border-radius: 8px;
    padding: 6px 10px;
}

.bt-chatbot-handoff-status.error {
    color: #991b1b;
    background: #fee2e2;
    border-color: #f87171;
}

.bt-chatbot-nav-cta,
.bt-chatbot-guia-cta {
    align-self: flex-start;
    background: var(--bt-chat-primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.12s ease, transform 0.12s ease;
    margin-top: 2px;
}

.bt-chatbot-nav-cta:hover,
.bt-chatbot-guia-cta:hover {
    background: var(--bt-chat-primary-hover);
    transform: translateY(-1px);
}

.bt-chatbot-guia-cta {
    background: transparent;
    color: var(--bt-chat-primary);
    border: 1px solid var(--bt-chat-primary);
}

.bt-chatbot-guia-cta:hover {
    background: var(--bt-chat-primary);
    color: #fff;
}

.bt-chatbot-typing {
    align-self: flex-start;
    background: var(--bt-chat-assist-bg);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.bt-chatbot-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bt-chat-muted);
    animation: bt-chat-bounce 1.2s infinite ease-in-out;
}

.bt-chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.bt-chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bt-chat-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.bt-chatbot-form {
    border-top: 1px solid var(--bt-chat-border);
    padding: 10px;
    display: flex;
    gap: 8px;
    background: #fff;
}

.bt-chatbot-form textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--bt-chat-border);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    max-height: 100px;
    outline: none;
    transition: border-color 0.15s ease;
}

.bt-chatbot-form textarea:focus {
    border-color: var(--bt-chat-primary);
}

.bt-chatbot-form button {
    background: var(--bt-chat-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.bt-chatbot-form button:hover:not(:disabled) {
    background: var(--bt-chat-primary-hover);
}

.bt-chatbot-form button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.bt-chatbot-disclaimer {
    text-align: center;
    font-size: 11px;
    color: var(--bt-chat-muted);
    padding: 4px 10px 8px;
    background: #fff;
}

@media (max-width: 480px) {
    .bt-chatbot-window {
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}
