/**
 * GSOC Chat Widget
 * Dark-styled minimal chat panel matching GSOC aesthetic
 */

#gsoc-chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0090c4 0%, #1a73e8 100%);
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0,144,196,0.4);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#gsoc-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,144,196,0.6);
}

#gsoc-chat-bubble svg {
    color: #fff;
}

#gsoc-chat-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: #020b16;
    border: 1px solid rgba(59,130,246,0.5);
    border-radius: 16px;
    display: none;
    flex-direction: column;
    z-index: 9999;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

#gsoc-chat-panel.open {
    display: flex;
}

.gsoc-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(59,130,246,0.3);
    background: rgba(59,130,246,0.05);
    border-radius: 16px 16px 0 0;
}

.gsoc-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e6edf7;
    font-weight: 600;
    font-size: 16px;
}

.gsoc-chat-logo {
    font-size: 20px;
}

.gsoc-chat-close {
    background: none;
    border: none;
    color: #e6edf7;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.gsoc-chat-close:hover {
    background: rgba(59,130,246,0.1);
}

.gsoc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gsoc-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.gsoc-chat-messages::-webkit-scrollbar-track {
    background: rgba(59,130,246,0.05);
    border-radius: 4px;
}

.gsoc-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(59,130,246,0.3);
    border-radius: 4px;
}

.gsoc-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(59,130,246,0.5);
}

.gsoc-chat-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gsoc-chat-message.user {
    flex-direction: row-reverse;
}

.gsoc-chat-message .avatar {
    width: 32px;
    height: 32px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.gsoc-chat-message.assistant .avatar {
    background: rgba(59,130,246,0.15);
}

.gsoc-chat-message.user .avatar {
    background: rgba(0,144,196,0.2);
}

.gsoc-chat-message .bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    color: #e6edf7;
    font-size: 14px;
    line-height: 1.4;
}

.gsoc-chat-message.assistant .bubble {
    background: rgba(59,130,246,0.15);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 12px 12px 12px 4px;
}

.gsoc-chat-message.user .bubble {
    background: rgba(0,144,196,0.2);
    border: 1px solid rgba(0,144,196,0.4);
    border-radius: 12px 12px 4px 12px;
    text-align: right;
}

.gsoc-chat-typing {
    padding: 0 16px 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gsoc-chat-typing.active {
    opacity: 1;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 14px;
    background: rgba(59,130,246,0.15);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 12px;
    width: fit-content;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: rgba(59,130,246,0.7);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

.gsoc-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid rgba(59,130,246,0.3);
    background: rgba(59,130,246,0.02);
}

.gsoc-chat-input {
    flex: 1;
    background: rgba(59,130,246,0.05);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 12px;
    padding: 10px 14px;
    color: #e6edf7;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.gsoc-chat-input::placeholder {
    color: rgba(230,237,247,0.4);
}

.gsoc-chat-input:focus {
    border-color: rgba(59,130,246,0.6);
    background: rgba(59,130,246,0.08);
}

.gsoc-chat-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #0090c4 0%, #1a73e8 100%);
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.gsoc-chat-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,144,196,0.4);
}

.gsoc-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gsoc-chat-send svg {
    color: #fff;
}

@media (max-width: 480px) {
    #gsoc-chat-panel {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 10px;
        right: 20px;
    }
    
    #gsoc-chat-bubble {
        bottom: 10px;
        right: 20px;
    }
}
