/* ⚡ التصميم المعاصر فائق الحداثة: الأبيض والبنفسجي الغامق الملكي */
:root {
    --primary-color: #4A154B;        /* البنفسجي الغامق الملكي */
    --secondary-color: #611f69;      /* البنفسجي المكمل */
    --accent-color: #9b59b6;         /* البنفسجي المضيء للحركات */
    --bg-light: #f8f9fa;             /* خلفية بيضاء نقية معاصرة */
    --card-bg: #ffffff;              /* أبيض ناصع للبطاقات */
    --text-dark: #210723;            /* نص بنفسجي داكن جداً */
    --border-color: #ebdbeb;         /* حدود ناعمة */
    --radius-lg: 16px;
    --radius-md: 8px;
    --shadow-sm: 0 4px 12px rgba(74, 21, 75, 0.04);
    --shadow-md: 0 10px 30px rgba(74, 21, 75, 0.08);
}

body.dark-mode {
    --bg-light: #120414;
    --card-bg: #1c081e;
    --text-dark: #f5edf6;
    --border-color: #3b103c;
    --shadow-md: 0 10px 30px rgba(0,0,0,0.5);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    transition: all 0.4s ease;
}

.container { width: 88%; margin: auto; max-width: 1400px; }

/* 🌐 شريط أزرار التحكم العلوي العائم */
.top-bar-controls {
    position: fixed; top: 5px; left: 20px; z-index: 5000; display: flex; gap: 8px;
}
.btn-ctrl-top {
    background: var(--primary-color); color: white; border: 1px solid var(--border-color);
    padding: 4px 12px; border-radius: 15px; cursor: pointer; font-weight: 700; font-size: 0.8rem;
}

/* 📰 شريط الأخبار التفاعلي المتحرك */
.news-ticker-container {
    background: #2c0b2d; color: #ffffff; height: 40px; display: flex; align-items: center;
    overflow: hidden; font-size: 0.9rem; font-weight: 600; border-bottom: 2px solid var(--border-color);
}
.ticker-title {
    background: var(--accent-color); color: white; padding: 0 20px; height: 100%;
    display: flex; align-items: center; white-space: nowrap; box-shadow: 5px 0 15px rgba(0,0,0,0.2); z-index: 10;
}
.ticker-wrap { flex: 1; overflow: hidden; }
.ticker-items { display: flex; white-space: nowrap; animation: tickerLoop 30s linear infinite; }
.ticker-items span { padding-left: 50px; display: inline-block; }

@keyframes tickerLoop {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

body[dir="ltr"] .ticker-items { animation: tickerLoopLtr 30s linear infinite; }
@keyframes tickerLoopLtr {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 🔹 الهيدر الزجاجي */
header {
    background: var(--card-bg); padding: 15px 0; box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 1000; backdrop-filter: blur(10px);
}
.header-flex { display: flex; justify-content: space-between; align-items: center; }
.logo { color: var(--primary-color); font-size: 1.5rem; font-weight: 700; }
.logo span { color: var(--accent-color); font-weight: 300; }

header ul { display: flex; list-style: none; gap: 10px; align-items: center; }
header ul li a {
    color: var(--text-dark); text-decoration: none; padding: 8px 16px; border-radius: var(--radius-md); font-weight: 600; transition: 0.3s;
}
header ul li a:hover, header ul li a.active { background: rgba(74, 21, 75, 0.05); color: var(--primary-color); }

.btn-auth-nav {
    background: var(--primary-color); color: white; border: none; padding: 8px 20px; font-weight: 700; border-radius: var(--radius-md); cursor: pointer; transition: 0.3s;
}
.btn-auth-nav:hover { background: var(--secondary-color); transform: translateY(-2px); }

/* 🌟 قسم الترحيب المطور */
.hero {
    background: radial-gradient(circle at top right, rgba(97, 31, 105, 0.05), transparent), url('https://images.unsplash.com/photo-1614741118887-7a4ee193a5fa?q=80&w=1920') no-repeat center center/cover;
    padding: 100px 0; text-align: center; position: relative; border-bottom: 1px solid var(--border-color);
}
.hero-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to bottom, rgba(255,255,255,0.9), var(--bg-light)); z-index: 1; }
body.dark-mode .hero-overlay { background: linear-gradient(to bottom, rgba(18, 4, 20, 0.9), var(--bg-light)); }
.hero-content { position: relative; z-index: 2; max-width: 800px; margin: auto; }
.hero h2 { font-size: 2.5rem; color: var(--primary-color); font-weight: 700; margin-bottom: 20px; line-height: 1.3; }
.hero p { font-size: 1.1rem; color: var(--text-dark); opacity: 0.85; margin-bottom: 35px; }

.hero-buttons { display: flex; gap: 15px; justify-content: center; }
.btn-primary { background: var(--primary-color); color: white; padding: 12px 25px; text-decoration: none; font-weight: 700; border-radius: var(--radius-md); transition: 0.3s; box-shadow: 0 4px 15px rgba(74,21,75,0.2); }
.btn-primary:hover { background: var(--secondary-color); transform: translateY(-3px); }

/* 📊 بطاقات الإحصائيات */
.stats { display: flex; justify-content: space-between; margin-top: -40px; margin-bottom: 50px; gap: 20px; position: relative; z-index: 10; }
.stat-card { background: var(--card-bg); flex: 1; padding: 25px; text-align: center; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); border: 1px solid var(--border-color); transition: 0.4s ease; }
.stat-card:hover { transform: translateY(-8px); }
.stat-icon { font-size: 1.8rem; margin-bottom: 8px; }
.stat-card h3 { font-size: 2.2rem; color: var(--primary-color); font-weight: 700; }

/* 📦 صناديق المخططات والبيانات */
.document-section { margin-bottom: 60px; }
.section-title { text-align: center; margin-bottom: 40px; }
.section-title h2 { color: var(--primary-color); font-size: 1.8rem; font-weight: 700; margin-bottom: 10px; }
.section-title p { color: var(--text-dark); opacity: 0.7; }

.upload-box { background: var(--card-bg); padding: 30px; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 30px; border: 1px solid var(--border-color); position: relative; overflow: hidden; }
.upload-box::before { content: ''; position: absolute; top: 0; right: 0; width: 6px; height: 100%; background: var(--primary-color); }
body[dir="ltr"] .upload-box::before { right: auto; left: 0; }
.ai-box::before { background: #e67e22; }

.card-title { color: var(--primary-color); font-weight: 700; margin-bottom: 15px; font-size: 1.2rem; }
.card-text { font-size: 0.95rem; line-height: 1.7; text-align: justify; opacity: 0.9; }

.goals-list li { padding: 10px 15px; margin-bottom: 8px; background: rgba(74, 21, 75, 0.02); border-radius: var(--radius-md); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.goals-list li span { color: var(--accent-color); font-weight: 700; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 15px; }
input, select { padding: 10px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--card-bg); color: var(--text-dark); font-size: 0.9rem; }

.btn-submit { background: var(--primary-color); color: white; border: none; padding: 10px 20px; border-radius: var(--radius-md); cursor: pointer; font-weight: 700; transition: 0.3s; }
.btn-submit:hover { background: var(--secondary-color); }

/* 📊 الجداول التفاعلية المتجاوبة */
.table-responsive { width: 100%; overflow-x: auto; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); }
.doc-table { width: 100%; border-collapse: collapse; background: #ffffff; }
body.dark-mode .doc-table { background: var(--card-bg); }
.doc-table th, .doc-table td { padding: 14px 18px; text-align: inherit; font-size: 0.9rem; }
.doc-table th { background: var(--primary-color); color: white; font-weight: 700; }
.doc-table td { border-bottom: 1px solid var(--border-color); }
.doc-table tr:hover { background-color: rgba(74, 21, 75, 0.02); }

.badge-success { background: #27ae60; color: white; padding: 3px 8px; border-radius: 4px; font-size: 0.8rem; }
.badge-danger { background: #c0392b; color: white; padding: 3px 8px; border-radius: 4px; font-size: 0.8rem; }
.badge-primary { background: var(--secondary-color); color: white; padding: 3px 8px; border-radius: 4px; font-size: 0.8rem; }
.hidden { display: none !important; }

/* 🔴 النوافذ المنبثقة الذكية */
.modal { display: none; position: fixed; z-index: 5000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(33, 7, 35, 0.4); backdrop-filter: blur(4px); align-items: center; justify-content: center; }
.modal-content { background: var(--card-bg); padding: 35px; border-radius: var(--radius-lg); width: 380px; border: 1px solid var(--border-color); position: relative; text-align: center; box-shadow: var(--shadow-md); }
.close-btn { position: absolute; top: 15px; left: 20px; font-size: 1.5rem; cursor: pointer; color: var(--primary-color); }
body[dir="ltr"] .close-btn { left: auto; right: 20px; }

#loginForm { display: flex; flex-direction: column; gap: 12px; margin-top: 15px; }

@media (max-width: 768px) {
    .stats { flex-direction: column; margin-top: 20px; }
    header .container { flex-direction: column; gap: 15px; }
}