/* AI Law Bot - Arabic RTL Chat Widget Styles */

#ai-law-bot-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99999;
    font-family: 'Tajawal', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    direction: rtl;
}

/* Chat Button */
.ai-law-bot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a5490 0%, #2d7ab8 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(26, 84, 144, 0.4);
    transition: all 0.3s ease;
}

.ai-law-bot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(26, 84, 144, 0.5);
}

.ai-law-bot-button svg {
    width: 28px;
    height: 28px;
    stroke: white;
    fill: none;
}

/* Chat Window */
.ai-law-bot-window {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

#ai-law-bot-widget.ai-law-bot-open .ai-law-bot-window {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

#ai-law-bot-widget.ai-law-bot-open .ai-law-bot-button {
    transform: scale(0.9);
}

/* Header */
.ai-law-bot-header {
    background: linear-gradient(135deg, #1a5490 0%, #2d7ab8 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-law-bot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.ai-law-bot-controls {
    display: flex;
    gap: 8px;
}

.ai-law-bot-controls button {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: white !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s;
    position: relative !important;
    padding: 0 !important;
}

.ai-law-bot-controls button .icon-close,
.ai-law-bot-controls button .icon-minimize {
    font-size: 24px !important;
    line-height: 1 !important;
    font-weight: bold !important;
    color: #ffffff !important;
    display: block !important;
    user-select: none;
    pointer-events: none;
}

.ai-law-bot-controls button .icon-close {
    font-size: 28px !important;
}

.ai-law-bot-controls button .icon-minimize {
    font-size: 32px !important;
    margin-top: -4px;
}

.ai-law-bot-controls button:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

/* Messages Area */
.ai-law-bot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-law-bot-messages::-webkit-scrollbar {
    width: 6px;
}

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

.ai-law-bot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

/* Individual Messages */
.ai-law-bot-message {
    display: flex;
    animation: fadeInUp 0.3s ease;
}

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

.ai-law-bot-message-content {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 15px;
}

.ai-law-bot-message-user {
    justify-content: flex-start;
}

.ai-law-bot-message-user .ai-law-bot-message-content {
    background: #1a5490;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-law-bot-message-bot {
    justify-content: flex-end;
}

.ai-law-bot-message-bot .ai-law-bot-message-content {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ai-law-bot-message-error .ai-law-bot-message-content {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.ai-law-bot-message-content p {
    margin: 0 0 8px 0;
}

.ai-law-bot-message-content p:last-child {
    margin-bottom: 0;
}

/* Articles Section */
.ai-law-bot-articles {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.ai-law-bot-articles-title {
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    margin: 0 0 8px 0;
}

.ai-law-bot-article-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    color: #1a5490;
    font-size: 14px;
    transition: all 0.2s;
}

.ai-law-bot-article-link:hover {
    background: #edf2f7;
    border-color: #1a5490;
    transform: translateX(-2px);
}

.ai-law-bot-article-number {
    background: #1a5490;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.ai-law-bot-article-title {
    flex: 1;
    line-height: 1.4;
}

.ai-law-bot-article-link svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
    opacity: 0.5;
}

.ai-law-bot-remaining {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
    color: #718096;
    font-size: 12px;
}

.ai-law-bot-remaining small {
    font-size: inherit;
}

/* Thinking Animation */
.ai-law-bot-thinking .ai-law-bot-message-content {
    padding: 12px 20px;
}

.ai-law-bot-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.ai-law-bot-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    animation: bounce 1.4s infinite ease-in-out;
}

.ai-law-bot-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-law-bot-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Input Area */
.ai-law-bot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 16px 16px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.ai-law-bot-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    direction: rtl;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    transition: border-color 0.2s;
}

.ai-law-bot-input:focus {
    outline: none;
    border-color: #1a5490;
}

.ai-law-bot-input::placeholder {
    color: #a0aec0;
}

.ai-law-bot-send {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #1a5490;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-law-bot-send:hover:not(:disabled) {
    background: #2d7ab8;
    transform: scale(1.05);
}

.ai-law-bot-send:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

.ai-law-bot-send svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
    transform: scaleX(-1); /* Flip send icon for RTL */
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #ai-law-bot-widget {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
    
    .ai-law-bot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        left: 0;
        right: 0;
        bottom: 70px;
    }
    
    .ai-law-bot-button {
        width: 56px;
        height: 56px;
    }
    
    .ai-law-bot-message-content {
        max-width: 90%;
        font-size: 14px;
    }
}

/* Print Styles */
@media print {
    #ai-law-bot-widget {
        display: none !important;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .ai-law-bot-window {
        background: #1a202c;
    }
    
    .ai-law-bot-messages {
        background: #2d3748;
    }
    
    .ai-law-bot-message-bot .ai-law-bot-message-content {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .ai-law-bot-input-area {
        background: #1a202c;
        border-top-color: #4a5568;
    }
    
    .ai-law-bot-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .ai-law-bot-input::placeholder {
        color: #718096;
    }
    
    .ai-law-bot-article-link {
        background: #2d3748;
        border-color: #4a5568;
        color: #63b3ed;
    }
    
    .ai-law-bot-article-link:hover {
        background: #4a5568;
    }
}
