/* Mongez Law Assistant Chat Widget Styles */

.mongez-chat-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    direction: rtl;
}

/* Widget Positioning */
.mongez-chat-widget.bottom-right {
    bottom: 20px;
    right: 20px;
}

.mongez-chat-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

.mongez-chat-widget.top-right {
    top: 20px;
    right: 20px;
}

.mongez-chat-widget.top-left {
    top: 20px;
    left: 20px;
}

/* Chat Toggle Button */
.mongez-chat-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
    position: relative;
    color: white;
}

.mongez-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.4);
}

.mongez-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Chat Window */
.mongez-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.mongez-chat-window.active {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

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

/* Chat Header */
.mongez-chat-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.mongez-chat-title h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.mongez-chat-status {
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mongez-chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

.mongez-chat-actions {
    display: flex;
    gap: 8px;
}

.mongez-chat-action-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.mongez-chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages */
.mongez-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mongez-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.mongez-chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

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

.mongez-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
}

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

.mongez-message-assistant {
    align-self: flex-start;
}

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

.mongez-message-user .mongez-message-avatar {
    background: #3b82f6;
    color: white;
}

.mongez-message-assistant .mongez-message-avatar {
    background: #e5e7eb;
    color: #6b7280;
}

.mongez-message-content {
    flex: 1;
}

.mongez-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.mongez-message-user .mongez-message-bubble {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.mongez-message-assistant .mongez-message-bubble {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.mongez-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    text-align: right;
}

.mongez-message-user .mongez-message-time {
    text-align: left;
}

/* Typing Indicator */
.mongez-typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

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

.mongez-typing-dots span:nth-child(1) { animation-delay: 0s; }
.mongez-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.mongez-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* Chat Input */
.mongez-chat-input-container {
    border-top: 1px solid #e5e7eb;
    background: white;
}

.mongez-chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    padding: 16px;
    gap: 8px;
}

.mongez-chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    direction: rtl;
    max-height: 100px;
}

.mongez-chat-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.mongez-chat-input::placeholder {
    color: #9ca3af;
}

.mongez-chat-send-btn {
    width: 40px;
    height: 40px;
    background: #3b82f6;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mongez-chat-send-btn:hover:not(:disabled) {
    background: #2563eb;
    transform: scale(1.05);
}

.mongez-chat-send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

.mongez-chat-footer {
    padding: 8px 16px;
    text-align: center;
    border-top: 1px solid #f3f4f6;
    background: #f9fafb;
}

.mongez-chat-footer small {
    color: #6b7280;
    font-size: 11px;
}

.mongez-chat-footer a {
    color: #3b82f6;
    text-decoration: none;
}

.mongez-chat-footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 480px) {
    .mongez-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
    
    .mongez-chat-widget.bottom-left .mongez-chat-window,
    .mongez-chat-widget.top-left .mongez-chat-window,
    .mongez-chat-widget.top-right .mongez-chat-window {
        right: 20px;
        left: 20px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .mongez-chat-window {
        background: #1f2937;
        border-color: #374151;
    }
    
    .mongez-chat-messages {
        background: #111827;
    }
    
    .mongez-message-assistant .mongez-message-bubble {
        background: #374151;
        color: #f3f4f6;
        border-color: #4b5563;
    }
    
    .mongez-chat-input-container,
    .mongez-chat-footer {
        background: #1f2937;
        border-color: #374151;
    }
    
    .mongez-chat-input {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }
    
    .mongez-chat-footer {
        background: #111827;
    }
}

/* Animation for new messages */
.mongez-message.new-message {
    animation: messageSlideIn 0.3s ease-out;
}

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

/* Loading state */
.mongez-chat-loading {
    pointer-events: none;
    opacity: 0.7;
}

.mongez-chat-send-btn.loading {
    animation: spin 1s linear infinite;
}

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