/*
 * ملف أنماط Tailwind CSS الرئيسي
 * مع إعدادات مخصصة للغة العربية (RTL) ونظام الألوان CodeHorizon
 */

/* استيراد Tailwind CSS */
@import 'tailwindcss';

/* المصادر (Sources) — لتمكين JIT وتحليل كل الملفات */
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';

/* الإعدادات والسمات (Theme) */
@theme {
    /* خط تاجوال الافتراضي */
    --font-sans: 'Tajawal', ui-sans-serif, system-ui, sans-serif, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;

    /* الألوان الأساسية */
    --color-primary: #0072ff;
    --color-primary-dark: #0056d6;
    --color-secondary: #667eea;
    --color-accent: #764ba2;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
    --color-info: #17a2b8;
    --color-light: #f8f9fa;
    --color-dark: #2d3748;

    /* التدرجات */
    --gradient-primary: linear-gradient(135deg, #00c6ff, #0072ff);
    --gradient-secondary: linear-gradient(135deg, #667eea, #764ba2);
    --gradient-accent: linear-gradient(135deg, #f093fb, #f5576c);

    /* خلفية النظام */
    --background-image-url: url('/images/codehorizon-bg.png');
    --background-image-size: cover;
    --background-image-position: center;
    --background-image-attachment: fixed;
    --background-overlay: rgba(255, 255, 255, 0.95);
}

/* --- طبقة الأنماط العامة (Base Layer) --- */
@layer base {
    /* تطبيق الأنماط على الجسم الرئيسي */
    body {
        @apply font-sans text-gray-800;
        background-color: #f5f7fb; /* لون احتياطي */
        background-image: var(--background-image-url);
        background-size: var(--background-image-size);
        background-position: var(--background-image-position);
        background-attachment: var(--background-image-attachment);
        background-repeat: no-repeat;
    }

    /* ضمان دعم اتجاه RTL لجميع العناصر */
    [dir="rtl"] * {
        direction: rtl;
        text-align: right; /* محاذاة النصوص إلى اليمين */
    }

    /* تطبيق خلفية شفافة مبيضة على عناصر مثل الشريط الجانبي والنوافذ */
    .sidebar,
    .topbar,
    .navbar,
    .modal-content,
    .card,
    .breadcrumb,
    .page-title-box,
    .alert,
    .form-control,
    .btn {
        background-color: var(--background-overlay) !important;
        backdrop-filter: blur(4px);
    }

    /* دعم الطباعة */
    @media print {
        body {
            background: white !important;
            background-image: none !important;
        }
        .no-print {
            display: none !important;
        }
        .print-only {
            display: block !important;
        }
    }
}

/* --- طبقة المكونات (Components Layer) --- */
@layer components {
    /* أزرار مخصصة */
    .btn-gradient {
        @apply bg-gradient-to-r from-blue-500 to-indigo-600 text-white font-medium py-2 px-4 rounded shadow hover:opacity-90 transition-all;
    }

    .btn-login {
        @apply bg-gradient-to-r from-cyan-400 to-blue-600 text-white font-bold py-3 px-6 rounded-lg shadow-lg hover:shadow-xl transition-all;
    }

    /* بطاقات الإحصائيات */
    .stat-card {
        @apply rounded-xl shadow-sm border border-gray-100 p-5;
    }

    /* شريط التقدم */
    .progress-bar-custom {
        @apply h-2.5 rounded-full bg-gray-200 overflow-hidden;
    }
    .progress-bar-fill {
        @apply h-full rounded-full bg-gradient-to-r from-blue-500 to-indigo-600;
    }

    /* نمط مخصص للروابط في الشريط الجانبي */
    .nav-link {
        @apply text-white py-2 px-4 rounded-lg transition-colors flex items-center;
    }
    .nav-link:hover,
    .nav-link.active {
        background-color: rgba(255, 255, 255, 0.1) !important;
        color: white !important;
    }
    .nav-link i {
        @apply me-2;
    }
}

/* --- طبقة الأدوات (Utilities Layer) --- */
@layer utilities {
    /* خلفية ثابتة */
    .fixed-bg {
        background-attachment: fixed !important;
    }

    /* نص متدرج */
    .text-gradient-primary {
        background: var(--gradient-primary);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        font-weight: bold;
    }

    .text-gradient-secondary {
        background: var(--gradient-secondary);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        font-weight: bold;
    }

    /* تراكيب مسافات سريعة */
    .gap-1 { gap: 0.25rem; }
    .gap-2 { gap: 0.5rem; }
    .p-1 { padding: 0.25rem; }
    .p-2 { padding: 0.5rem; }
    .m-1 { margin: 0.25rem; }
    .m-2 { margin: 0.5rem; }
}