@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&display=swap');

/* RTL Support */
* {
    direction: rtl;
    text-align: right;
}

/* Arabic Font */
body {
    font-family: 'Amiri', 'Times New Roman', serif;
    line-height: 1.6;
}

/* Custom scrollbar for chat area */
#chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #CBD5E0 #F7FAFC;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #F7FAFC;
}

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

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #A0AEC0;
}

/* Message animation */
.message-enter {
    opacity: 0;
    transform: translateY(20px);
    animation: messageEnter 0.3s ease-out forwards;
}

@keyframes messageEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading indicator */
.loading-dots {
    display: inline-block;
    position: relative;
    width: 40px;
    height: 10px;
}

.loading-dots div {
    position: absolute;
    top: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: loading-dots 1.2s linear infinite;
}

.loading-dots div:nth-child(1) { left: 4px; animation-delay: -0.24s; }
.loading-dots div:nth-child(2) { left: 16px; animation-delay: -0.12s; }
.loading-dots div:nth-child(3) { left: 28px; animation-delay: 0s; }

@keyframes loading-dots {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Flash message animation */
.flash-message {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .w-80 {
        width: 100%;
        position: absolute;
        z-index: 10;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .w-80.open {
        transform: translateX(0);
    }
    
    .w-64 {
        display: none;
    }
}

/* Input focus states */
input:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Button hover effects */
button {
    transition: all 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Chat message styling */
.message-content {
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-content code {
    background-color: #f3f4f6;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    direction: ltr;
    text-align: left;
    display: inline-block;
}

.message-content pre {
    background-color: #f3f4f6;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
}

/* Image styling */
.generated-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-top: 12px;
}

/* Sidebar styling */
.chat-item {
    transition: background-color 0.2s ease;
}

.chat-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.chat-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3B82F6;
}

/* Advertisement styling */
.ad-placeholder {
    background: linear-gradient(45deg, #f3f4f6 25%, transparent 25%), 
                linear-gradient(-45deg, #f3f4f6 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f3f4f6 75%), 
                linear-gradient(-45deg, transparent 75%, #f3f4f6 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}
