/**
 * platform-modern-ui.css
 * نظام التصميم العصري المحسّن لواجهات arabicgames.app
 * متوافق بنسبة 100% مع الجوال والتابلت وشاشات الحواسيب
 */

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

:root {
    /* لوحة الألوان العصرية الفائقة */
    --p-font-main: 'Tajawal', 'Cairo', system-ui, -apple-system, sans-serif;
    --p-font-display: 'Cairo', 'Tajawal', sans-serif;
    
    /* تدرجات أصلية جذابة للتعليم والألعاب */
    --grad-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #9333ea 100%);
    --grad-hero: linear-gradient(135deg, #3b82f6 0%, #6366f1 45%, #8b5cf6 80%, #ec4899 100%);
    --grad-amber: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --grad-emerald: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --grad-rose: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    --grad-cyan: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
    --grad-sunset: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);
    
    /* ألوان الأسطح والبطاقات */
    --bg-page: #f8fafc;
    --bg-page-alt: #f1f5f9;
    --surface-card: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.88);
    --border-subtle: rgba(226, 232, 240, 0.8);
    --border-glass: rgba(255, 255, 255, 0.6);
    
    /* النصوص */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    
    /* الظلال العصرية */
    --shadow-sm: 0 2px 8px -2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 20px 35px -8px rgba(15, 23, 42, 0.12), 0 10px 15px -5px rgba(15, 23, 42, 0.05);
    --shadow-glow-amber: 0 8px 25px rgba(245, 158, 11, 0.35);
    --shadow-glow-primary: 0 10px 30px rgba(99, 102, 241, 0.35);

    /* استدارة الحواف */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-pill: 9999px;
}

/* تحسينات عامة على الصفحة والخطوط */
body {
    font-family: var(--p-font-main) !important;
    background-color: var(--bg-page);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .hero-title, .section-title {
    font-family: var(--p-font-display) !important;
    letter-spacing: -0.01em;
}

/* =========================================================================
   1. الهيدر وشريط التنقل العصري (Navbar)
   ========================================================================= */
.public-navbar {
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1040;
    transition: all 0.3s ease;
}

.public-navbar .navbar-brand {
    font-weight: 800;
    font-size: 1.35rem;
    color: #4338ca !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.public-navbar .nav-link {
    font-weight: 600;
    color: #475569 !important;
    padding: 0.6rem 1rem !important;
    border-radius: var(--radius-pill);
    transition: all 0.25s ease;
}

.public-navbar .nav-link:hover,
.public-navbar .nav-link.active {
    color: #4f46e5 !important;
    background: rgba(99, 102, 241, 0.08);
}

/* زر القائمة للشاشات الصغيرة */
.navbar-toggler {
    border: none !important;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.08);
}
.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25) !important;
}

/* =========================================================================
   2. قسم البطل العصري (Modern Dynamic Hero)
   ========================================================================= */
.modern-hero {
    position: relative;
    background: var(--grad-hero);
    color: #ffffff;
    padding: 4.5rem 0 3.5rem;
    overflow: hidden;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    box-shadow: 0 15px 40px -10px rgba(79, 70, 229, 0.25);
}

.modern-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 25%),
                      radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.12) 0%, transparent 35%);
    pointer-events: none;
}

.hero-pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.15rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius-pill);
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.hero-main-title {
    font-size: clamp(2rem, 4vw + 1rem, 3.4rem);
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 1.2rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.hero-highlight-tag {
    background: linear-gradient(120deg, #fef08a 0%, #fde047 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.hero-lead-text {
    font-size: clamp(1rem, 1.5vw + 0.5rem, 1.25rem);
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
    max-width: 620px;
    margin-bottom: 2rem;
}

/* أزرار البطل */
.btn-hero-primary {
    background: var(--grad-amber);
    color: #451a03 !important;
    font-weight: 800;
    font-size: 1.05rem;
    padding: 0.85rem 1.85rem;
    border-radius: var(--radius-pill);
    border: none;
    box-shadow: var(--shadow-glow-amber);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-hero-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px rgba(245, 158, 11, 0.45);
    color: #451a03 !important;
}

.btn-hero-secondary {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff !important;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-hero-secondary:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-3px);
    color: #ffffff !important;
}

/* بطاقة المعاينة في البطل (Hero Interactive Showcase Card) */
.hero-showcase-box {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transform: perspective(1000px) rotateY(-2deg) rotateX(1deg);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.hero-showcase-box:hover {
    transform: perspective(1000px) rotateY(0deg) rotateX(0deg) translateY(-5px);
    box-shadow: 0 30px 60px -10px rgba(0, 0, 0, 0.4);
}

.hero-showcase-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* =========================================================================
   3. شريط الإحصائيات العائم (Floating Capsule Stats)
   ========================================================================= */
.floating-stats-wrap {
    margin-top: -2.25rem;
    position: relative;
    z-index: 20;
    margin-bottom: 3rem;
}

.stats-glass-card {
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.25rem 1.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
}

.stat-icon-box {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    flex-shrink: 0;
}

.stat-icon-blue { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.stat-icon-purple { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
.stat-icon-amber { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.stat-icon-emerald { background: rgba(16, 185, 129, 0.12); color: #059669; }

.stat-val {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-main);
}

.stat-lbl {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
}

/* =========================================================================
   4. شريط الفلترة الأفقي السريع (Horizontal Touch Scroll Filter Bar)
   ========================================================================= */
.filter-pills-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    overflow-x: auto;
    padding: 0.5rem 0.25rem 1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}
.filter-pills-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

.filter-pill {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-pill);
    background: #ffffff;
    color: #475569;
    border: 1px solid var(--border-subtle);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.filter-pill:hover {
    color: #4f46e5;
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.filter-pill.active {
    background: var(--grad-primary);
    color: #ffffff !important;
    border-color: transparent;
    box-shadow: var(--shadow-glow-primary);
}

/* شريط البحث المدمج */
.search-input-pill {
    border-radius: var(--radius-pill) !important;
    padding: 0.75rem 1.35rem !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: var(--shadow-sm);
    font-size: 0.95rem;
    background: #ffffff;
    transition: all 0.25s ease;
}

.search-input-pill:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15) !important;
    outline: none;
}

/* =========================================================================
   5. نظام البطاقات العصري المشترك (Modern Unified Content Card)
   ========================================================================= */
.modern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.modern-content-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.modern-content-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.3);
}

/* غلاف البطاقة */
.card-media-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #e2e8f0;
}

.card-media-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-content-card:hover .card-media-img {
    transform: scale(1.06);
}

/* شارات عائمة على الصورة */
.card-floating-badge {
    position: absolute;
    top: 0.85rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 800;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.card-badge-right { right: 0.85rem; }
.card-badge-left { left: 0.85rem; }

.badge-branching {
    background: rgba(16, 185, 129, 0.9);
    color: #ffffff;
}

.badge-linear {
    background: rgba(59, 130, 246, 0.9);
    color: #ffffff;
}

.badge-category {
    background: rgba(15, 23, 42, 0.75);
    color: #f8fafc;
}

.badge-difficulty-beginner {
    background: rgba(16, 185, 129, 0.9);
    color: #ffffff;
}

.badge-difficulty-intermediate {
    background: rgba(245, 158, 11, 0.9);
    color: #ffffff;
}

.badge-difficulty-advanced {
    background: rgba(239, 68, 68, 0.9);
    color: #ffffff;
}

/* محتوى البطاقة */
.card-content-body {
    padding: 1.25rem 1.35rem 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-item-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-item-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

/* بيانات الميتا السريعة */
.card-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* زر العمل الأساسي للبطاقة */
.card-action-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    border: none;
}

.btn-card-primary {
    background: var(--grad-primary);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-card-primary:hover {
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
    transform: translateY(-2px);
    color: #ffffff !important;
}

.btn-card-game {
    background: var(--grad-amber);
    color: #451a03 !important;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.btn-card-game:hover {
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
    color: #451a03 !important;
}

.btn-card-story {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.btn-card-story:hover {
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.4);
    transform: translateY(-2px);
    color: #ffffff !important;
}

/* =========================================================================
   6. بطاقات المسارات التعليمية (Pathways / Categories)
   ========================================================================= */
.category-modern-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.category-modern-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: rgba(99, 102, 241, 0.3);
}

.category-modern-icon {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85rem;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.category-modern-card:hover .category-modern-icon {
    transform: scale(1.1) rotate(4deg);
}

.category-modern-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.category-modern-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.2rem;
    flex-grow: 1;
}

/* =========================================================================
   7. التجاوب مع الجوال والتابلت (Mobile & Tablet Responsiveness)
   ========================================================================= */

/* شاشات الجوال (Smartphones <= 576px) */
@media (max-width: 576px) {
    .modern-hero {
        padding: 2.75rem 0 2.25rem;
        border-bottom-left-radius: var(--radius-lg);
        border-bottom-right-radius: var(--radius-lg);
        text-align: center;
    }
    
    .hero-lead-text {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .btn-hero-primary,
    .btn-hero-secondary {
        width: 100%;
        justify-content: center;
    }

    .hero-showcase-box {
        transform: none !important;
        margin-top: 1.5rem;
    }

    .floating-stats-wrap {
        margin-top: 1rem;
    }

    .stats-glass-card {
        padding: 1rem;
    }

    .stat-item {
        border-bottom: 1px solid var(--border-subtle);
        padding: 0.75rem 0;
    }

    .stat-item:last-child {
        border-bottom: none;
    }

    .modern-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .filter-pills-container {
        padding-bottom: 0.75rem;
    }
}

/* شاشات الأجهزة اللوحية (Tablets: 577px - 991px) */
@media (min-width: 577px) and (max-width: 991px) {
    .modern-hero {
        padding: 3.5rem 0 3rem;
        text-align: center;
    }

    .hero-lead-text {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-btn-group {
        justify-content: center;
    }

    .hero-showcase-box {
        transform: none !important;
        max-width: 520px;
        margin: 2rem auto 0;
    }

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

/* شاشات سطح المكتب الكبيرة (Desktops >= 1200px) */
@media (min-width: 1200px) {
    .modern-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.75rem;
    }
}

/* تأثير التمرير الناعم والظهور */
[data-aos] {
    transition-property: transform, opacity;
}
