/* ===== المتغيرات العامة ===== */
:root {
    --primary-dark: #01579b;
    --primary: #016fae;
    --primary-light: #4facfe;
    --primary-soft: #e3f2fd;
    --primary-gradient: linear-gradient(135deg, var(--primary-dark), var(--primary));
    --accent: #00b0c7;
    --accent-gradient: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%);
    --white: #ffffff;
    --offwhite: #f9fcff;
    --gray-bg: #f2f8fd;
    --text-dark: #0a384b;
    --text-soft: #2f5a6e;
    --text-light: #5f7e8c;
    --border-light: #e0eff7;
    --shadow-sm: 0 8px 20px rgba(1,87,155,0.06);
    --shadow-md: 0 12px 30px rgba(1,87,155,0.1);
    --shadow-hover: 0 15px 35px rgba(1,87,155,0.15);
    --radius-md: 20px;
    --radius-lg: 32px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --paper-bg: #fcf8f0;
    --paper-dark: #f5efe6;
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --radius: 18px;
}

/* الوضع الليلي */
[data-theme="dark"] {
    --bg-body: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --primary-soft: #1e293b;
    --offwhite: #0f172a;
    --white: #1e293b;
    --text-dark: #f1f5f9;
    --text-soft: #cbd5e1;
    --border-light: #334155;
}

/* ===== إعادة تعيين أساسية ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== الحاوية الرئيسية ===== */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== أنماط عامة للنصوص والعناصر ===== */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-soft); }
.text-white { color: white; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-column { flex-direction: column; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 20px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mt-4 { margin-top: 28px; }
.mt-5 { margin-top: 50px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }
.mb-4 { margin-bottom: 28px; }
.mb-5 { margin-bottom: 50px; }
.w-100 { width: 100%; }
.h-100 { height: 100%; }
.arabic-text {
    line-height: 1.8;
    font-size: 1.1rem;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}
.icon-lg {
    font-size: 1.5rem;
}
.d-none { display: none; }
.d-md-none { display: none; }
.d-md-flex { display: flex; }

@media (max-width: 768px) {
    .d-md-none { display: block; }
    .d-md-flex { display: none; }
    .w-100 { width: 100%; }
}

/* ===== الأزرار ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 60px;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    border: 2px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 6px 16px rgba(1,111,174,0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(1,87,155,0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-soft);
    border-color: var(--primary-dark);
}

.btn-lg {
    padding: 14px 36px;
    font-size: 1rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

/* ===== البطاقات العامة ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-soft);
}

.card-body {
    padding: 20px;
    flex: 1;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
}

.card-header {
    padding: 20px;
    background: var(--primary-gradient);
    color: white;
}

/* ===== الشارات ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.badge-warning {
    background: #ffc107;
    color: #000;
}

.badge-coming {
    background: #d4a373;
    color: white;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 10px;
    display: inline-block;
}

/* ===== حقول الإدخال ===== */
.form-control {
    font-family: 'Tajawal', sans-serif;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    padding: 14px 20px;
    border-radius: 60px;
    width: 100%;
    outline: none;
    transition: 0.2s;
    color: var(--text-main);
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79,172,254,0.2);
}

.form-group {
    margin-bottom: 20px;
}

/* ===== شريط التنقل (الهيدر) ===== */
.header {
    background: var(--card-bg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid rgba(1,87,155,0.08);
}

[data-theme="dark"] .header {
    background: rgba(30, 41, 59, 0.92);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--primary-dark);
}

.logo i {
    font-size: 1.8rem;
    color: var(--primary);
}

.logo .mobile-only {
    display: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-soft);
    text-decoration: none;
    transition: var(--transition);
    border: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
}

.nav-btn i {
    font-size: 1.1rem;
    color: var(--primary);
}

.nav-btn:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.nav-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 6px 16px rgba(1,111,174,0.25);
}

.nav-btn.active i {
    color: white;
}

/* القوائم المنسدلة */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 8px 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s;
    z-index: 1001;
    border: 1px solid var(--border-light);
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--text-soft);
    text-decoration: none;
    transition: 0.2s;
    font-weight: 500;
}

.dropdown-item i {
    color: var(--primary);
    width: 20px;
}

.dropdown-item:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

/* قائمة الهامبرغر للجوال */
.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
}

.close-menu {
    display: none;
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--primary-soft);
    border: none;
    font-size: 1.5rem;
    color: var(--primary-dark);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 1002;
}

.overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    background: rgba(1,87,155,0.3);
    backdrop-filter: blur(3px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== تذييل الصفحة ===== */
.footer {
    background: var(--primary-dark);
    color: white;
    padding: 60px 0 30px;
    margin-top: 80px;
    border-top-left-radius: 60px;
    border-top-right-radius: 60px;
}

.footer a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: 0.2s;
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

.copyright {
    text-align: center;
    padding-top: 40px;
    margin-top: 40px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}

/* ===== زر العودة للأعلى ===== */
#backToTop {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(1,87,155,0.3);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: 0.2s;
}

#backToTop:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

/* ===== الشبكات ===== */
.grid {
    display: grid;
    gap: 28px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ===== أنماط مشتركة للصفحات ===== */
.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 32px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 0;
    width: 70px;
    height: 4px;
    background: var(--primary-light);
    border-radius: 4px;
}

.page-header {
    background: var(--primary-gradient);
    color: white;
    padding: 50px 30px;
    border-radius: var(--radius-lg);
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.page-title {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page-subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.back-btn {
    background: var(--card-bg);
    color: var(--text-dark);
    padding: 12px 25px;
    border-radius: var(--radius-md);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.back-btn:hover {
    transform: translateX(-5px);
    background: var(--primary);
    color: white;
}

/* ===== أنماط متفرقة مشتركة ===== */
hr {
    border: none;
    border-top: 2px dashed var(--border-light);
    margin: 30px 0;
}

.message-bubble {
    background: #f2f8fd;
    padding: 16px 20px;
    border-radius: 22px;
    margin-bottom: 16px;
    max-width: 85%;
    border-bottom-right-radius: 6px;
}

.message-bubble.sent {
    background: var(--primary-soft);
    margin-right: auto;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 22px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast-message {
    background: var(--card-bg);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    border-right: 4px solid var(--primary);
}

.toast-message.toast-success {
    border-right-color: var(--success);
}

.toast-message.toast-error {
    border-right-color: var(--danger);
}

.toast-message.toast-info {
    border-right-color: var(--primary);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    margin-right: auto;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* التحميل والأخطاء */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.error-message {
    background: #fee2e2;
    color: #b91c1c;
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
    margin: 20px 0;
}

/* ===== استجابات الجوال العامة ===== */
@media (max-width: 992px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .navbar {
        height: 60px;
    }
    .logo .desktop-only {
        display: none;
    }
    .logo .mobile-only {
        display: inline;
        font-size: 1.2rem;
    }
    .hamburger {
        display: block;
    }
    .nav-menu {
        position: fixed;
        top: 0;
        right: -300px;
        width: 280px;
        height: 100vh;
        background: var(--card-bg);
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 80px 20px 30px;
        box-shadow: -5px 0 30px rgba(0,0,0,0.05);
        transition: 0.3s ease-in-out;
        z-index: 999;
        gap: 5px;
        overflow-y: auto;
    }
    .nav-menu.active {
        right: 0;
    }
    .nav-btn {
        width: 100%;
        padding: 14px 20px;
        border-radius: 12px;
        font-size: 1rem;
        justify-content: flex-start;
    }
    .nav-btn i {
        width: 25px;
    }
    .dropdown {
        width: 100%;
    }
    .dropdown-toggle {
        justify-content: space-between;
    }
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding: 0 10px;
        margin-top: 5px;
        background: transparent;
        border: none;
        display: none;
    }
    .dropdown.active .dropdown-menu {
        display: block;
    }
    .dropdown-item {
        padding: 12px 30px;
    }
    .close-menu {
        display: flex;
    }
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    .page-title {
        font-size: 2rem;
    }
    .page-subtitle {
        font-size: 1rem;
    }
    .back-btn {
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    /* أنماط إضافية إذا لزم */
}