/* 1. المتغيرات الأساسية (Global Variables) */
:root {
    --primary: #2563EB;
    --primary-dark: #1E40AF;
    --secondary: #FFFFFF;
    --bg-light: #F3F4F6;
    --text-dark: #1F2937;
    --text-muted: #6B7280;
    --accent: #3B82F6;
    --white: #FFFFFF;
    --shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* 2. الإعدادات العامة (General Setup) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', 'Poppins', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    direction: rtl; /* اتجاه عربي افتراضي */
    overflow-x: hidden;
}

/* 3. الهيدر والبطل (Hero Section) */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 100px 20px;
    text-align: center;
}

.hero h1 { font-size: 3rem; margin-bottom: 20px; }
.hero p { font-size: 1.2rem; max-width: 800px; margin: 0 auto 30px auto; }

/* 4. الأزرار (Buttons) */
.btn-primary {
    background: var(--white);
    color: var(--primary);
    padding: 12px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    transition: 0.3s;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    border: none;
    cursor: pointer;
}

/* 5. الشبكة والخدمات (Grid & Cards) */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 50px 10%;
}

.card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: 0.3s;
}

.card:hover { transform: translateY(-5px); }

/* 6. الصفحات الخاصة (Auth & Chat Windows) */
.auth-card, .chat-window, .complete-profile-card {
    max-width: 500px;
    margin: 50px auto;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.chat-window {
    max-width: 800px;
    height: 70vh;
    display: flex;
    flex-direction: column;
}

#messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 7. النماذج والمدخلات (Forms & Inputs) */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
    text-align: right;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
    font-size: 1rem;
}

input:focus { border-color: var(--primary); }

/* 8. القائمة العلوية (Navbar) */
.navbar {
    background: white;
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.nav-links { display: flex; gap: 20px; list-style: none; }
.nav-links a { text-decoration: none; color: var(--text-dark); font-weight: bold; }

/* 9. لوحة التحكم (Dashboard UI) */
.dashboard-wrapper { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: white; border-left: 1px solid #eee; padding: 20px; }
.main-content { flex: 1; padding: 40px; }

/* 10. الهواتف (Responsive) */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .grid { padding: 20px 5%; }
    .dashboard-wrapper { flex-direction: column; }
    .sidebar { width: 100%; border-left: none; border-bottom: 1px solid #eee; }
    .auth-card, .chat-window { margin: 20px; }
}
/* Dashboard Wrapper */
.dashboard-wrapper { display: flex; min-height: 90vh; }
.sidebar { width: 250px; background: white; border-left: 1px solid #ddd; padding: 20px; }
.main-content { flex: 1; padding: 30px; }

/* Sidebar Profile */
.user-profile { text-align: center; padding-bottom: 20px; border-bottom: 1px solid #eee; margin-bottom: 20px; }
.avatar-circle { width: 60px; height: 60px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; font-size: 24px; }
.sidebar-menu a { display: block; padding: 12px; color: var(--text-dark); text-decoration: none; border-radius: 8px; margin-bottom: 5px; }
.sidebar-menu a.active, .sidebar-menu a:hover { background: var(--primary); color: white; }

/* Stats Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 20px; }
.stat-card { background: white; padding: 20px; border-radius: 12px; display: flex; align-items: center; gap: 15px; box-shadow: var(--shadow); }
.icon-box { width: 50px; height: 50px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: white; }
.blue { background: #3B82F6; }
.green { background: #10B981; }
.orange { background: #F59E0B; }

.result-display { margin-top: 15px; padding: 10px; background: #f0f7ff; border-radius: 5px; border-right: 4px solid var(--primary); }
/* تصميم صفحة الخدمات */
.services-header { text-align: center; padding: 40px 20px; background: white; border-radius: 15px; margin-bottom: 30px; }
.search-box { position: relative; max-width: 600px; margin: 20px auto; }
.search-box i { position: absolute; right: 15px; top: 15px; color: var(--text-muted); }
.search-box input { padding-right: 45px; height: 50px; border-radius: 25px; }

.service-group { margin-bottom: 40px; }
.service-group h2 { margin-bottom: 20px; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.services-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

.service-item { cursor: pointer; text-align: right; border: 1px solid transparent; }
.service-item:hover { border-color: var(--primary); }
.view-more { color: var(--primary); font-size: 0.9rem; font-weight: bold; }

/* Modal (النافذة المنبثقة) */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); }
.modal-content { background: white; margin: 10% auto; padding: 30px; width: 90%; max-width: 600px; position: relative; border-radius: 20px; }
.close { position: absolute; left: 20px; top: 15px; font-size: 28px; cursor: pointer; }
/* تصميم المدونة */
.blog-header { text-align: center; padding: 60px 20px; }
.blog-header h1 { font-size: 2.5rem; color: var(--primary); }

.blog-categories { display: flex; justify-content: center; gap: 10px; margin-bottom: 40px; flex-wrap: wrap; }
.cat-btn { 
    padding: 8px 20px; 
    border-radius: 20px; 
    border: 1px solid var(--primary); 
    background: transparent; 
    color: var(--primary); 
    cursor: pointer; 
    transition: 0.3s;
}
.cat-btn.active, .cat-btn:hover { background: var(--primary); color: white; }

.blog-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); 
    gap: 30px; 
    padding-bottom: 50px;
}

.blog-card { 
    background: white; 
    border-radius: 15px; 
    overflow: hidden; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); 
    transition: 0.3s;
}
.blog-card:hover { transform: translateY(-10px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); }

.blog-img img { width: 100%; height: 200px; object-fit: cover; }

.blog-info { padding: 20px; }
.blog-tag { 
    background: #EBF5FF; 
    color: var(--primary); 
    padding: 4px 12px; 
    border-radius: 5px; 
    font-size: 0.8rem; 
    font-weight: bold; 
}
.blog-info h3 { margin: 15px 0 10px; font-size: 1.3rem; }
.blog-info p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 20px; }

.blog-footer { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-top: 1px solid #F3F4F6; 
    padding-top: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.read-more { color: var(--primary); text-decoration: none; font-weight: bold; }
/* تنسيق الروابط التفاعلية */
.active-link {
    color: var(--primary);
    text-decoration: underline;
    font-weight: bold;
}

.active-link:hover {
    color: var(--accent);
}

/* تحسين شكل الفقاعات */
.message-content p { margin-bottom: 10px; }
.message-content ul { padding-right: 20px; margin-bottom: 10px; }
.message-content strong { color: var(--primary); }

/* تنسيق المرفقات (إذا أردت إضافة خاصية تحميل الملفات مستقبلاً) */
.attachment-btn {
    background: #f0f0f0;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}

:root {
    --primary: #2563eb;
    --bg-light: #f8fafc;
    --text-dark: #1e293b;
    --user-bubble: #dbeafe;
    --ai-bubble: #ffffff;
}

.chat-container {
    max-width: 900px;
    margin: 20px auto;
    background: var(--bg-light);
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 85vh;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* فقاعات الدردشة */
.message-row { display: flex; width: 100%; margin-bottom: 10px; }
.message-row.user { justify-content: flex-start; }
.message-row.ai { justify-content: flex-end; }

.bubble {
    max-width: 75%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.user .bubble { background: var(--user-bubble); color: var(--text-dark); border-bottom-right-radius: 2px; }
.ai .bubble { background: var(--ai-bubble); color: var(--text-dark); border-bottom-left-radius: 2px; border: 1px solid #e2e8f0; }

/* منطقة الإدخال */
.input-panel {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 15px 15px;
}

.controls-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f1f5f9;
    padding: 8px 15px;
    border-radius: 30px;
}

.icon-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.icon-btn:hover { color: var(--primary); }

#userInp {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    padding: 10px;
    font-size: 1rem;
}

.send-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recording-dot {
    font-size: 0.8rem;
    margin-bottom: 5px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.chat-img-preview {
    max-width: 200px;
    border-radius: 10px;
    margin-top: 10px;
    border: 2px solid white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.preview-text {
    font-size: 12px;
    color: #2563eb;
    padding: 5px 15px;
    font-weight: bold;
}

.active-link {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 700;
}

.recording-dot {
    color: #e11d48;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 8px;
    padding-right: 20px;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}
/* تنسيق منطقة الرسائل */
.messages-area {
    background: #fdfdfd;
    background-image: radial-gradient(#e5e7eb 0.5px, transparent 0.5px); /* خلفية منقطة خفيفة */
    background-size: 20px 20px;
}

/* شكل الفقاعات (Bubbles) */
.bubble {
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 0.98rem;
    line-height: 1.6;
    max-width: 85%;
    position: relative;
    transition: all 0.3s ease;
}

.user .bubble {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.ai .bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #f1f5f9;
    border-bottom-left-radius: 4px;
    align-self: flex-end;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

/* صندوق الملفات المرفقة (File Box) */
.file-info {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 8px;
    margin-top: 8px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* زر الميكروفون عند التفعيل */
.recording-active {
    background: #ef4444 !important;
    color: white !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
/* 🎨 المتغيرات الأساسية لإعطاء هوية للموقع */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --text-main: #1e293b;
    --user-bubble-bg: #dbeafe;
    --ai-bubble-bg: #ffffff;
    --error-red: #ef4444;
    --success-green: #10b981;
}

/* 📱 تنسيق الحاوية الرئيسية */
.chat-container {
    max-width: 900px;
    margin: 20px auto;
    height: 85vh;
    background: var(--bg-color);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

/* 💬 منطقة الرسائل */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

/* 💭 فقاعات الدردشة المحدثة */
.message-row { display: flex; width: 100%; margin-bottom: 5px; }
.message-row.user { justify-content: flex-start; }
.message-row.ai { justify-content: flex-end; }

.bubble {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 20px;
    font-size: 1rem;
    line-height: 1.6;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.user .bubble {
    background: var(--user-bubble-bg);
    color: var(--text-main);
    border-bottom-right-radius: 4px;
}

.ai .bubble {
    background: var(--ai-bubble-bg);
    color: var(--text-main);
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

/* 🖼️ تنسيق الصور داخل الدردشة */
.chat-img-preview {
    max-width: 250px;
    border-radius: 12px;
    margin-top: 10px;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* 📎 صندوق الملفات النصية */
.file-info-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.05);
    padding: 10px;
    border-radius: 10px;
    margin-top: 8px;
    font-size: 0.9rem;
    border: 1px dashed #cbd5e1;
}

/* ⌨️ لوحة الإدخال */
.input-panel {
    padding: 15px 25px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.status-bar {
    margin-bottom: 10px;
    min-height: 20px;
}

.preview-text {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: bold;
}

.controls-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f1f5f9;
    padding: 8px 15px;
    border-radius: 30px;
}

.icon-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover { color: var(--primary-color); }

#userInp {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    padding: 10px;
    font-size: 1rem;
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.send-btn:hover { background: var(--primary-hover); }

/* 🔴 تأثيرات التسجيل (Recording Effects) */
.recording-indicator {
    color: var(--error-red);
    font-weight: bold;
    animation: pulse-red 1.5s infinite;
}

.recording-active {
    color: var(--error-red) !important;
    transform: scale(1.2);
}

@keyframes pulse-red {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* 🔗 روابط تفاعلية */
.active-link {
    color: var(--primary-color);
    font-weight: bold;
    text-decoration: underline;
}
.chat-header {
    padding: 10px 20px;
    display: flex;
    justify-content: flex-end;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.clear-btn {
    background: none;
    border: 1px solid #fecaca;
    color: #ef4444;
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: #fef2f2;
    transform: translateY(-1px);
}
.auth-page {
    background: var(--bg-light);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.auth-box input, .auth-box select {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
}

.geo-select { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-wrapper {
    padding: 50px 20px;
    background: #f3f4f6;
    display: flex;
    justify-content: center;
}

.register-card {
    background: white;
    width: 100%;
    max-width: 800px;
    padding: 35px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.05);
}

.grid-form {
    display: grid;
    grid-template-columns: 1fr 1fr; /* تقسيم الصفحة لجوج أعمدة */
    gap: 20px;
    margin-top: 25px;
}

.form-group.full-width { grid-column: span 2; } /* عناصر تأخذ العرض كامل */

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #374151;
    font-size: 0.9rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}

.register-btn {
    grid-column: span 2;
    background: #2563eb;
    color: white;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.1rem;
    transition: 0.3s;
}

.register-btn:hover { background: #1d4ed8; }
/* تنسيق الـ Hero Section */
.hero-section {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    padding: 100px 0 60px;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('assets/images/pattern.svg'); /* اختياري: إضافة خلفية منقطة */
    opacity: 0.1;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 25px;
    text-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.hero-content p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 40px;
    opacity: 0.9;
    line-height: 1.8;
}

/* الأزرار الكبيرة (Lg Buttons) */
.btn-primary-lg {
    background: white;
    color: #2563eb;
    padding: 15px 35px;
    border-radius: 50px;
    font-weight: bold;
    text-decoration: none;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: 0.3s;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.btn-primary-lg:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

/* إحصائيات سريعة */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 50px;
    margin-top: 60px;
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 40px;
}

.stat-item { display: flex; flex-direction: column; }
.stat-num { font-size: 2rem; font-weight: bold; }
.stat-label { font-size: 0.9rem; opacity: 0.8; }

/* أنيميشن بسيط */
.animate-up {
    animation: fadeInUp 0.8s ease forwards;
    opacity: 0;
}
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.auth-page { background-color: #f8fafc; }

.auth-wrapper {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    background: white;
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    text-align: center;
}

.auth-icon {
    font-size: 2.5rem;
    color: #2563eb;
    margin-bottom: 20px;
}

.auth-header h2 { font-weight: 800; color: #1e293b; margin-bottom: 10px; }
.auth-header p { color: #64748b; font-size: 0.95rem; margin-bottom: 30px; }

.btn-primary-block {
    width: 100%;
    background: #2563eb;
    color: white;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.1rem;
    transition: 0.3s;
}

.divider {
    margin: 25px 0;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}
.divider span {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 0 15px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.btn-google {
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    padding: 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-weight: bold;
    color: #475569;
}
/* ضبط الحاوية الرئيسية لمنع التداخل */
body {
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* يضمن أن الصفحة تأخذ كامل طول الشاشة */
}

/* الهيدر والفوتر يأخذان مكانهما الطبيعي */
#navbar-placeholder, #footer-placeholder {
    width: 100%;
}

.auth-wrapper {
    flex: 1; /* يدفع الفوتر للأسفل ويأخذ المساحة المتبقية */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px; /* مسافة أمان لمنع الالتصاق بالهيدر */
    background-color: #f3f4f6;
}

.auth-card {
    background: white;
    width: 100%;
    max-width: 400px;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    z-index: 10; /* يضمن بقاء الكارت فوق الخلفية */
}

/* تنسيق الروابط والفوتر الجانبي */
.auth-footer {
    margin-top: 20px;
    text-align: center;
}
/* Dashboard Styles */
.dashboard-page { background-color: #f1f5f9; }

.dashboard-wrapper { padding: 40px 20px; }

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.user-plan-badge {
    background: #2563eb;
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.stat-card i { font-size: 2rem; color: #2563eb; }
.stat-data h3 { font-size: 1.5rem; margin-bottom: 5px; color: #1e293b; }
.stat-data p { color: #64748b; margin: 0; }

/* Quick Actions */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.action-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    color: #1e293b;
    transition: 0.3s;
    border: 1px solid #e2e8f0;
}

.action-item:hover {
    border-color: #2563eb;
    transform: translateY(-5px);
}

.action-item i { display: block; font-size: 1.8rem; color: #2563eb; margin-bottom: 10px; }
.preview-box {
    background: #fff;
    min-height: 400px;
    white-space: pre-wrap; /* يحافظ على تنسيق الأسطر من AI */
    font-family: 'Cairo', serif;
    line-height: 2;
    padding: 40px !important;
    border-radius: 5px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

.doc-sidebar .list-group-item.active {
    background-color: #2563eb;
    border-color: #2563eb;
}
.result-box {
    background: #f0f7ff;
    padding: 20px;
    border-radius: 12px;
    border-right: 5px solid #2563eb;
}

.result-box p {
    margin-bottom: 8px;
    font-size: 1.1rem;
    color: #1e293b;
}

.result-box strong {
    color: #2563eb;
    font-size: 1.3rem;
}

.tool-card {
    transition: transform 0.3s ease;
    border: none;
}

.tool-card:hover {
    transform: translateY(-5px);
}
.messages-area {
    height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-row { display: flex; width: 100%; }
.message-row.user { justify-content: flex-start; } /* المستخدم يمين/يسار حسب dir */
.message-row.ai { justify-content: flex-end; }

.bubble {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 15px;
    font-size: 1rem;
    line-height: 1.6;
}

.user .bubble {
    background-color: #2563eb;
    color: white;
    border-bottom-right-radius: 2px;
}

.ai .bubble {
    background-color: white;
    color: #1e293b;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* أنيميشن الكتابة */
.typing .bubble {
    font-style: italic;
    color: #64748b;
}