/* -------------------------------------------------------------
   CHATBOT STYLES
   ------------------------------------------------------------- */
:root {
    --chat-bg: #ffffff;
    --chat-header-bg: #000000;
    --chat-text: #333333;
    --chat-accent: #000000;
    --chat-user-msg: #000000;
    --chat-bot-msg: #f0f0f0;
}

body.dark-mode {
    --chat-bg: #1e1e1e;
    --chat-header-bg: #000000;
    --chat-text: #e0e0e0;
    --chat-accent: #ffffff;
    --chat-user-msg: #444444;
    --chat-bot-msg: #2d2d2d;
}

/* Floating Button */
.chat-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 35px;
    /* Moved slightly right for balance */
    /* Moved left to avoid scrollbar overlap */
    width: 50px;
    height: 50px;
    background-color: var(--chat-header-bg);
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 9990;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
}

.chat-toggle-btn svg {
    width: 24px;
    height: 24px;
    fill: #fff;
    /* Default White */
    transition: all 0.3s;
}

/* Invert logic for specific dark backgrounds if needed OR ensure contrast */
@media (prefers-color-scheme: dark) {
    .chat-toggle-btn {
        border-color: rgba(255, 255, 255, 0.2);
    }
}

/* Force White Icon in Dark Mode Classes (Common in Hire/Resume pages) */
.dark-mode .chat-toggle-btn svg,
body[style*="background-color: rgb(0, 0, 0)"] .chat-toggle-btn svg,
.terminal-dark .chat-toggle-btn svg {
    fill: #ffffff !important;
}

.chat-toggle-btn.open .chat-icon {
    display: none;
}

.chat-toggle-btn .close-icon {
    display: none;
    font-size: 24px;
    color: #fff;
    font-family: Arial, sans-serif;
    line-height: 1;
}

.chat-toggle-btn.open .close-icon {
    display: block;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background-color: var(--chat-bg);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9991;
    border: 1px solid rgba(128, 128, 128, 0.1);

    /* Animation */
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chat-header {
    background-color: var(--chat-header-bg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #fff;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #000;
    font-size: 1.2rem;
}

.chat-info h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chat-info p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot-pulse {
    width: 8px;
    height: 8px;
    background-color: #00ff00;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(0, 255, 0, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0);
    }
}

/* Body */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Messages */
.message {
    max-width: 80%;
    padding: 12px 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.message.bot {
    align-self: flex-start;
    background-color: var(--chat-bot-msg);
    color: var(--chat-text);
    border-radius: 15px 15px 15px 0;
}

.message.user {
    align-self: flex-end;
    background-color: var(--chat-user-msg);
    color: #fff;
    border-radius: 15px 15px 0 15px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: var(--chat-bot-msg);
    border-radius: 15px;
    width: fit-content;
    align-self: flex-start;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Quick Actions (Chips) */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.chat-chip {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(128, 128, 128, 0.3);
    color: var(--chat-text);
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-chip:hover {
    background: var(--chat-header-bg);
    color: #fff;
    border-color: var(--chat-header-bg);
}

/* Input Area */
.chat-footer {
    padding: 15px;
    border-top: 1px solid rgba(128, 128, 128, 0.1);
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--chat-bg);
}

.chat-input {
    flex: 1;
    border: none;
    background: var(--chat-bot-msg);
    padding: 12px 15px;
    border-radius: 25px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--chat-text);
    outline: none;
}

.send-btn {
    background: var(--chat-header-bg);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 480px) {
    .chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .chat-toggle-btn {
        bottom: 20px;
        right: 20px;
    }

    .chat-window.active {
        z-index: 10000;
    }

    .close-modal-mobile {
        display: block !important;
    }
}