/* TheVortex Live Chat Widget Styles */
:root {
    --chat-primary: #7c3aed;
    --chat-primary-dark: #6d28d9;
    --chat-secondary: #a855f7;
    --chat-bg: #1a1a2e;
    --chat-bg-dark: #0f0f1a;
    --chat-text: #e0e0e0;
    --chat-text-muted: #a0a0a0;
    --chat-white: #ffffff;
    --chat-border: rgba(255, 255, 255, 0.1);
}

/* Chat Toggle Button */
.chat-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toggle-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.6);
}

.chat-toggle-btn i {
    color: var(--chat-white);
    font-size: 24px;
    transition: transform 0.3s ease;
}

/* Chat Container */
.chat-container {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--chat-border);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.chat-container.active {
    display: flex;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-header-avatar i {
    color: var(--chat-white);
    font-size: 22px;
}

.chat-header-text {
    display: flex;
    flex-direction: column;
}

.chat-header-text h4 {
    color: var(--chat-white);
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.chat-header-text span {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-header-text span::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background-color: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 8px #4ade80;
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.chat-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.chat-action-btn i {
    color: var(--chat-white);
    font-size: 14px;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--chat-bg-dark);
    scroll-behavior: smooth;
}

.chat-message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    animation: messageIn 0.3s ease-out forwards;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    color: var(--chat-white);
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
}

.chat-message.assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    color: var(--chat-text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--chat-border);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 16px 20px;
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--chat-border);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--chat-primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Chat Input */
.chat-input-container {
    padding: 16px;
    background: var(--chat-bg);
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 14px 18px;
    border-radius: 24px;
    border: 1px solid var(--chat-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--chat-text);
    font-size: 14px;
    resize: none;
    max-height: 120px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--chat-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

.chat-input::placeholder {
    color: var(--chat-text-muted);
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #333;
    box-shadow: none;
}

.chat-send-btn i {
    color: var(--chat-white);
    font-size: 18px;
    margin-left: -2px; /* Visual correction */
}

/* Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 20px 10px;
    color: var(--chat-text);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-welcome h5 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: var(--chat-white);
    font-weight: 600;
}

.chat-welcome p {
    margin: 0 0 24px 0;
    font-size: 14px;
    color: var(--chat-text-muted);
    line-height: 1.6;
}

.chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-suggestion-btn {
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    background: rgba(124, 58, 237, 0.05);
    color: var(--chat-text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-suggestion-btn:hover {
    background: rgba(124, 58, 237, 0.15);
    border-color: var(--chat-primary);
    transform: translateX(4px);
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-container {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chat-toggle-btn {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .chat-header {
        padding: 16px;
    }
    
    .chat-messages {
        padding: 16px;
    }
}

/* Markdown Content Styles */
.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul, .message-content ol {
    margin: 0 0 8px 20px;
    padding: 0;
    list-style-type: disc;
}

.message-content ol {
    list-style-type: decimal;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content strong {
    font-weight: 600;
    color: var(--chat-white);
}

.message-content a {
    color: #4ade80;
    text-decoration: underline;
}

.message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-content pre code {
    background: transparent;
    padding: 0;
    color: #e0e0e0;
}

.message-content h1, .message-content h2, .message-content h3, .message-content h4 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    color: var(--chat-white);
}

.message-content h1 { font-size: 1.4em; }
.message-content h2 { font-size: 1.2em; }
.message-content h3 { font-size: 1.1em; }

