/* ============================================
   Contact Assistant Styles
   AI Chat interface for Contact Us page
   ============================================ */

/* Tab Navigation */
.contact-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

.contact-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.contact-tab i {
    font-size: 1.25rem;
}

.contact-tab:hover {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}

.contact-tab.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: tabFadeIn 0.3s ease;
}

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

/* ============================================
   AI Chat Container
   ============================================ */

.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    overflow: hidden;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Custom scrollbar for messages */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   AI Chat Messages
   ============================================ */

.ai-chat-message {
    display: flex;
    gap: 0.75rem;
    animation: messageSlideIn 0.3s ease;
}

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

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

.ai-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-size: 1.1rem;
}

.ai-chat-bubble {
    max-width: 80%;
    padding: 0.875rem 1.125rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.ai-chat-message-assistant .ai-chat-bubble {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ai-chat-message-user .ai-chat-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.ai-chat-content {
    white-space: pre-wrap;
}

/* Allow links in AI responses to be clickable */
.ai-chat-content a {
    color: #6366f1;
    text-decoration: underline;
    word-break: break-all;
}

.ai-chat-message-user .ai-chat-content a {
    color: #fbbf24;
}

/* Loading State */
.ai-chat-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
    gap: 1rem;
}

.ai-chat-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error State */
.ai-chat-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ef4444;
    gap: 0.75rem;
    text-align: center;
}

.ai-chat-error i {
    font-size: 3rem;
}

/* Typing Indicator */
.ai-chat-typing-dots {
    display: flex;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
}

.ai-chat-typing-dots span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.ai-chat-typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ============================================
   AI Chat Input Area
   ============================================ */

.ai-chat-input-area {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: white;
    padding: 0.75rem 1rem;
}

.ai-chat-predefined {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    max-height: 100px;
    overflow-y: auto;
}

.ai-chat-predefined::-webkit-scrollbar {
    height: 4px;
}

.ai-chat-predefined::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.ai-chat-predefined-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ai-chat-predefined-btn:hover {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border-color: #6366f1;
    color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
}

.ai-chat-predefined-btn .question-icon {
    font-size: 1rem;
}

.ai-chat-form {
    display: flex;
    gap: 0.5rem;
}

.ai-chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 24px;
    font-size: 0.95rem;
    color: #1f2937;
    transition: all 0.2s ease;
}

.ai-chat-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ai-chat-input:disabled {
    background: #f9fafb;
    cursor: not-allowed;
}

.ai-chat-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.ai-chat-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.ai-chat-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 576px) {
    .contact-tabs {
        gap: 0.25rem;
    }

    .contact-tab {
        padding: 0.625rem 0.75rem;
        font-size: 0.85rem;
    }

    .contact-tab span {
        display: none;
    }

    .contact-tab i {
        font-size: 1.35rem;
    }

    .ai-chat-container {
        height: 400px;
    }

    .ai-chat-messages {
        padding: 1rem;
    }

    .ai-chat-avatar {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .ai-chat-bubble {
        max-width: 85%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .ai-chat-input-area {
        padding: 0.625rem 0.875rem;
    }

    .ai-chat-predefined {
        max-height: 80px;
    }

    .ai-chat-predefined-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }

    .ai-chat-input {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }

    .ai-chat-send-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ============================================
   RTL Support
   ============================================ */

[dir="rtl"] .contact-tab {
    flex-direction: row-reverse;
}

[dir="rtl"] .ai-chat-message-user {
    flex-direction: row;
}

[dir="rtl"] .ai-chat-message-assistant .ai-chat-bubble {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 4px;
}

[dir="rtl"] .ai-chat-message-user .ai-chat-bubble {
    border-bottom-right-radius: 16px;
    border-bottom-left-radius: 4px;
}

[dir="rtl"] .ai-chat-form {
    flex-direction: row-reverse;
}

/* ============================================
   Dark Mode Support
   ============================================ */

@media (prefers-color-scheme: dark) {
    .ai-chat-container {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }

    .ai-chat-message-assistant .ai-chat-bubble {
        background: #334155;
        color: #e2e8f0;
    }

    .ai-chat-input-area {
        background: #1e293b;
        border-top-color: rgba(255, 255, 255, 0.08);
    }

    .ai-chat-predefined-btn {
        background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
        border-color: #475569;
        color: #cbd5e1;
    }

    .ai-chat-predefined-btn:hover {
        background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
        border-color: #6366f1;
        color: #a5b4fc;
    }

    .ai-chat-input {
        background: #0f172a;
        border-color: #475569;
        color: #e2e8f0;
    }

    .ai-chat-input:focus {
        border-color: #6366f1;
    }

    .ai-chat-input:disabled {
        background: #1e293b;
    }
}

/* ============================================
   Markdown Content Styles
   ============================================ */

.ai-chat-content p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.ai-chat-content p:last-child {
    margin-bottom: 0;
}

.ai-chat-content h1,
.ai-chat-content h2,
.ai-chat-content h3,
.ai-chat-content h4,
.ai-chat-content h5,
.ai-chat-content h6 {
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.ai-chat-content h1 { font-size: 1.5rem; }
.ai-chat-content h2 { font-size: 1.25rem; }
.ai-chat-content h3 { font-size: 1.125rem; }
.ai-chat-content h4 { font-size: 1rem; }
.ai-chat-content h5 { font-size: 0.875rem; }
.ai-chat-content h6 { font-size: 0.75rem; }

.ai-chat-content ul,
.ai-chat-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.ai-chat-content li {
    margin-bottom: 0.25rem;
    line-height: 1.6;
}

.ai-chat-content strong {
    font-weight: 600;
}

.ai-chat-content em,
.ai-chat-content i {
    font-style: italic;
}

.ai-chat-content a {
    color: #6366f1;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.ai-chat-content a:hover {
    border-bottom-color: #6366f1;
}

.ai-chat-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.875em;
    font-family: monospace;
}

/* RTL Support */
[dir="rtl"] .ai-chat-content ul,
[dir="rtl"] .ai-chat-content ol {
    padding-left: 0;
    padding-right: 1.5rem;
}

[dir="rtl"] .ai-chat-content li {
    text-align: right;
}

