/* Mentogy AI Chatbot Frontend Styles */

#mentogy-chatbot {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

#mentogy-chatbot.position-right {
    right: 20px;
}

#mentogy-chatbot.position-left {
    left: 20px;
}

/* Toggle Button */
#mentogy-toggle {
    width: var(--mentogy-button-size, 60px);
    height: var(--mentogy-button-size, 60px);
    border-radius: 50%;
    background: var(--mentogy-primary, #6366f1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    color: #fff;
}

#mentogy-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
}

#mentogy-toggle svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

#mentogy-toggle .icon-close {
    display: none;
}

#mentogy-toggle.open .icon-chat {
    display: none;
}

#mentogy-toggle.open .icon-close {
    display: block;
}

/* Chat Window */
#mentogy-window {
    position: absolute;
    bottom: calc(var(--mentogy-button-size, 60px) + 15px);
    width: var(--mentogy-width, 380px);
    height: var(--mentogy-height, 520px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: mentogySlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#mentogy-window.active {
    display: flex;
}

.position-right #mentogy-window {
    right: 0;
}

.position-left #mentogy-window {
    left: 0;
}

@keyframes mentogySlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.mentogy-header {
    background: var(--mentogy-primary, #6366f1);
    color: #fff;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mentogy-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mentogy-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mentogy-avatar svg {
    width: 26px;
    height: 26px;
}

.mentogy-header-text {
    display: flex;
    flex-direction: column;
}

.mentogy-name {
    font-weight: 600;
    font-size: 16px;
}

.mentogy-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mentogy-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.mentogy-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s ease;
}

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

.mentogy-close svg {
    width: 20px;
    height: 20px;
}

/* Messages */
.mentogy-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #fafafa;
}

.mentogy-message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    animation: messageSlide 0.3s ease;
    word-wrap: break-word;
}

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

.mentogy-message.bot {
    background: #fff;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.mentogy-message.user {
    background: var(--mentogy-primary, #6366f1);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

.mentogy-message.typing {
    display: flex;
    gap: 5px;
    padding: 18px 22px;
}

.mentogy-message.typing span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

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

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

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

/* Message Links */
.mentogy-message a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.mentogy-message.bot a {
    color: var(--mentogy-primary, #6366f1);
}

/* Quick Buttons */
.mentogy-quick-buttons {
    padding: 12px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #fff;
    border-top: 1px solid #f3f4f6;
}

.mentogy-quick-btn {
    background: #fff;
    border: 1px solid var(--mentogy-primary, #6366f1);
    color: var(--mentogy-primary, #6366f1);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.mentogy-quick-btn:hover {
    background: var(--mentogy-primary, #6366f1);
    color: #fff;
}

/* Input Area */
.mentogy-input-area {
    display: flex;
    padding: 15px;
    gap: 12px;
    background: #fff;
    border-top: 1px solid #f3f4f6;
}

#mentogy-input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid #e5e7eb;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    background: #f9fafb;
}

#mentogy-input:focus {
    border-color: var(--mentogy-primary, #6366f1);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#mentogy-send {
    width: 48px;
    height: 48px;
    background: var(--mentogy-primary, #6366f1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#mentogy-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

#mentogy-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#mentogy-send svg {
    width: 20px;
    height: 20px;
}

/* Footer */
.mentogy-footer {
    padding: 10px;
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    background: #fafafa;
    border-top: 1px solid #f3f4f6;
}

.mentogy-footer strong {
    color: #6366f1;
}

/* Scrollbar */
.mentogy-messages::-webkit-scrollbar {
    width: 6px;
}

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

.mentogy-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.mentogy-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Mobile Responsive */
@media screen and (max-width: 480px) {
    #mentogy-chatbot {
        bottom: 15px;
    }
    
    #mentogy-chatbot.position-right {
        right: 15px;
    }
    
    #mentogy-chatbot.position-left {
        left: 15px;
    }
    
    #mentogy-window {
        position: fixed;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh;
        border-radius: 0;
    }
    
    #mentogy-toggle {
        position: fixed;
        bottom: 15px;
        right: 15px;
    }
    
    .mentogy-quick-buttons {
        padding: 10px;
    }
    
    .mentogy-quick-btn {
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    #mentogy-window {
        animation: none;
    }
    
    .mentogy-message {
        animation: none;
    }
    
    .mentogy-status::before {
        animation: none;
    }
}
