/* ========================================
   PORTFOLIO CHATBOT — STYLES
   ======================================== */

/* --- Launcher Button --- */
.chatbot-launcher {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 20px var(--primary-glow, rgba(108, 99, 255, 0.4));
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: launcher-pulse 2.5s ease-in-out infinite;
}

.chatbot-launcher-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chatbot-launcher:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px var(--primary-glow, rgba(108, 99, 255, 0.6));
}

.chatbot-launcher.hidden { display: none; }

@keyframes launcher-pulse {
    0%, 100% { box-shadow: 0 4px 20px var(--primary-glow, rgba(108, 99, 255, 0.4)); }
    50%      { box-shadow: 0 4px 32px var(--primary-glow, rgba(108, 99, 255, 0.7)); }
}

/* --- Chat Window --- */
.chatbot-window {
    position: fixed;
    bottom: 96px;
    right: 28px;
    width: 380px;
    max-height: 540px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
}

.chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* --- Header --- */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.chatbot-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-header-text h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
}

.chatbot-header-text span {
    font-size: 0.72rem;
    opacity: 0.85;
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-clear,
.chatbot-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: background 0.2s;
}

.chatbot-clear:hover,
.chatbot-close:hover { background: rgba(255, 255, 255, 0.25); }

/* --- Messages Container --- */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 280px;
    max-height: 340px;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--primary-glow, rgba(108, 99, 255, 0.3));
    border-radius: 4px;
}

/* --- Message Bubbles --- */
.chatbot-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.82rem;
    line-height: 1.55;
    word-wrap: break-word;
    animation: msg-in 0.3s ease;
}

@keyframes msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chatbot-msg.bot {
    align-self: flex-start;
    background: var(--msg-bot-bg, rgba(255, 255, 255, 0.06));
    color: var(--text, #e0e0e0);
    border-bottom-left-radius: 4px;
}

.chatbot-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chatbot-msg.bot strong { color: var(--primary-light, #8B83FF); }

.chatbot-msg.bot ul {
    margin: 6px 0 2px 0;
    padding-left: 16px;
}

.chatbot-msg.bot ul li { margin-bottom: 3px; }

/* --- Typing Indicator --- */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
    animation: msg-in 0.3s ease;
}

.chatbot-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-light, #8B83FF);
    animation: typing-dot 1.4s ease-in-out infinite;
}

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

@keyframes typing-dot {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30%           { opacity: 1; transform: scale(1); }
}

/* --- Quick Reply Chips --- */
.chatbot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 12px;
    flex-shrink: 0;
}

.chatbot-chip {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--primary, #6C63FF);
    background: transparent;
    color: var(--primary, #6C63FF);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.chatbot-chip:hover {
    background: var(--primary, #6C63FF);
    color: #fff;
}

/* --- Input Area --- */
.chatbot-input-area {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    gap: 8px;
    flex-shrink: 0;
    background: var(--card-bg, #1e1e2e);
}

.chatbot-input {
    flex: 1;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: 22px;
    padding: 8px 14px;
    font-size: 0.82rem;
    outline: none;
    background: var(--input-bg, rgba(255, 255, 255, 0.04));
    color: var(--text, #e0e0e0);
    font-family: inherit;
    transition: border-color 0.2s;
}

.chatbot-input::placeholder {
    color: var(--text-muted, rgba(255, 255, 255, 0.35));
}

.chatbot-input:focus {
    border-color: var(--primary, #6C63FF);
}

.chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover { transform: scale(1.08); }
.chatbot-send:disabled { opacity: 0.5; cursor: default; transform: none; }

/* --- Light Theme Overrides --- */
[data-theme="light"] .chatbot-window {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .chatbot-msg.bot {
    background: #f4f4f8;
    color: #333;
}

[data-theme="light"] .chatbot-msg.bot strong { color: var(--primary-dark, #5A52D5); }

[data-theme="light"] .chatbot-input {
    background: #f7f7fa;
    color: #333;
    border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .chatbot-input::placeholder { color: rgba(0, 0, 0, 0.4); }

[data-theme="light"] .chatbot-input-area {
    background: #fff;
    border-top-color: rgba(0, 0, 0, 0.08);
}

/* --- Mobile Responsive --- */
@media (max-width: 480px) {
    .chatbot-window {
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chatbot-messages {
        max-height: none;
        flex: 1;
    }

    .chatbot-launcher {
        bottom: 18px;
        right: 18px;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}
