/**
 * GLNI AI Chatbot - Styles
 * Version: 2.0.0
 */

/* Floating Button */
.glni-chat-floating-btn {
    position: fixed;
    z-index: 9998;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glni-chat-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Button Positions */
.glni-chat-btn-bottom-right {
    bottom: 20px;
    right: 20px;
}

.glni-chat-btn-bottom-left {
    bottom: 20px;
    left: 20px;
}

.glni-chat-btn-top-right {
    top: 20px;
    right: 20px;
}

.glni-chat-btn-top-left {
    top: 20px;
    left: 20px;
}

/* Chat Window */
.glni-chat-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.glni-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.glni-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.glni-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    padding: 0;
}

.glni-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Container */
.glni-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f9fc;
    scroll-behavior: smooth;
}

/* Individual Message */
.glni-chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glni-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e7ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.glni-chat-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Bot Message */
.glni-chat-bot .glni-chat-bubble {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* User Message */
.glni-chat-user {
    flex-direction: row-reverse;
}

.glni-chat-user .glni-chat-avatar {
    background: #667eea;
    color: white;
}

.glni-chat-user .glni-chat-bubble {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Sources */
.glni-chat-sources {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 13px;
}

.glni-chat-sources strong {
    display: block;
    margin-bottom: 6px;
    color: #4a5568;
}

.glni-chat-sources ul {
    margin: 0;
    padding-left: 20px;
}

.glni-chat-sources li {
    margin-bottom: 4px;
}

.glni-chat-sources a {
    color: #667eea;
    text-decoration: none;
}

.glni-chat-sources a:hover {
    text-decoration: underline;
}

/* Input Wrapper */
.glni-chat-input-wrapper {
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#glni-chat-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    min-height: 40px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#glni-chat-input:focus {
    outline: none;
    border-color: #667eea;
}

#glni-chat-send {
    background: #667eea;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

#glni-chat-send:hover {
    background: #5568d3;
}

#glni-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Typing Indicator */
.glni-chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 20px;
    background: white;
    border-radius: 16px;
    width: fit-content;
    margin: 0 20px 16px 52px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.glni-chat-typing span {
    width: 8px;
    height: 8px;
    background: #cbd5e0;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.glni-chat-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.glni-chat-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Shortcode Button */
.glni-chatbot-shortcode-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.glni-chatbot-shortcode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

    .glni-chat-header {
        border-radius: 0;
    }

    .glni-chat-floating-btn {
        width: 56px;
        height: 56px;
        bottom: 16px;
        right: 16px;
    }
}

/* Scrollbar Styling */
.glni-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.glni-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.glni-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.glni-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}