/**
 * Chat Widget Styles
 * Dark theme matching cabinet.php
 */

/* CSS Variables - Match cabinet.php theme */
:root {
    --chat-bg-primary: #0d0d12;
    --chat-bg-secondary: #13131a;
    --chat-bg-card: #1a1a24;
    --chat-bg-input: #0f0f16;
    --chat-border-color: #2a2a3a;
    --chat-text-primary: #ffffff;
    --chat-text-secondary: #9898a6;
    --chat-text-muted: #5c5c6e;
    --chat-accent-primary: #7c3aed;
    --chat-accent-secondary: #a78bfa;
    --chat-accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --chat-success: #10b981;
    --chat-warning: #f59e0b;
    --chat-danger: #ef4444;
    --chat-user-bubble: #7c3aed;
    --chat-bot-bubble: #1e1e2e;
    --chat-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --chat-border-radius: 16px;
}

/* Chat Widget Button */
.chat-expert-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--chat-accent-gradient);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
}

.chat-expert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(124, 58, 237, 0.5);
}

.chat-expert-btn:active {
    transform: translateY(0);
}

.chat-expert-btn svg {
    width: 20px;
    height: 20px;
}

.chat-expert-btn .pulse-dot {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Chat Widget Container */
.chat-widget-container {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: var(--chat-bg-card);
    border: 1px solid var(--chat-border-color);
    border-radius: var(--chat-border-radius);
    box-shadow: var(--chat-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
    animation: slideUp 0.3s ease;
}

.chat-widget-container.open {
    display: flex;
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #1a1a24 0%, #0d0d12 100%);
    padding: 18px 20px;
    border-bottom: 1px solid var(--chat-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chat-avatar {
    width: 42px;
    height: 42px;
    background: var(--chat-accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.chat-header-text h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--chat-text-primary);
}

.chat-header-text p {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: var(--chat-text-secondary);
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: var(--chat-text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.chat-close-btn:hover {
    background: var(--chat-bg-secondary);
    color: var(--chat-text-primary);
}

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

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--chat-bg-secondary);
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.bot {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--chat-accent-primary);
}

.message.bot .message-avatar {
    background: var(--chat-bg-card);
    border: 1px solid var(--chat-border-color);
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--chat-user-bubble);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.bot .message-content {
    background: var(--chat-bot-bubble);
    color: var(--chat-text-primary);
    border: 1px solid var(--chat-border-color);
    border-bottom-left-radius: 4px;
}

.message-content a {
    color: var(--chat-accent-secondary);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--chat-bot-bubble);
    border: 1px solid var(--chat-border-color);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--chat-text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.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); }
}

/* Chat Input Area */
.chat-input-area {
    padding: 16px 20px;
    background: var(--chat-bg-card);
    border-top: 1px solid var(--chat-border-color);
}

.chat-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: var(--chat-bg-input);
    border: 1px solid var(--chat-border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--chat-text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 48px;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--chat-accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.chat-input::placeholder {
    color: var(--chat-text-muted);
}

.chat-send-btn {
    background: var(--chat-accent-gradient);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

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

.chat-send-btn svg {
    width: 20px;
    height: 20px;
}

/* Chat Actions */
.chat-actions {
    display: flex;
    justify-content: center;
    padding: 8px 0 0;
}

.chat-clear-btn {
    background: transparent;
    border: none;
    color: var(--chat-text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.chat-clear-btn:hover {
    color: var(--chat-danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--chat-text-secondary);
}

.welcome-message h4 {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: var(--chat-text-primary);
}

.welcome-message p {
    margin: 0 0 20px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.suggested-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.suggested-topic {
    background: var(--chat-bg-card);
    border: 1px solid var(--chat-border-color);
    color: var(--chat-accent-secondary);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggested-topic:hover {
    background: var(--chat-accent-primary);
    color: white;
    border-color: var(--chat-accent-primary);
}

/* Error Message */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--chat-danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 16px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--chat-border-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chat-text-muted);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-expert-btn {
        bottom: 16px;
        right: 16px;
        padding: 12px 20px;
        font-size: 0.85rem;
    }
    
    .chat-widget-container {
        bottom: 80px;
        right: 16px;
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
    }
    
    .chat-header {
        padding: 14px 16px;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .chat-input-area {
        padding: 12px 16px;
    }
}

/* Full Page Chat Styles (for chat.php) */
.chat-full-container {
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.chat-full-header {
    background: linear-gradient(135deg, #1a1a24 0%, #0d0d12 100%);
    padding: 24px;
    border-bottom: 1px solid var(--chat-border-color);
    text-align: center;
}

.chat-full-header h1 {
    margin: 0;
    font-size: 1.5rem;
    background: var(--chat-accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chat-full-header p {
    margin: 8px 0 0;
    color: var(--chat-text-secondary);
    font-size: 0.9rem;
}

.chat-full-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--chat-bg-secondary);
}

.chat-full-input-area {
    padding: 20px 24px;
    background: var(--chat-bg-card);
    border-top: 1px solid var(--chat-border-color);
}

.chat-full-input-container {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.chat-full-input {
    flex: 1;
    background: var(--chat-bg-input);
    border: 1px solid var(--chat-border-color);
    border-radius: 12px;
    padding: 14px 18px;
    color: var(--chat-text-primary);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    min-height: 52px;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.chat-full-input:focus {
    outline: none;
    border-color: var(--chat-accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.chat-full-send-btn {
    background: var(--chat-accent-gradient);
    border: none;
    color: white;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-full-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

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

.chat-full-send-btn svg {
    width: 22px;
    height: 22px;
}
