/* ==========================================================================
   AI Chatbot Widget Styles
   Shamim Ahmed Nahid - Portfolio
   Powered by Google Gemini API
   ========================================================================== */

/* ------ Floating Toggle Button ------ */
#chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-primary, #00ff88);
    color: #000;
    border: none;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5), 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 28px;
    line-height: 1;
}

#chatbot-toggle:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 0 35px rgba(0, 255, 136, 0.7), 0 6px 20px rgba(0,0,0,0.4);
}

#chatbot-toggle.open {
    transform: rotate(45deg);
    background: #ff4757;
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.5);
}

/* Pulse ring animation on the button */
#chatbot-toggle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent-primary, #00ff88);
    animation: chatbot-pulse 2s ease-out infinite;
}

@keyframes chatbot-pulse {
    0%   { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2); opacity: 0; }
}

/* ------ Chatbot Window ------ */
#chatbot-window {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 380px;
    max-height: 580px;
    background: rgba(17, 17, 24, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.6), 0 0 40px rgba(0, 255, 136, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;

    /* Hidden state */
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ------ Header ------ */
#chatbot-header {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15), rgba(108, 92, 231, 0.15));
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.chatbot-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00ff88, #6c5ce7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    position: relative;
}

/* Online status dot */
.chatbot-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #00ff88;
    border-radius: 50%;
    border: 2px solid rgba(17, 17, 24, 0.95);
    animation: status-blink 2s ease-in-out infinite;
}

@keyframes status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.chatbot-header-info h4 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #f0f0f0;
    margin-bottom: 0.1rem;
}

.chatbot-header-info span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ------ Messages Area ------ */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

/* Scrollbar styling */
#chatbot-messages::-webkit-scrollbar {
    width: 4px;
}
#chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 10px;
}

/* ------ Individual Message Bubbles ------ */
.chatbot-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: msg-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes msg-pop {
    from { opacity: 0; transform: translateY(10px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chatbot-msg.bot { align-self: flex-start; }
.chatbot-msg.user { align-self: flex-end; }

.msg-bubble {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
    font-family: 'Figtree', sans-serif;
}

.chatbot-msg.bot .msg-bubble {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chatbot-msg.user .msg-bubble {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(108, 92, 231, 0.2));
    border: 1px solid rgba(0, 255, 136, 0.25);
    color: #f0f0f0;
    border-bottom-right-radius: 4px;
}

.msg-time {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.3);
    margin-top: 0.3rem;
    font-family: 'JetBrains Mono', monospace;
    padding: 0 0.25rem;
}

.chatbot-msg.user .msg-time {
    text-align: right;
}

/* ------ Typing indicator ------ */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00ff88;
    animation: typing-bounce 1.2s infinite;
}

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

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* ------ Input Area ------ */
#chatbot-input-area {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#chatbot-input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #f0f0f0;
    font-family: 'Figtree', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    resize: none;
    height: 44px;
    max-height: 120px;
    overflow-y: hidden;
}

#chatbot-input:focus {
    border-color: rgba(0, 255, 136, 0.5);
    background: rgba(0, 255, 136, 0.05);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.1);
}

#chatbot-input::placeholder {
    color: rgba(255,255,255,0.3);
}

#chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--accent-primary, #00ff88);
    color: #000;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: all 0.2s;
}

#chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

#chatbot-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ------ API Key Prompt Overlay ------ */
#chatbot-api-prompt {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 24, 0.97);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    z-index: 10;
}

#chatbot-api-prompt h4 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #f0f0f0;
}

#chatbot-api-prompt p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 1.5rem;
    line-height: 1.5;
    font-family: 'Figtree', sans-serif;
}

#chatbot-api-key-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(0, 255, 136, 0.4);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #f0f0f0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    outline: none;
    text-align: center;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

#chatbot-api-key-input:focus {
    border-color: #00ff88;
}

#chatbot-api-save {
    width: 100%;
    padding: 0.75rem;
    background: var(--accent-primary, #00ff88);
    color: #000;
    border: none;
    border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
#chatbot-api-save:hover {
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    transform: translateY(-2px);
}

#chatbot-api-note {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.25);
    margin-top: 1rem;
    font-family: 'JetBrains Mono', monospace;
}

/* ------ Mobile Responsive ------ */
@media (max-width: 480px) {
    #chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 90px;
        max-height: 70vh;
    }

    #chatbot-toggle {
        right: 20px;
        bottom: 20px;
    }
}
