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

@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --border: #e2e8f0;
    --user-bubble: #6366f1;
    --user-text: #ffffff;
    --bot-bubble: #f1f5f9;
    --bot-text: #0f172a;
    --sidebar-width: 280px;
    --shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.dark {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --border: #334155;
    --user-bubble: #4f46e5;
    --user-text: #f8fafc;
    --bot-bubble: #1e293b;
    --bot-text: #e2e8f0;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

* {
    font-family: 'Tajawal', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
}

.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark .glass {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(51, 65, 85, 0.3);
}

.user-bubble {
    background: var(--user-bubble);
    color: var(--user-text);
    border-radius: 18px 18px 4px 18px;
}

.bot-bubble {
    background: var(--bot-bubble);
    color: var(--bot-text);
    border-radius: 18px 18px 18px 4px;
}

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

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

.typing-dot {
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

.pulse-glow {
    animation: pulse-glow 2s infinite;
}

.sidebar-item {
    transition: all 0.2s ease;
}

.sidebar-item:hover {
    background: var(--border);
}

.sidebar-item.active {
    background: var(--accent);
    color: white;
}

.message-content pre {
    direction: ltr;
    text-align: left;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-content code {
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.875em;
}

.message-content p {
    margin-bottom: 0.5em;
}

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

.message-content ul, .message-content ol {
    padding-right: 1.5em;
    margin-bottom: 0.5em;
}

.message-content blockquote {
    border-right: 3px solid var(--accent);
    padding-right: 1em;
    margin: 0.5em 0;
    opacity: 0.8;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
}

.message-content th, .message-content td {
    border: 1px solid var(--border);
    padding: 6px 12px;
    text-align: right;
}

.message-content a {
    color: var(--accent);
    text-decoration: underline;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
