/* =========================================
   1. التنسيقات العامة (Global Styles)
   ========================================= */
body { 
    font-family: 'Tajawal', sans-serif; 
}

/* حركة الطفو (Float Animation) */
@keyframes float-up {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.animate-float { animation: float-up 4s ease-in-out infinite; }
.animate-float-delay { animation: float-up 4s ease-in-out infinite; animation-delay: 2s; }

/* توهج الإطار (Glow Animation) */
@keyframes border-glow-hero {
    0%, 100% { box-shadow: 0 0 15px rgba(79, 70, 229, 0.3); border-color: #4f46e5; }
    50% { box-shadow: 0 0 25px rgba(79, 70, 229, 0.6); border-color: #818cf8; }
}
.ai-card-hero, .ai-card-glow { animation: border-glow-hero 3s infinite; }

/* نبض الزر (Pulse Animation) - مستخدم في كل الصفحات */
@keyframes pulse-amber {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
}
.btn-pulse { animation: pulse-amber 2s infinite; }


/* =========================================
   2. تنسيقات الصفحات الرئيسية (Main Pages)
   ========================================= */

/* خلفية الهيرو الرئيسية */
.hero-bg {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%); 
    position: relative;
    overflow: hidden;
    padding-bottom: 4rem;
}
.hero-bg::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(#374151 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.1;
}

/* خلفية صفحة من نحن */
.hero-bg-about {
    background: linear-gradient(135deg, #111827 0%, #374151 100%);
    background-size: cover;
    background-position: center;
    position: relative;
}

/* خلفية صفحة الخدمات */
.hero-bg-services {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    background-size: cover;
    background-position: center;
    position: relative;
}


/* =========================================
   3. تنسيقات المدونة (Blog Styles)
   ========================================= */

/* خلفية الهيرو للمدونة (الافتراضي: رمادي) */
.hero-blog-bg { 
    background: linear-gradient(135deg, #4c525c 0%, #1f2937 100%); 
}

/* خلفية الهيرو للمدونة (الصفحة الرئيسية للمدونة - نيلي) */
/* ملاحظة: أضف كلاس 'home-variant' في html صفحة index.html للمدونة إذا أردت اللون النيلي */
.hero-blog-bg.home-variant, 
.hero-blog-index {
    background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
}

/* تنسيق الصور داخل المقالات */
.article-image {
    max-width: 90%; 
    margin-left: auto;
    margin-right: auto;
    display: block;
    max-height: 600px;
    object-fit: cover;
    height: auto;
    border-radius: 0.5rem; 
    margin-bottom: 2rem; 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* صندوق الخلاصة (مثل الموجود في مقال الذكاء الاصطناعي) */
.summary-box {
    background-color: #eef2ff;
    border: 2px solid #6366f1;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.dark .summary-box {
    background-color: #1e1b4b;
    border-color: #4338ca;
}

/* تنسيق الأسئلة الشائعة (Accordion) */
details > summary {
    list-style: none;
}
details > summary::-webkit-details-marker {
    display: none;
}

/* --- تنسيق محتوى المقالات (Typography / Prose) --- */
/* يوحد شكل العناوين والفقرات داخل المقالات */

.prose h2 { 
    font-weight: 800; 
    font-size: 1.4rem; 
    margin-top: 1.5rem; 
    margin-bottom: 0.8rem; 
    color: #1f2937; 
    border-right: 4px solid #d97706; /* لون العنبر الافتراضي */
    padding-right: 12px; 
}
.dark .prose h2 { color: #f3f4f6; }

/* تخصيص للمقالات التقنية (مثل الذكاء الاصطناعي) باللون الأزرق */
.prose.tech-theme h2 { border-color: #4f46e5; }

.prose h3 { 
    font-weight: 700; 
    font-size: 1.3rem; 
    margin-top: 1.5rem; 
    margin-bottom: 0.5rem; 
    color: #d97706; 
}
.prose.tech-theme h3 { color: #4338ca; }
.dark .prose.tech-theme h3 { color: #a5b4fc; }

.prose p { 
    margin-bottom: 1rem; 
    line-height: 1.8; 
    color: #374151; 
}
.dark .prose p { color: #d1d5db; }

.prose ul { 
    list-style-type: disc; 
    list-style-position: inside; 
    margin-bottom: 1.5rem; 
    padding-right: 1rem; 
}
.prose ul li { margin-bottom: 0.5rem; color: #4b5563; }
.dark .prose ul li { color: #9ca3af; }

.prose strong { color: #111827; font-weight: 800; }
.dark .prose strong { color: #f9fafb; }


/* =========================================
   4. تنسيقات الأدوات (Tools Styles)
   ========================================= */

/* عملة */
.coin-icon {
    text-shadow: 0 2px 10px rgba(245, 158, 11, 0.6);
    animation: spin-coin 3s infinite ease-in-out;
}
@keyframes spin-coin {
    0%, 100% { transform: rotateY(0deg); }
    50% { transform: rotateY(180deg); }
}

/* مهندس الأوامر */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&display=swap');
.code-font {
    font-family: 'Fira Code', monospace;
    direction: ltr; 
    text-align: left;
}
.prompt-box {
    background: #1e1e1e;
    border-left: 4px solid #f59e0b; 
}
/* تأثير المصفوفة */
.hero-bg.matrix::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(#4b5563 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.1;
}

/* المؤقت */
.animate-pulse-once {
    animation: pulse 0.5s cubic-bezier(0.4, 0, 0.6, 1) 1;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

/* خلفية قسم الأدوات */
.tools-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    position: relative;
    overflow: hidden;
}
.tool-card {
    transition: all 0.3s ease;
}
.tool-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.arcade-bg {
    background-color: #111827;
    background-image: radial-gradient(#374151 1px, transparent 1px);
    background-size: 20px 20px;
}
/* --- تنسيقات لعبة الذاكرة (Memory Game) --- */

.card {
    background-color: transparent;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-radius: 0.75rem;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ظهر البطاقة (قبل القلب) */
.card-front {
    background: #374151; /* Gray-700 */
    color: #f59e0b; /* Amber */
    border: 2px solid #4b5563;
}

/* وجه البطاقة (الأيقونة) */
.card-back {
    background: #1f2937; /* Gray-800 */
    color: white;
    transform: rotateY(180deg);
    border: 2px solid #f59e0b;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

/* البطاقة المتطابقة (نجاح) */
.card.matched .card-back {
    background: #065f46; /* Green-800 */
    border-color: #34d399;
    animation: pulse-green 0.5s;
}

@keyframes pulse-green {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.1); }
    100% { transform: rotateY(180deg) scale(1); }
}

/* --- تنسيقات ألعاب الآركيد (Game Specific) --- */

canvas { 
    display: block; 
    margin: 0 auto; 
    background: linear-gradient(to bottom, #1e293b, #0f172a); 
    border-radius: 1rem; 
    border: 2px solid #d97706; /* Amber-600 */
    box-shadow: 0 0 20px rgba(217, 119, 6, 0.3); 
}

.game-overlay { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    border-radius: 1rem; 
    z-index: 20; 
}
/* --- تنسيقات لعبة اقطع الضوضاء (Whack-a-Mole Style) --- */

.hole {
    position: relative;
    background: #374151; /* Gray-700 */
    border-radius: 1rem;
    overflow: hidden;
    border-bottom: 4px solid #1f2937; /* Depth effect */
    box-shadow: inset 0 10px 20px rgba(0,0,0,0.5);
    cursor: pointer;
}

/* مصدر الضوضاء (الخلد) */
.noise-source {
    position: absolute;
    bottom: -100%; /* مخفي في البداية */
    width: 100%;
    text-align: center;
    font-size: 3rem;
    transition: bottom 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.hole.up .noise-source {
    bottom: 10px; /* يظهر للأعلى */
}

/* تأثير كتم الصوت */
@keyframes mute-pop {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.mute-effect {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    animation: mute-pop 0.3s ease-out forwards;
    pointer-events: none;
}

/* نقطة التسجيل الحمراء */
@keyframes blink-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.recording-dot {
    animation: blink-red 1.5s infinite;
}

/* --- تنسيقات لعبة عجلة كسارة اللسان (Twister Wheel) --- */

.wheel-container {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 0 auto;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid #374151;
    background: conic-gradient(
        #f59e0b 0% 12.5%, #1f2937 12.5% 25%, 
        #f59e0b 25% 37.5%, #1f2937 37.5% 50%, 
        #f59e0b 50% 62.5%, #1f2937 62.5% 75%, 
        #f59e0b 75% 87.5%, #1f2937 87.5% 100%
    );
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99); /* تأثير الاحتكاك */
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; 
    height: 0; 
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 25px solid #ef4444; /* مؤشر أحمر */
    z-index: 10;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
    z-index: 5;
}

/* بطاقة النتيجة */
.result-card {
    transition: all 0.5s ease;
    transform: scale(0.9);
    opacity: 0;
}
.result-card.show {
    transform: scale(1);
    opacity: 1;
}

/* --- تنسيقات منسق النصوص (Text Formatter) --- */

.highlight-number {
    color: #ef4444; /* أحمر */
    font-weight: 900;
    background-color: rgba(239, 68, 68, 0.1);
    padding: 0 2px;
    border-radius: 4px;
    border-bottom: 2px solid #ef4444;
}

.highlight-english {
    color: #3b82f6; /* أزرق */
    font-weight: 900;
    direction: ltr;
    display: inline-block;
    background-color: rgba(59, 130, 246, 0.1);
    padding: 0 2px;
    border-radius: 4px;
}

/* تخصيص شريط التمرير (Scrollbar) */
textarea::-webkit-scrollbar, div::-webkit-scrollbar {
    width: 8px;
}
textarea::-webkit-scrollbar-track, div::-webkit-scrollbar-track {
    background: #1f2937; 
}
textarea::-webkit-scrollbar-thumb, div::-webkit-scrollbar-thumb {
    background: #4b5563; 
    border-radius: 4px;
}
textarea::-webkit-scrollbar-thumb:hover, div::-webkit-scrollbar-thumb:hover {
    background: #f59e0b; 
}

/* --- تنسيقات الملقن الصوتي (Teleprompter) --- */

/* طبقة الشاشة الكاملة السوداء */
#prompterOverlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #000;
    z-index: 1000;
    overflow: hidden;
    display: none; /* مخفي افتراضياً */
}

/* حاوية النص المتحرك */
#prompterContent {
    color: #fff;
    padding: 0 5%;
    line-height: 1.6;
    text-align: center;
    position: absolute; /* يتم التحكم به عبر top */
    width: 100%;
    top: 40%; /* يبدأ من المنتصف تقريباً */
    padding-bottom: 50vh; /* مساحة للسماح بالنص بالخروج للنهاية */
}

/* تأثير المرآة (عكس النص) */
.mirrored {
    transform: scaleX(-1);
}

/* خط التوجيه (الدليل) */
.reading-guide {
    position: absolute;
    top: 40%;
    left: 0;
    width: 100%;
    height: 0;
    border-top: 2px dashed rgba(245, 158, 11, 0.3); /* لون العنبر */
    z-index: 1001;
    pointer-events: none;
    display: none; /* يظهر بالجافاسكربت */
}

/* تخصيص شريط التمرير (Range Slider) */
input[type=range] {
    accent-color: #f59e0b;
}