/* Portfolio Chatbot Widget */

/* ---- Home page banner ---- */
.chatbot-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    margin-bottom: 24px;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    color: #2c3e50;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chatbot-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-mode="dark"] .chatbot-banner {
    background: #2a2f36;
    border-color: #3a3f47;
    color: #c9d1d9;
}

[data-mode="dark"] .chatbot-banner:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chatbot-banner-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #dee2e6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-mode="dark"] .chatbot-banner-icon {
    background: #3a3f47;
}

.chatbot-banner-icon svg {
    width: 22px;
    height: 22px;
    fill: #495057;
}

[data-mode="dark"] .chatbot-banner-icon svg {
    fill: #adb5bd;
}

.chatbot-banner-text {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.4;
}

.chatbot-banner-text strong {
    font-size: 1.05rem;
}

.chatbot-banner-cta {
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 14px;
    background: #dee2e6;
    color: #495057;
    border-radius: 20px;
    white-space: nowrap;
}

[data-mode="dark"] .chatbot-banner-cta {
    background: #3a3f47;
    color: #adb5bd;
}

@media (max-width: 576px) {
    .chatbot-banner {
        flex-wrap: wrap;
    }

    .chatbot-banner-cta {
        width: 100%;
        text-align: center;
        margin-top: 4px;
    }
}

/* ---- Floating chat button ---- */
.chatbot-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #495057;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

.chatbot-trigger:hover {
    transform: scale(1.08);
    background: #3a3f47;
}

.chatbot-trigger svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.chatbot-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: var(--card-bg, #fff);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chatbot-panel.open {
    display: flex;
}

.chatbot-header {
    padding: 14px 16px;
    background: #495057;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 4px;
    opacity: 0.8;
}

.chatbot-header-close:hover {
    opacity: 1;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-msg a {
    color: #495057;
}

.chatbot-msg-bot {
    align-self: flex-start;
    background: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 4px;
}

.chatbot-msg-user {
    align-self: flex-end;
    background: #6c757d;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chatbot-msg-bot code {
    background: #e2e8f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.85em;
}

.chatbot-typing {
    align-self: flex-start;
    padding: 10px 14px;
    background: #f1f5f9;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: chatbot-bounce 1.2s infinite ease-in-out;
}

.chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatbot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.chatbot-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    background: var(--card-bg, #fff);
    color: var(--text-color, #1e293b);
}

.chatbot-input:focus {
    border-color: #495057;
}

.chatbot-send {
    padding: 10px 16px;
    background: #495057;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    flex-shrink: 0;
}

.chatbot-send:hover {
    background: #3a3f47;
}

.chatbot-send:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.chatbot-error {
    color: #dc2626;
    font-size: 0.8rem;
    text-align: center;
    padding: 6px;
}

/* Dark mode support (Chirpy theme) */
[data-mode="dark"] .chatbot-panel {
    background: #212529;
}

[data-mode="dark"] .chatbot-msg-bot {
    background: #343a40;
    color: #dee2e6;
}

[data-mode="dark"] .chatbot-msg-bot code {
    background: #495057;
}

[data-mode="dark"] .chatbot-msg-user {
    background: #6c757d;
    color: #f8f9fa;
}

[data-mode="dark"] .chatbot-input {
    background: #343a40;
    color: #dee2e6;
    border-color: #495057;
}

[data-mode="dark"] .chatbot-input-area {
    border-top-color: #495057;
}

[data-mode="dark"] .chatbot-typing {
    background: #343a40;
}

[data-mode="dark"] .chatbot-typing span {
    background: #6c757d;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .chatbot-panel {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .chatbot-trigger {
        bottom: 16px;
        right: 16px;
    }
}
