/* =======================================================
   1. أنماط أساسية وموضوع التصميم الداكن
   ======================================================= */

/* منع قائمة المتصفح الافتراضية وتحديد النصوص */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    outline: none;
    box-sizing: border-box;
}

/* السماح لحقول الإدخال بتحديد النص */
input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* منع قوائم السياق على الصور */
img {
    pointer-events: none;
}

:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-color-primary: #e0e0e0;
    --text-color-secondary: #a0a0a0;
    --accent-color: #e91e63; /* Pinkish-red accent */
    --accent-color-light: rgba(233, 30, 99, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.5);
}

body {
    background: var(--bg-color);
    color: var(--text-color-primary);
    font-family: 'Tajawal', sans-serif;
    text-align: center;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    overscroll-behavior-y: contain;
}

#mainContent {
    flex-grow: 1;
    padding: 20px 15px; /* (تعديل: إزالة الهامش السفلي من هنا) */
    
    /* (إضافة) إضافة مساحات آمنة للأجهزة ذات النتوء (Notch) أو شريط سفلي */
    padding-top: max(20px, env(safe-area-inset-top));

    /* (*** تعديل ***) إضافة مساحة سفلية ضخمة لإفساح المجال للشريط الزجاجي */
    /* 175px (ارتفاع الشريط التقريبي) + 15px (هامش) */
    padding-bottom: calc(190px + env(safe-area-inset-bottom));
    
    z-index: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    transition: opacity 0.3s ease;
    
    /* (*** تحسين الأداء ***) */
    will-change: opacity;
}

#topSection {
    flex-shrink: 0;
}

/* (*** تعديل ***) جعل الشريط السفلي شريطاً زجاجياً ثابتاً */
#bottomSection {
    flex-shrink: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;

    /* (*** تحسين الأداء: إزالة التأثير الزجاجي واستبداله بخلفية ثابتة ***) */
    background: rgba(30, 30, 30, 0.95); /* زيادة العتامة لتعويض غياب الضبابية */
    /* (تم التعطيل) backdrop-filter: blur(15px); */
    /* (تم التعطيل) -webkit-backdrop-filter: blur(15px); */
    
    /* (إضافة) حواف علوية دائرية وحدود مضيئة */
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    
    /* (إضافة) هوامش داخلية ومساحة آمنة للشريط السفلي */
    padding: 15px 15px max(15px, env(safe-area-inset-bottom));
    box-sizing: border-box; 
    
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.3);

    /* (*** تحسين الأداء: استخدام تسريع العتاد (GPU) ***) */
    transform: translateZ(0);
}

/* ═══════════════════════════════════════════════
   طبقة سحب وإفلات الملفات (Drag & Drop Overlay)
   ═══════════════════════════════════════════════ */
.drag-overlay-hidden { display: none !important; }

#drag-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: dragOverlayIn 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
}
@keyframes dragOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.drag-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    animation: dragContentIn 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
}
@keyframes dragContentIn {
    from { transform: scale(0.82) translateY(20px); opacity: 0; }
    to   { transform: scale(1) translateY(0);       opacity: 1; }
}
.drag-icon-wrap {
    width: 110px;
    height: 110px;
    border: 2.5px dashed var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    position: relative;
    z-index: 2;
    animation: dragIconBob 1.4s ease-in-out infinite;
}
@keyframes dragIconBob {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}
.drag-pulse-ring {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    opacity: 0;
    animation: dragPulse 1.8s ease-out infinite;
    pointer-events: none;
}
@keyframes dragPulse {
    0%   { transform: scale(0.75); opacity: 0.7; }
    100% { transform: scale(1.5);  opacity: 0; }
}
.drag-main-text {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}
.drag-types-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.drag-type-badge {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 30px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--text-color-secondary);
    white-space: nowrap;
}
/* تأثير انتقال سلس عند تغير لون الألبوم */
#bar, #playPauseBtn, .icon-btn, .secondary-btn, .main-ctrl-btn,
.highlighted-lyric, .playlist-item, .eq-slider::-webkit-slider-thumb, 
.volume-slider::-webkit-slider-thumb, #defaultIcon {
    transition: background-color 0.6s ease, color 0.6s ease, border-color 0.6s ease, box-shadow 0.6s ease, stroke 0.6s ease !important;
}

/* =======================================================
   2. تصميم حاوية الميديا (صورة الغلاف) - ✨ مُعدلة بالأبعاد الجديدة
   ======================================================= */
#mediaContainer {
    width: 100%;
    max-width: 500px; 
    margin: 15px auto;
    background: var(--surface-color);
    height: auto;
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;

    /* (*** تعديل ***) زيادة نعومة الحواف */
    border-radius: 25px;
    
    overflow: hidden;
    position: relative;
    
    /* (*** تعديل ***) تحسين الظل */
    box-shadow: 0 10px 25px var(--shadow-color);
    
    /* (*** تحسين الأداء: إزالة box-shadow من الانتقالات ***) */
    /* تحريك الظل يسبب إعادة رسم (Repaint) مكلفة. */
    transition: max-width 0.3s ease, border-radius 0.3s ease;

    /* (*** تحسين الأداء: تفعيل تسريع العتاد للحاوية ***) */
    transform: translateZ(0); 
    will-change: transform;

    /*
     * touch-action: pan-y
     * يُخبر المتصفح أن الحركة الأفقية على هذا العنصر يعالجها JavaScript حصراً.
     * هذا يمنع المتصفح من "حجز" السحب الأفقي (خاصةً اليمين) كإيماء تمرير
     * أو إيماء الرجوع للخلف، مما يضمن وصول e.preventDefault() في جميع الأحوال.
     */
    touch-action: pan-y;
}

#mediaContainerIcons {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    z-index: 10;
    transition: opacity 0.3s ease;
    
    /* (*** تحسين الأداء ***) */
    will-change: opacity;
}

.icon-btn {
    background: rgba(30, 30, 30, 0.7);
    border: none;
    color: var(--text-color-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    /* إعادة ضبط تنسيق button الافتراضي */
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    outline: none;
    /* (*** تم الحذف لتحسين الأداء: إزالة التأثير الزجاجي من الأزرار ***) */
    /* backdrop-filter: blur(5px); */ 
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: background 0.2s, opacity 0.3s;
}
.icon-btn:hover { background: var(--surface-color); }
.icon-btn.active { color: var(--accent-color); }


#audioCanvas, #coverArt, #defaultIcon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    border-radius: 0;
    /* (*** تعديل لتحسين الأداء ***) */
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out, filter 0.5s ease-in-out;
    position: absolute;
    top: 0;
    left: 0;
    
    /* (*** تحسين الأداء: تفعيل تسريع العتاد للرسومات ***) */
    transform: translateZ(0);
    image-rendering: optimizeSpeed; /* لتحسين جودة الرسم السريع */
    will-change: opacity, transform, filter;
}

#defaultIcon {
    font-size: 100px;
    color: var(--accent-color);
    display: flex; 
    justify-content: center;
    align-items: center;
    
    /* (*** إضافة ***) تدرج خفيف في الخلفية لجعله أقل سطحية */
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.1) 70%);
}

#lyricsDisplay {
    position: absolute;
    
    /* (*** تعديل ***) جعلها لوحة عائمة داخل الحاوية */
    bottom: 10px; 
    left: 10px; 
    right: 10px;
    
    /* (*** تحسين الأداء: إزالة التأثير الزجاجي ***) */
    background: rgba(40, 40, 40, 0.9); /* خلفية صلبة بدلاً من الزجاج */
    /* (تم التعطيل) backdrop-filter: blur(10px); */
    /* (تم التعطيل) -webkit-backdrop-filter: blur(10px); */
    
    color: var(--text-color-primary); /* ضمان لون النص الأساسي */
    padding: 15px;
    font-size: 16px; 
    display: none; 
    z-index: 5;
    
    /* (*** تحسين الأداء: إزالة ظل النص ***) */
    /* (تم التعطيل) text-shadow: 0 0 8px var(--accent-color); */
    
    transition: opacity 0.3s ease, transform 0.3s ease;
    will-change: transform, opacity;

    line-height: 1.8;
    max-height: 40%;
    overflow-y: auto;
    
    /* (*** تعديل ***) حواف دائرية بالكامل وحدود زجاجية */
    border-radius: 15px; 
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); /* ظل لتعزيز العمق */
}

.highlighted-lyric { color: var(--accent-color); font-weight: bold; }


/* =======================================================
   تنسيق شريط التقدم والوقت (من ملفك القديم)
   ======================================================= */

#progressContainer {
    width: 100%;
    max-width: 380px;
    margin: 15px auto; 
    cursor: pointer;
    position: relative;
    padding: 10px 0; /* (ملاحظة: هذا الهامش من ملفك القديم) */
}

#progress {
    width: 100%; 
    height: 6px; 
    background: var(--surface-color); 
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

/* (يفترض أن كود #bar موجود لديك بالفعل) */
#bar {
    height: 100%; 
    width: 100%; 
    position: absolute; 
    left: 0; 
    top: 0;
    background: var(--accent-color);
    border-radius: 6px;
    transform: translateX(-100%);
    transform-origin: left;
    will-change: transform;
}

#audioCanvas, #coverArt, #defaultIcon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    border-radius: 0;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out, filter 0.5s ease-in-out;
    position: absolute;
    top: 0;
    left: 0;
    transform: translateZ(0);
    image-rendering: auto;
    will-change: opacity, transform, filter;
}
#timeDisplay {
    display: flex;                 /* 1. تفعيل flex لترتيب العدادات أفقياً */
    justify-content: space-between;/* 2. وضع واحد في البداية وواحد في النهاية */
    font-size: 12px;
    color: var(--text-color-secondary);
    margin-top: 8px;               /* 3. وضع مسافة 8px أسفل شريط التقدم */
    padding: 0 5px;
}

#currentTime { 
    color: var(--text-color-primary); 
    font-weight: 500; 
}

/* =======================================================
   4. تصميم عناصر التحكم الجديدة
   ======================================================= */
#controls {
    background: transparent;
    
    /* (*** تعديل ***) إزالة الهامش، #bottomSection يعالجه الآن */
    padding: 0; 
    
    box-shadow: none;
    display: flex;
    flex-direction: column; 
    width: 100%; max-width: 100%;
    position: static;

    /* (*** تعديل ***) تقليل الفجوة قليلاً لتحسين الشكل */
    gap: 15px;
    
    transition: opacity 0.3s ease;
    
    /* (*** تحسين الأداء ***) */
    will-change: opacity;
}

#secondaryControls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
}

.secondary-btn {
    background: none; border: none;
    color: var(--text-color-secondary);
    font-size: 24px; cursor: pointer;
    /* (*** تعديل لتحسين الأداء ***) */
    transition: color 0.3s ease, transform 0.3s ease;
    position: relative;
    
    /* (*** تحسين الأداء ***) */
    will-change: color, transform;
}
.secondary-btn:hover { color: var(--text-color-primary); }
.secondary-btn.active { 
    color: var(--accent-color);
    transform: scale(1.1);
    text-shadow: 0 0 8px var(--accent-color);
}

#randomBtn.active::after {
    content: '';
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background-color: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--accent-color);
}

#mainControls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 10px auto;
}

.main-ctrl-btn {
    background: none; border: none;
    color: var(--text-color-primary);
    font-size: 30px; cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    padding: 10px;
    
    /* (*** تحسين الأداء ***) */
    will-change: color, transform;
}
.main-ctrl-btn:hover { color: var(--accent-color); transform: scale(1.1); }

#playPauseBtn {
    background: var(--accent-color);
    color: #fff;
    width: 70px; height: 70px;
    border-radius: 50%;
    font-size: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 20px rgba(233, 30, 99, 0.4);
    transition: background 0.3s, transform 0.2s;
    
    /* (*** تحسين الأداء ***) */
    will-change: background, transform;
}
#playPauseBtn:hover { transform: scale(1.05); }


/* (تعديل) أنماط التحكم بالصوت - إزالة الاعتماد على hover */
/* =======================================================
   تصميم شريط الصوت (Custom Range Input)
   ======================================================= */
#volumeContainer {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0;
    gap: 10px;
}

.volume-slider {
    -webkit-appearance: none; /* إلغاء التصميم الافتراضي */
    appearance: none;
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1); /* لون الخلفية (الجزء غير الممتلئ) */
    border-radius: 10px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

/* تصميم المقبض (Thumb) لمتصفح Chrome/Safari/Edge */
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--accent-color); /* إطار بلون الثيم */
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    margin-top: 0px; /* ضبط المحاذاة */
    transition: transform 0.2s, box-shadow 0.2s;
}

/* تأثير عند التمرير على مقبض الصوت */
.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px var(--accent-color);
    background: var(--accent-color);
    border-color: #fff;
}

/* تصميم المقبض لمتصفح Firefox */
.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: transform 0.2s, box-shadow 0.2s;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px var(--accent-color);
}


/* =======================================================
   5. أنماط قائمة التشغيل وشاشة المعلومات (Overlay)
   ======================================================= */
.overlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; 
    
    /* (*** تحسين الأداء: إزالة التأثير الزجاجي واستبداله بخلفية ثابتة ***) */
    background: rgba(18, 18, 18, 0.98);
    /* (تم التعطيل) backdrop-filter: blur(10px); */
    /* (تم التعطيل) -webkit-backdrop-filter: blur(10px); */
    
    z-index: 40; padding: 50px 10px 10px 10px; 
    box-sizing: border-box; display: none; flex-direction: column;
    color: var(--text-color-primary);

    /* (*** تعديل ***) تغيير الحركة إلى انزلاق لأعلى وأكثر سلاسة */
    animation: slideUpIn 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    /* (*** إضافة ***) تحسين الأداء (Hardware Acceleration) */
    will-change: transform, opacity;
}

/* (*** حذف ***) @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } */

/* (*** إضافة ***) تعريف الحركة الجديد */
@keyframes slideUpIn {
    from {
        opacity: 0;
        transform: translateY(30px); /* انزلاق من أسفل قليلًا */
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* (*** إضافة ***) تعريف حركة المحتوى الداخلي */
@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.overlay h2 { 
    color: var(--accent-color); margin-bottom: 10px; 
    border-bottom: 1px solid var(--surface-color); padding-bottom: 8px; 
    font-size: 22px;
}

#listMode { 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; 
    overflow: hidden; 

    /* (*** إضافة ***) حركة للمحتوى الداخلي */
    animation: contentFadeIn 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) 0.1s;
    animation-fill-mode: backwards;
    will-change: transform, opacity;
}

#searchInput {
    width: 100%; max-width: 400px; padding: 12px; margin-bottom: 15px; 
    border-radius: 10px; border: 1px solid var(--surface-color); background: #2a2a2a; 
    color: var(--text-color-primary); font-size: 16px; align-self: center;
    box-shadow: 0 2px 10px var(--shadow-color);
}
#searchInput:focus { 
    border-color: var(--accent-color); 
    outline: 2px solid var(--accent-color-light); 
}

#sortControlsGroup {
     display: flex; justify-content: space-between; gap: 10px; width: 100%; max-width: 400px; margin-bottom: 15px; align-self: center;
}
#sortButton {
    padding: 10px 15px; border-radius: 10px; border: none; background: var(--surface-color); color: var(--accent-color); 
    font-weight: bold; cursor: pointer; font-size: 14px;
    box-shadow: 0 2px 8px var(--shadow-color);
    flex-grow: 1; transition: background 0.2s;
}
#sortButton:hover { background: #333; }
#sortModeDisplay { color: var(--text-color-secondary); font-size: 12px; align-self: center; flex-shrink: 0; text-align: left; line-height: 1.2; }

#playlist {
    list-style: none; padding: 0; margin: 0; flex-grow: 1; overflow-y: auto; 
    font-size: 15px; padding-right: 5px;
    
    /* (*** تحسين الأداء: عزل التمرير ***) */
    /* نخبر المتصفح أن محتوى هذه القائمة لا يؤثر على ما خارجها */
    contain: strict;
}

.playlist-item {
    padding: 12px 15px; margin-bottom: 8px; background: var(--surface-color); border-radius: 12px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    
    /* (*** تحسين الأداء: إزالة الظل من كل عنصر ***) */
    /* وجود ظل على كل عنصر في قائمة طويلة يبطئ التمرير بشدة */
    /* (تم التعطيل) box-shadow: 0 2px 5px var(--shadow-color); */
    
    /* (*** إضافة: بديل للظل ***) */
    /* استخدام حد سفلي خفيف للفصل بين العناصر */
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    
    transition: background 0.2s, color 0.2s; border-left: 4px solid transparent; 
    display: flex; justify-content: space-between; align-items: center;
}
.playlist-item-name {
     flex-grow: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
     padding-right: 10px; cursor: pointer; font-weight: 500;
}
.queue-btn {
    background: #333; color: var(--text-color-secondary); border: none;
    padding: 5px 10px; border-radius: 8px;
    font-weight: bold; font-size: 12px; cursor: pointer;
    flex-shrink: 0; transition: background 0.2s, transform 0.1s;
}
.queue-btn:hover { background: #444; }
.playlist-item.active {
    background: var(--accent-color-light);
    color: var(--accent-color); font-weight: bold;
    border-left: 4px solid var(--accent-color);
}
.playlist-item.queued { background: rgba(255, 170, 0, 0.2); border-left: 4px solid #ffaa00; }
.close-overlay-btn {
    margin-top: 15px; width: 100%; max-width: 380px; align-self: center; background: var(--accent-color);
    color: #fff; padding: 12px; border: none; border-radius: 12px; font-size: 16px;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3); cursor: pointer;
}

#infoContent {
    margin: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;

    /* (*** إضافة ***) حركة للمحتوى الداخلي */
    animation: contentFadeIn 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) 0.1s;
    animation-fill-mode: backwards;
    will-change: transform, opacity;
}
#infoContent p {
    font-size: 18px;
    line-height: 2.2;
    color: var(--text-color-primary);
    margin: 5px 0;
}
#infoContent p strong {
    color: var(--text-color-secondary);
    margin-left: 10px;
    min-width: 100px;
    display: inline-block;
    text-align: right;
}

/* =======================================================
   تنسيق رأس القائمة المدمج (العنوان + الأزرار)
   ======================================================= */

.playlist-header-row {
    display: flex;
    justify-content: space-between; /* توزيع المسافة: العنوان يمين والأزرار يسار */
    align-items: center;
    width: 100%;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--surface-color); /* الخط الفاصل أسفل العنوان */
}

/* تعديل العنوان ليتناسب مع الصف الجديد */
#listTitle {
    margin: 0;
    border: none;
    padding: 0;
    font-size: 22px;
}

/* حاوية الأزرار */
.header-actions {
    display: flex;
    gap: 8px; /* مسافة بين الأزرار */
}

/* تنسيق الأزرار الجديدة (شفافة وأنيقة) */
.header-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-color-secondary); /* لون رمادي افتراضي */
    width: 40px;
    height: 40px;
    border-radius: 50%; /* شكل دائري عند الضغط */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-icon-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    transition: stroke 0.2s;
}

/* تأثير التحويم (Hover) - إضاءة الزر */
.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color-primary);
    transform: scale(1.1);
}

/* تخصيص زر المسح (عند التحويم يصبح أحمر) */
.header-icon-btn.danger:hover {
    background: rgba(244, 67, 54, 0.15);
    color: #ff5252;
}

/* تحسين الاستجابة على الشاشات الصغيرة */
@media (max-width: 380px) {
    #listTitle {
        font-size: 18px;
    }
    .header-icon-btn {
        width: 35px;
        height: 35px;
    }
}

/* =======================================================
   6. (إضافة جديدة) أنماط الإشعارات المخصصة (Toast) - ✨ مُعدلة للأعلى
   ======================================================= */
#notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 90%;
    max-width: 500px;
    pointer-events: none;
}

.toast {
    background-color: var(--surface-color);
    color: var(--text-color-primary);
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--shadow-color);
    border-left: 5px solid var(--text-color-secondary);
    font-size: 15px;
    opacity: 0;
    transform: translateY(-150%);
    
    /* (*** تحسين الأداء: تجنب transition: all ***) */
    /* تحديد الخصائص التي ستتحرك فقط (transform و opacity) */
    transition: opacity 0.4s cubic-bezier(0.215, 0.610, 0.355, 1), 
                transform 0.4s cubic-bezier(0.215, 0.610, 0.355, 1);
    
    pointer-events: auto;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    
    /* (*** تحسين الأداء ***) */
    will-change: opacity, transform;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.info {
    border-left-color: #2196F3;
}
.toast.success {
    border-left-color: #4CAF50;
}
.toast.error {
    border-left-color: #f44336;
}

@media (max-width: 600px) {
    #notification-container {
        left: 10px;
        right: 10px;
        top: 10px;
        width: auto;
        transform: none;
        align-items: center;
    }
    .toast {
        width: 100%;
        text-align: center;
    }
}

/* =======================================================
   7. أنماط الهواتف (Responsive)
   ======================================================= */
@media (max-width: 600px) {
    /* تصغير الهوامش الرئيسية لملء الشاشة */
    #mainContent {
        padding: 10px 15px; /* (*** تعديل ***) إزالة الهامش السفلي من هنا */
        
        /* إزالة المسافة الكبيرة بين الأقسام */
        justify-content: flex-start; 
        gap: 15px; 
        overflow-y: auto; /* السماح بالتمرير إذا ضاقت الشاشة جداً */
        
        /* (*** تحسين الأداء: عزل التمرير ***) */
        /* نفس مبدأ قائمة التشغيل، نحسن أداء التمرير للمحتوى الرئيسي */
        contain: paint;
        
        /* (تعديل) التأكد من تطبيق المساحات الآمنة هنا أيضاً */
        padding-top: max(10px, env(safe-area-inset-top));
        
        /* (*** تعديل ***) إضافة مساحة سفلية ضخمة لإفساح المجال للشريط الزجاجي */
        /* 160px (ارتفاع الشريط التقريبي على الهاتف) + 10px (هامش) */
        padding-bottom: calc(170px + env(safe-area-inset-bottom));
    }

    #mediaContainer {
        margin-top: 5px; /* تقليل الهامش العلوي */
        margin-bottom: 5px;
    }

   /* حاوية المعلومات الكلية */
   /* حاوية المعلومات الكلية */
#trackInfo {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* تنظيم اسم الفنان تحت اسم الأغنية في المنتصف */
    justify-content: center;
    overflow: hidden;
    padding: 15px 0;
}

/* تنسيق الحاويات الفردية للنص */
.scroll-container {
    width: 90%; 
    overflow: hidden;
    position: relative;
    white-space: nowrap;
    text-align: center; /* (تعديل) إجبار النص على التوسيط */
    /* السر: تلاشي النص عند الأطراف يميناً ويساراً */
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    margin-bottom: 8px;
}

#trackTitle, #trackArtist {
    display: inline-block;
    padding-left: 0; /* (تعديل) إزالة المسافة التي كانت تكسر التوسيط */
    will-change: transform;
}

#trackArtist {
    font-size: 15px; /* (تعديل) إعادة الحجم كما في الكود القديم */
    opacity: 0.8; 
    margin-top: 4px;
}

/* حركات الدوران */
@keyframes loop-ltr {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes loop-rtl {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

/* تنسيق الحركة الفعالة */
.marquee-active {
    /* ease-in-out يجعل الحركة تبطئ عند الأطراف لتعطي وقتاً للقراءة */
    animation: ping-pong var(--marquee-duration) ease-in-out infinite alternate !important;
    
    /* تفعيل تسريع كارت الشاشة (GPU) لمنع التقطيع */
    will-change: transform;
    transform: translateZ(0);
}

/* حركة الذهاب والعودة الموحدة (تدعم العربي والإنجليزي معاً بفضل الجافاسكريبت) */
@keyframes ping-pong {
    /* الانتظار قليلاً في البداية (من 0% إلى 10%) للسماح للمستخدم بقراءة بداية الكلمة */
    0%, 10% { 
        transform: translate3d(var(--start-x), 0, 0); 
    }
    /* الانتظار قليلاً في النهاية (من 90% إلى 100%) */
    90%, 100% { 
        transform: translate3d(var(--end-x), 0, 0); 
    }
}

    #progressContainer {
        margin: 5px auto;
    }

    /* إخفاء شريط الصوت على الهواتف (الاعتماد على أزرار الجهاز) */
    #volumeContainer {
        display: none;
    }
    
    /* جعل الأزرار تملأ المساحة المتاحة بشكل أفضل */
    #secondaryControls {
        max-width: 100%;
        justify-content: space-between; /* توزيع الأزرار على كامل العرض */
        padding: 0 10px; /* إضافة هوامش جانبية */
        box-sizing: border-box;
    }

    /* تكبير أهداف اللمس للأزرار */
    .secondary-btn {
        font-size: 26px; /* أكبر قليلاً */
    }

    #controls {
        gap: 15px; /* تقليل المسافة بين مجموعتي الأزرار */
        padding: 0;
    }
    
    #mainControls {
        gap: 25px; /* تقريب الأزرار الرئيسية */
    }
    
    .main-ctrl-btn {
        font-size: 36px; /* تكبير أزرار السابق/التالي */
    }
    
    #playPauseBtn {
        width: 70px; /* الحفاظ على الحجم الكبير */
        height: 70px;
    }
}

/* =======================================================
   8. (*** تعديل ***) أنماط المعادل الصوتي الاحترافي
   ======================================================= */
/* ══════════════════════════════════════════════════════
   EQ MODE — تصميم جديد كلياً
   ══════════════════════════════════════════════════════ */
#eqMode {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px 16px;
    width: 100%;
    max-width: 500px;
    /* تغيير من margin: auto إلى margin: 0 auto لمنع التوسيط الرأسي */
    margin: 0 auto;
    gap: 12px;
    animation: contentFadeIn 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) 0.1s;
    animation-fill-mode: backwards;
    will-change: transform, opacity;
}

/* ── قسم الإعدادات المسبقة ─────────────────────────── */
.custom-dropdown {
    position: relative;
    width: 100%;
    font-family: 'Tajawal', sans-serif;
    z-index: 100;
}

.dropdown-header {
    padding: 11px 16px;
    border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.08);
    background: linear-gradient(135deg, #252535 0%, #1e1e2e 100%);
    color: var(--text-color-primary);
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.22s, box-shadow 0.22s;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    user-select: none;
}

.dropdown-header:active { transform: scale(0.985); }

.dropdown-header.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 18px rgba(233,30,99,0.22);
}

.dropdown-arrow {
    width: 18px; height: 18px;
    stroke: var(--text-color-secondary);
    stroke-width: 2.2;
    fill: none;
    transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), stroke 0.2s;
    flex-shrink: 0;
}

.dropdown-header.active .dropdown-arrow {
    transform: rotate(180deg);
    stroke: var(--accent-color);
}

.dropdown-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: #1a1a28;
    border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.09);
    box-shadow: 0 16px 48px rgba(0,0,0,0.7);
    list-style: none;
    padding: 6px 0;
    margin: 0;
    max-height: 220px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scaleY(0.96);
    transform-origin: top center;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.25,0.8,0.25,1), visibility 0.2s;
    will-change: opacity, transform;
}

.dropdown-list.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scaleY(1);
}

.dropdown-item {
    padding: 10px 18px;
    color: var(--text-color-primary);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    border-right: 3px solid transparent;
}

.dropdown-item:hover { background: rgba(255,255,255,0.05); }

.dropdown-item.selected {
    background: var(--accent-color-light);
    color: var(--accent-color);
    font-weight: 700;
    border-right: 3px solid var(--accent-color);
}

.dropdown-list::-webkit-scrollbar { width: 4px; }
.dropdown-list::-webkit-scrollbar-track { background: transparent; }
.dropdown-list::-webkit-scrollbar-thumb { background: #444; border-radius: 10px; }

/* ── حاوية الشرائط الرئيسية ─────────────────────────── */
#eqContainer {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    gap: 4px;
    padding: 16px 12px 12px;
    background: linear-gradient(180deg, #161622 0%, #1a1a2a 100%);
    border-radius: 18px;
    border: 1.5px solid rgba(255,255,255,0.06);
    box-shadow: inset 0 2px 12px rgba(0,0,0,0.4);
    height: 240px;
    overflow-x: auto;
    contain: paint;
    position: relative;
}

/* خط مرجعي عند 0dB */
#eqContainer::after {
    content: '';
    position: absolute;
    left: 12px; right: 12px;
    top: 50%;
    height: 1px;
    background: rgba(255,255,255,0.08);
    pointer-events: none;
    border-radius: 1px;
}

/* ── شريط تردد واحد ─────────────────────────────────── */
.eq-band {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: space-between;
    gap: 4px;
    flex-grow: 1;
    min-width: 38px;
    position: relative;
}

/* قيمة dB فوق الشريط */
.eq-band::before {
    content: attr(data-db);
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.3px;
    line-height: 1;
    min-height: 12px;
    text-align: center;
}

/* فاصل بصري للـ Preamp */
#preamp-band {
    border-right: 1px solid rgba(255,255,255,0.08);
    padding-right: 8px;
    margin-right: 4px;
}

.eq-band label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    white-space: nowrap;
    letter-spacing: 0.2px;
    padding-bottom: 2px;
}

/* ── الشريط العمودي ──────────────────────────────────── */
.eq-slider {
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    outline: none;
    cursor: pointer;
    border-radius: 6px;

    /* الشريط نفسه — يُلوَّن ديناميكياً من JS */
    width: 6px;
    flex: 1;

    /* لون أساسي للمسار */
    background: linear-gradient(
        to top,
        var(--eq-fill, rgba(233,30,99,0.6)) var(--eq-pct, 50%),
        rgba(255,255,255,0.07) var(--eq-pct, 50%)
    );

    transition: background 0.1s;
}

/* ── المقبض (Thumb) ──────────────────────────────────── */
.eq-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--eq-thumb, #e91e63);
    border: 2.5px solid #0d0d1a;
    box-shadow: 0 0 8px var(--eq-glow, rgba(233,30,99,0.55)),
                0 2px 6px rgba(0,0,0,0.6);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}

.eq-slider::-webkit-slider-thumb:active {
    transform: scale(1.2);
    box-shadow: 0 0 16px var(--eq-glow, rgba(233,30,99,0.8)),
                0 2px 8px rgba(0,0,0,0.7);
}

.eq-slider::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--eq-thumb, #e91e63);
    border: 2.5px solid #0d0d1a;
    box-shadow: 0 0 8px var(--eq-glow, rgba(233,30,99,0.55));
    cursor: pointer;
    transition: transform 0.12s;
}

/* ── Preamp thumb — أزرق مميز ──────────────────────── */
#preampSlider {
    --eq-fill: rgba(33,150,243,0.7);
    --eq-thumb: #2196F3;
    --eq-glow: rgba(33,150,243,0.5);
}

/* (*** إضافة: أنماط لشريط التمرير ***) */
/* تخصيص شريط التمرير في قائمة التشغيل ليتناسب مع التصميم الداكن */
#playlist::-webkit-scrollbar {
    width: 8px;
}
#playlist::-webkit-scrollbar-track {
    background: transparent;
    margin: 10px 0;
}
#playlist::-webkit-scrollbar-thumb {
    background-color: var(--surface-color);
    border-radius: 10px;
    border: 2px solid var(--bg-color);
}
#playlist::-webkit-scrollbar-thumb:hover {
    background-color: #333;
}


/* =======================================================
   ... (الأقسام 1 إلى 8 كما هي بدون تغيير) ...
   ======================================================= */

/* =======================================================
   9. (*** تعديل ***) وضع ملء الشاشة المحاكى (عبر :target)
   ======================================================= */

/* (*** إضافة ***) تنسيقات لمجموعات الأزرار الجديدة */
#mediaContainerIcons {
    align-items: center; /* لضمان محاذاة المجموعتين */
}
#mediaIconGroupLeft, #mediaIconGroupRight {
    display: flex;
    gap: 10px; /* مسافة بين الأزرار في كل مجموعة */
}

/* (*** إضافة ***) تنسيق أيقونات SVG الجديدة */
.icon-btn svg {
    stroke: var(--text-color-primary); /* اللون الافتراضي للأيقونة */
    transition: stroke 0.2s;
    vertical-align: middle; /* لمحاذاة الأيقونة وسط الزر */
}
.icon-btn:hover svg {
    stroke: var(--accent-color); /* تغيير اللون عند التمرير */
}


/* =======================================================
   وضع ملء الشاشة — يدعم ثلاث طرق:
   1. .fullscreen-active  (JavaScript class — الطريقة الرئيسية)
   2. :fullscreen         (Fullscreen API pseudo-class — حديث)
   3. :target             (CSS fallback — قديم)
   ======================================================= */

/* ── الحاوية الرئيسية — متجاوبة مع جميع أحجام الشاشات ── */
#mediaContainer.fullscreen-active,
#mediaContainer:fullscreen,
#mediaContainer:-webkit-full-screen,
#mediaContainer:-moz-full-screen,
#mediaContainer:-ms-fullscreen,
#mediaContainer:target {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    /* dvh للدعم الحديث، fallback لـ svh ثم vh للقديم */
    height: 100dvh;
    height: 100svh;
    height: 100vh;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
             env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
    border-radius: 0;
    aspect-ratio: auto;
    z-index: 2000;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-sizing: border-box;
    /* انتقال سلس عند الدخول */
    animation: fsEnter 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    transform: translateZ(0);
    will-change: transform;
}

@keyframes fsEnter {
    from { opacity: 0.7; transform: scale(0.98) translateZ(0); }
    to   { opacity: 1;   transform: scale(1)    translateZ(0); }
}

/* ── الصورة والـ Canvas — تتكيف مع أي حجم شاشة ── */
#mediaContainer.fullscreen-active #coverArt,
#mediaContainer.fullscreen-active #audioCanvas,
#mediaContainer.fullscreen-active #defaultIcon,
#mediaContainer:fullscreen #coverArt,
#mediaContainer:fullscreen #audioCanvas,
#mediaContainer:fullscreen #defaultIcon,
#mediaContainer:-webkit-full-screen #coverArt,
#mediaContainer:-webkit-full-screen #audioCanvas,
#mediaContainer:-webkit-full-screen #defaultIcon,
#mediaContainer:-moz-full-screen #coverArt,
#mediaContainer:-moz-full-screen #audioCanvas,
#mediaContainer:-moz-full-screen #defaultIcon,
#mediaContainer:target #coverArt,
#mediaContainer:target #audioCanvas,
#mediaContainer:target #defaultIcon {
    /* نستخدم max بدلاً من fixed لضمان الملاءمة في أي حجم شاشة */
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain;
    flex-shrink: 1;
}

/* Canvas يحتاج معالجة خاصة — يملأ الحاوية بنسبة صحيحة */
#mediaContainer.fullscreen-active #audioCanvas,
#mediaContainer:fullscreen #audioCanvas,
#mediaContainer:-webkit-full-screen #audioCanvas,
#mediaContainer:-moz-full-screen #audioCanvas,
#mediaContainer:target #audioCanvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
}

/* أيقونة الافتراضي */
#mediaContainer.fullscreen-active #defaultIcon,
#mediaContainer:fullscreen #defaultIcon,
#mediaContainer:-webkit-full-screen #defaultIcon,
#mediaContainer:target #defaultIcon {
    font-size: clamp(60px, 15vmin, 120px) !important;
    width: auto !important;
    height: auto !important;
}

/* ── شريط الأيقونات: انتقال ناعم للإخفاء ── */
#mediaContainerIcons {
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
#mediaContainerIcons.icons-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── كلمات الأغاني في ملء الشاشة — (انظر قواعد v11 في نهاية الملف) ── */
/* تم نقل التنسيقات إلى قسم v11 في نهاية الملف لدعم جميع البادئات */

/* ── أزرار ملء الشاشة ── */

/* إخفاء زر الخروج افتراضياً */
#fullscreen-exit-btn {
    display: none;
}

/* زر الخروج: يظهر في الزاوية العلوية اليمنى */
#mediaContainer.fullscreen-active #fullscreen-exit-btn,
#mediaContainer:fullscreen #fullscreen-exit-btn,
#mediaContainer:-webkit-full-screen #fullscreen-exit-btn,
#mediaContainer:target #fullscreen-exit-btn {
    display: flex;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 2020;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    padding: 8px;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}
#mediaContainer.fullscreen-active #fullscreen-exit-btn:hover,
#mediaContainer:fullscreen #fullscreen-exit-btn:hover,
#mediaContainer:target #fullscreen-exit-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* إخفاء مجموعات الأزرار العادية في ملء الشاشة */
#mediaContainer.fullscreen-active #mediaIconGroupLeft,
#mediaContainer.fullscreen-active #mediaIconGroupRight,
#mediaContainer:fullscreen #mediaIconGroupLeft,
#mediaContainer:fullscreen #mediaIconGroupRight,
#mediaContainer:-webkit-full-screen #mediaIconGroupLeft,
#mediaContainer:-webkit-full-screen #mediaIconGroupRight,
#mediaContainer:target #mediaIconGroupLeft,
#mediaContainer:target #mediaIconGroupRight {
    display: none;
}


/* =======================================================
   10. (*** إضافة جديدة ***) الوضع الأفقي للهواتف
   ======================================================= */
@media (orientation: landscape) and (max-height: 600px) {

    #mainContent {
        flex-direction: row; 
        justify-content: center;
        align-items: center;
        gap: 20px;
        padding: 20px; 
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        padding-top: max(20px, env(safe-area-inset-top));
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        overflow-y: hidden; 
    }

    #topSection {
        flex-grow: 1; 
        flex-basis: 0; 
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        height: 100%; 
        /* --- تعديل: منع دفع العناصر --- */
        min-width: 0; 
        overflow: hidden;
        /* ---------------------------- */
    }

    #mediaContainer {
        width: auto;
        height: calc(100vh - 180px); 
        max-height: 400px; 
        max-width: none;
        margin: 0;
    }
    
    #trackInfo {
        margin-top: 15px;
        margin-bottom: 0;
        /* --- تعديل: تقييد العرض --- */
        width: 100%;
        max-width: 300px;
        /* ----------------------- */
    }

    #bottomSection {
        position: relative; 
        flex-grow: 1.2; 
        flex-basis: 0;
        height: auto; 
        bottom: auto;
        left: auto;
        right: auto;
        border-radius: 20px; 
        box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
        border-top: none;
        padding: 20px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 20px;
    }

    #progressContainer {
        margin: 0 auto; 
        width: 90%;
    }

    #controls {
        gap: 25px; 
        padding: 0;
    }
}
/* =======================================================
   تحديث: تنسيق أيقونات SVG
   ======================================================= */

/* إزالة الاعتماد على حجم الخط للأيقونات واستخدام الأبعاد */
.secondary-btn, .main-ctrl-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    line-height: 0; /* لمنع مسافات إضافية */
}

/* تنسيق عام لجميع أيقونات SVG داخل الأزرار */
.secondary-btn svg, 
.main-ctrl-btn svg,
#volumeContainer svg {
    width: 24px;
    height: 24px;
    stroke: currentColor; /* يرث لون النص المحدد في الزر */
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.3s ease, transform 0.2s ease;
}

/* تكبير أيقونات التحكم الرئيسية قليلاً */
.main-ctrl-btn svg {
    width: 32px;
    height: 32px;
}

/* تكبير أيقونة التشغيل تحديداً */
#playPauseBtn svg {
    width: 36px;
    height: 36px;
    fill: white; /* تعبئة أيقونة التشغيل باللون الأبيض */
    stroke: white;
}

/* تأثير عند التحويم */
.secondary-btn:hover svg, 
.main-ctrl-btn:hover svg {
    stroke: var(--accent-color);
}

#playPauseBtn:hover svg {
    stroke: #eee;
}

/* إصلاح زر الصوت */
#volumeBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

/* =======================================================
   تحديث: تنسيق الكلمات غير المتزامنة (Static Lyrics)
   ======================================================= */

/* كلاس سيتم إضافته للجافاسكريبت عند اكتشاف كلمات بدون توقيت */
.static-lyrics-content {
    display: block;
    width: 100%;
    height: 100%;
    overflow-y: auto; /* السماح بالتمرير */
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
    
    /* تحسين شكل شريط التمرير */
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

.static-lyrics-content p {
    margin: 10px 0;
    font-size: 18px;
    color: var(--text-color-primary);
    opacity: 0.8;
    line-height: 1.8;
    transition: color 0.3s;
}

.static-lyrics-content p:hover {
    color: #fff;
    opacity: 1;
}

/* في وضع ملء الشاشة، نحتاج لتنسيق مختلف قليلاً */
#mediaContainer.fullscreen-active .static-lyrics-content,
#mediaContainer:fullscreen .static-lyrics-content,
#mediaContainer:-webkit-full-screen .static-lyrics-content,
#mediaContainer:target .static-lyrics-content {
    font-size: 24px;
    line-height: 2;
    padding: 20px;
}

/* =======================================================
   11. قائمة السياق (Context Menu) عند الضغط المطول
   ======================================================= */

.context-menu {
    position: fixed;
    background: var(--surface-color);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: none;
    width: 280px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUpIn 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* (*** تحسين الأداء: تعطيل التمويه الثقيل ***) */
    /* backdrop-filter: blur(20px); */
    /* -webkit-backdrop-filter: blur(20px); */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.context-menu.show {
    display: block;
}

.context-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(233, 30, 99, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#contextMenuTitle {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 16px;
}

.context-close-btn {
    background: transparent;
    border: none;
    color: var(--text-color-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.context-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color-primary);
}

.context-menu-list {
    list-style: none;
    margin: 0;
    padding: 10px 0;
    max-height: 400px;
    overflow-y: auto;
}

.context-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--text-color-primary);
    cursor: pointer;
    transition: all 0.2s;
    gap: 15px;
    border-left: 3px solid transparent;

    /* === أضف هذين السطرين === */
    position: relative; /* لضمان عمل الـ z-index */
    z-index: 10;        /* لرفع الأزرار فوق الخلفية الضبابية */
}

.context-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--accent-color);
}

.context-item:active {
    background: rgba(233, 30, 99, 0.1);
    transform: scale(0.98);
}

.context-icon {
    font-size: 20px;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.context-text {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
}

.context-item[data-action="delete"] .context-icon {
    color: #ff5252;
}

.context-item[data-action="play"] .context-icon {
    color: #4CAF50;
}

.context-item[data-action="playNext"] .context-icon {
    color: #2196F3;
}

/* تأثير عند الضغط المطول على عنصر في القائمة */
.playlist-item.long-press {
    animation: pulse 0.5s ease;
    background: var(--accent-color-light) !important;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

/* الظل الخلفي لقائمة السياق */
#contextMenu::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    /* (*** تحسين الأداء: تعطيل التمويه الثقيل ***) */
    /* backdrop-filter: blur(3px); */
    /* -webkit-backdrop-filter: blur(3px); */
}

/* تحسينات للشاشات الصغيرة */
@media (max-width: 600px) {
    .context-menu {
        width: 90%;
        max-width: 300px;
        border-radius: 12px;
    }
    
    .context-item {
        padding: 12px 16px;
    }
}

/* شريط تمرير أنيق لقائمة السياق */
.context-menu-list::-webkit-scrollbar {
    width: 6px;
}

.context-menu-list::-webkit-scrollbar-track {
    background: transparent;
}

.context-menu-list::-webkit-scrollbar-thumb {
    background: var(--surface-color);
    border-radius: 10px;
}

.context-menu-list::-webkit-scrollbar-thumb:hover {
    background: #333;
}
/* --- Sleep Timer Elegant Design --- */
.sleep-timer-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 20px;
    margin: 15px 0;
    font-family: 'Tajawal', sans-serif;
}

.timer-header-main {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--accent-color);
    font-weight: 700;
}

.timer-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.t-chip {
    background: var(--surface-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color-primary);
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 14px;
}

.t-chip:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
}

.custom-t-field {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 6px;
    margin-top: 5px;
}

.custom-t-field input {
    flex: 1;
    min-width: 0;
    background: #000;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 10px 8px;
    color: #fff;
    outline: none;
    text-align: center;
    font-size: 15px;
}

.custom-t-field input:focus {
    border-color: var(--accent-color);
}

/* الفاصل الثانوي بين الساعات والدقائق */
.timer-sep {
    color: rgba(255,255,255,0.4);
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.t-chip-start {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0 20px;
    cursor: pointer;
}

/* حالة العداد النشط */
.timer-countdown-view {
    text-align: center;
    padding: 10px 0;
    animation: fadeIn 0.4s ease;
}

/* حاوية دائرة التقدم SVG */
.timer-circle-ui {
    position: relative;
    width: 130px;
    height: 130px;
    margin: 0 auto 18px;
}

.timer-progress-svg {
    width: 130px;
    height: 130px;
    transform: rotate(-90deg); /* نبدأ من الأعلى */
}

/* مسار الخلفية (الدائرة الرمادية) */
.timer-track-circle {
    fill: none;
    stroke: rgba(255,255,255,0.08);
    stroke-width: 6;
}

/* قوس التقدم المتحرك */
.timer-arc-circle {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 326.73; /* 2 × π × 52 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.9s linear;
    filter: drop-shadow(0 0 6px var(--accent-color));
}

/* المحتوى في وسط الدائرة */
.timer-center-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

#remainingTime {
    font-size: clamp(16px, 5vw, 24px);
    font-weight: 800;
    color: #fff;
    z-index: 2;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
    letter-spacing: 1px;
}

.timer-label-small {
    font-size: 11px;
    color: var(--text-color-secondary);
}

.timer-status-text {
    font-size: 12px;
    color: var(--text-color-secondary);
    margin-bottom: 15px;
}

.timer-stop-btn {
    background: transparent;
    color: #ff5252;
    border: 1px solid #ff5252;
    padding: 8px 24px;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 14px;
}

.timer-stop-btn:hover {
    background: rgba(255, 82, 82, 0.12);
    transform: scale(1.03);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
/* =======================================================
   تنسيق شبكة اختيار المؤثرات البصرية
   ======================================================= */
.vis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    padding: 10px 5px 20px 5px;
    overflow-y: auto;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-color) transparent;
}

.vis-grid::-webkit-scrollbar { width: 6px; }
.vis-grid::-webkit-scrollbar-thumb { background-color: var(--surface-color); border-radius: 10px; }

.vis-option-btn {
    background: var(--surface-color);
    color: var(--text-color-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    padding: 15px 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vis-option-btn:hover {
    background: #2a2a2a;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

.vis-option-btn.active {
    background: var(--accent-color-light);
    border-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: bold;
    box-shadow: 0 0 15px rgba(233, 30, 99, 0.2);
    transform: scale(1.02);
}

.vis-icon-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--surface-color);
    border: 2px solid currentColor;
    opacity: 0.7;
}
.vis-option-btn.active .vis-icon-indicator {
    background: var(--accent-color);
    opacity: 1;
}
/* تنسيقات صندوق معلومات الأغنية */
.details-box {
    background: var(--surface-color);
    padding: 20px;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    text-align: right;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 0;
    font-size: 15px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-color-secondary);
}

.detail-value {
    color: var(--text-color-primary);
    font-weight: bold;
    max-width: 60%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: ltr; /* لضمان عرض الأسماء الإنجليزية بشكل صحيح */
}

/* تنسيقات نافذة تأكيد الحذف المخصصة */
.confirm-modal-overlay {
    z-index: 10000; /* أعلى من كل شيء */
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    padding: 20px;
}

.confirm-modal-box {
    background: var(--surface-color);
    padding: 30px 20px;
    border-radius: 20px;
    text-align: center;
    max-width: 350px;
    width: 100%;
    border: 1px solid rgba(244, 67, 54, 0.3);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.confirm-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.confirm-modal-box h3 {
    color: white;
    margin-bottom: 25px;
    font-size: 18px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-btn {
    flex: 1;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.2s;
}

.danger-btn {
    background: rgba(244, 67, 54, 0.15);
    color: #ff5252;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.danger-btn:hover {
    background: #ff5252;
    color: white;
}

.cancel-btn {
    background: #333;
    color: white;
}

.cancel-btn:hover {
    background: #444;
}

/* تنسيقات حقول إدخال وتعديل معلومات الأغنية */
.detail-input {
    flex: 1;
    max-width: 60%;
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-color-primary);
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    text-align: right;
    direction: auto;
    transition: all 0.3s ease;
}

.detail-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color-light);
    outline: none;
    background: #1a1a1a;
}
/* =======================================================
   ميزة الإيماء على غلاف الأغنية (Swipe Cover Gestures)
   تصميم: تأثيرات GPU فقط (transform + opacity) لأداء مثالي
   ======================================================= */

/* ── مؤشرات الاتجاه (السابق / التالي) ── */
.swipe-dir-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    /* زجاج ناعم خفيف - لا يثقل على الهاتف */
    background: rgba(10, 10, 10, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0;          /* مخفي افتراضياً */
    pointer-events: none; /* لا يعيق اللمس */
    z-index: 8;
    /* انتقال ناعم جداً لظهور المؤشر */
    transition: opacity 0.08s linear;
    will-change: opacity;
}

.swipe-dir-prev { left: 12px; }
.swipe-dir-next { right: 12px; }

/* ── شريط الضوء الخاطف (يعبر الشاشة عند تأكيد الإيماء) ── */
.swipe-light-beam {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    pointer-events: none;
    z-index: 9;
    /* لا حدود، فقط تدرج ضوء خفيف */
    animation-duration: 0.42s;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
    will-change: transform, opacity;
}

/* الشريط يأتي من اليسار (للانتقال للأمام) */
.swipe-beam-fwd {
    left: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.13), transparent);
    animation-name: beamSweepFwd;
}

/* الشريط يأتي من اليمين (للانتقال للخلف) */
.swipe-beam-back {
    right: 0;
    background: linear-gradient(270deg, rgba(255,255,255,0.13), transparent);
    animation-name: beamSweepBack;
}

@keyframes beamSweepFwd {
    0%   { transform: translateX(-100%); opacity: 0; }
    25%  { opacity: 1; }
    100% { transform: translateX(280%);  opacity: 0; }
}

@keyframes beamSweepBack {
    0%   { transform: translateX(100%);  opacity: 0; }
    25%  { opacity: 1; }
    100% { transform: translateX(-280%); opacity: 0; }
}

/* ── تموج دائري في المركز عند تأكيد الإيماء ── */
.swipe-center-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    pointer-events: none;
    z-index: 7;
    transform: translate(-50%, -50%) scale(0);
    animation: rippleExpand 0.45s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes rippleExpand {
    0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(3.2); opacity: 0;   }
}




/* ════════════════════════════════════════════════════════════
   البرنامج التعليمي — نسخة v3 المحسّنة بالكامل
   جميع الرسوم المتحركة CSS نقي، بدون مكتبات، خفيف على أي جهاز
   ════════════════════════════════════════════════════════════ */

/* ── الطبقة الخلفية ───────────────────────────────────────── */
#tutorialOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 12px;
}
#tutorialOverlay.active { display: flex; }

/* ── البطاقة الرئيسية ─────────────────────────────────────── */
.tut-card {
    background: var(--card-bg, #1a1a2e);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 22px;
    width: 100%;
    max-width: 375px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 26px 18px 20px;
    text-align: center;
    color: #fff;
    position: relative;
    scrollbar-width: none;
}
.tut-card::-webkit-scrollbar { display: none; }

/* ── نقاط التقدم ─────────────────────────────────────────── */
.tut-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; }
.tut-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.15); transition: background .25s, transform .25s; }
.tut-dot.on { background: var(--accent-color, #60a5fa); transform: scale(1.4); }

/* ── الأيقونة الكبيرة ─────────────────────────────────────── */
.tut-icon { font-size: 46px; line-height: 1; margin-bottom: 10px; display: block; }

/* ── العنوان ─────────────────────────────────────────────── */
.tut-title {
    font-size: 1.08rem; font-weight: 700; margin: 0 0 8px;
    color: var(--accent-color, #60a5fa); font-family: 'Tajawal', sans-serif;
}

/* ── النص العادي (الشرائح البسيطة) ──────────────────────── */
.tut-text {
    font-size: 0.87rem; line-height: 1.75; color: rgba(255,255,255,0.72);
    margin: 0 0 18px; font-family: 'Tajawal', sans-serif;
}

/* ── أزرار التنقل ────────────────────────────────────────── */
.tut-nav { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.tut-btn {
    flex: 1; max-width: 130px; padding: 10px 0; border: none;
    border-radius: 12px; font-size: 0.9rem; font-family: 'Tajawal', sans-serif;
    font-weight: 600; cursor: pointer; background: rgba(255,255,255,0.08); color: #fff;
    transition: background .2s;
}
.tut-btn:active { background: rgba(255,255,255,0.16); }
.tut-btn.primary { background: var(--accent-color, #60a5fa); color: #000; }
.tut-btn.primary:active { opacity: 0.8; }

/* ── زر تخطي ─────────────────────────────────────────────── */
.tut-skip {
    position: absolute; top: 12px; left: 13px;
    background: none; border: none; color: rgba(255,255,255,0.28);
    font-size: 0.75rem; cursor: pointer; font-family: 'Tajawal', sans-serif; padding: 4px 6px;
}
.tut-skip:active { color: rgba(255,255,255,0.6); }


/* ════════════════════════════════════════════════════════════
   مكوّنات خطوات التفعيل (الشريحة 5)
   ════════════════════════════════════════════════════════════ */

/* رسم تخطيطي للواجهة يُظهر موقع الزر بوضوح */
.tut-ui-diagram {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 10px;
    margin-bottom: 10px;
}
.tut-ui-canvas {
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 7px;
    border: 1px dashed rgba(255,255,255,0.1);
}
.tut-ui-ctrl-row {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 6px;
}
.tut-ui-btn { font-size: 1rem; }
.tut-ui-btn-main { font-size: 1.4rem; }
.tut-ui-tools-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    align-items: center;
}
.tut-ui-tool {
    font-size: 0.8rem;
    padding: 2px 5px;
    border-radius: 6px;
    color: rgba(255,255,255,0.5);
}
/* الزر المُضاء = 🌸 */
.tut-ui-tool-active {
    background: var(--accent-color, #60a5fa);
    color: #000;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 7px;
    animation: tutBtnPulse 1.2s ease-in-out infinite;
}
@keyframes tutBtnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(96,165,250,0.5); }
    50% { box-shadow: 0 0 0 5px rgba(96,165,250,0); }
}
.tut-ui-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 5px;
    gap: 2px;
}
.tut-ui-arrow-line {
    width: 1px; height: 10px;
    background: var(--accent-color, #60a5fa);
}
.tut-ui-arrow-label {
    font-size: 0.72rem; color: var(--accent-color, #60a5fa);
    font-family: 'Tajawal', sans-serif; font-weight: 700;
}

/* قائمة الخطوات المرقّمة */
.tut-vis-steps { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.tut-step-row {
    display: flex; align-items: flex-start; gap: 9px;
    background: rgba(255,255,255,0.04); border-radius: 10px; padding: 8px 10px;
}
.tut-step-row.tut-highlight {
    background: rgba(96,165,250,0.1);
    border: 1px solid rgba(96,165,250,0.2);
}
.tut-step-num {
    flex-shrink: 0; width: 24px; height: 24px;
    background: var(--accent-color, #60a5fa); color: #000;
    font-weight: 900; font-size: 0.78rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Tajawal', sans-serif;
}
.tut-step-txt {
    font-size: 0.83rem; line-height: 1.6;
    color: rgba(255,255,255,0.8); font-family: 'Tajawal', sans-serif;
}
.tut-badge {
    display: inline-block; background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 6px; padding: 1px 6px;
    font-size: 0.8rem; vertical-align: middle;
}
.tut-badge-red { background: rgba(255,82,82,0.15); border-color: rgba(255,82,82,0.3); }

/* صندوق تلميح النص في الأسفل */
.tut-tip {
    font-size: 0.78rem; color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.04); border-radius: 8px;
    padding: 7px 9px; margin: 8px 0 0; text-align: right;
    font-family: 'Tajawal', sans-serif; line-height: 1.6;
    border-right: 3px solid var(--accent-color, #60a5fa);
}
.tut-tip strong { color: rgba(255,255,255,0.8); }

/* صندوق تلميح الأداء للهواتف الضعيفة */
.tut-perf-box {
    display: flex; align-items: flex-start; gap: 9px;
    background: rgba(255,165,0,0.07); border: 1px solid rgba(255,165,0,0.18);
    border-radius: 10px; padding: 9px 11px; margin-top: 10px; text-align: right;
}
.tut-perf-icon { font-size: 1.2rem; flex-shrink: 0; }
.tut-perf-txt { font-size: 0.8rem; line-height: 1.6; color: rgba(255,255,255,0.72); font-family: 'Tajawal', sans-serif; }
.tut-perf-txt strong { color: #ffa500; }


/* ════════════════════════════════════════════════════════════
   رأس الفئة فوق شبكة المؤثرات
   ════════════════════════════════════════════════════════════ */
.tut-cat-header { margin-bottom: 9px; }
.tut-cat-subtitle {
    font-size: 0.78rem; color: rgba(255,255,255,0.45);
    font-family: 'Tajawal', sans-serif;
}


/* ════════════════════════════════════════════════════════════
   شبكة بطاقات المؤثرات
   ════════════════════════════════════════════════════════════ */
.tut-eff-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 8px;
}
/* شبكة 5 أعمدة للشريحة التقنية */
.tut-eff-grid-5 {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.tut-eff-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 9px;
    padding: 7px 4px 5px;
    display: flex; flex-direction: column;
    align-items: center; gap: 3px;
    position: relative;
}
/* شارة 📱 للمؤثرات الخفيفة */
.tut-eff-card.lw::after {
    content: '📱';
    position: absolute; top: 2px; right: 3px;
    font-size: 7px; line-height: 1;
}

.tut-eff-name {
    font-size: 0.68rem; font-weight: 700;
    color: rgba(255,255,255,0.88);
    font-family: 'Tajawal', sans-serif;
    text-align: center; line-height: 1.25;
}
.tut-eff-desc {
    font-size: 0.6rem; color: rgba(255,255,255,0.38);
    font-family: 'Tajawal', sans-serif; text-align: center;
    line-height: 1.3;
}
/* في الشبكة 5-أعمدة، الأوصاف تختفي لتوفير المساحة */
.tut-eff-grid-5 .tut-eff-desc { display: none; }
.tut-eff-grid-5 .tut-eff-name { font-size: 0.6rem; }


/* ════════════════════════════════════════════════════════════
   حاوية المعاينة المصغّرة (mp = mini preview)
   كل بطاقة مؤثر تحتوي على هذا الصندوق الصغير المتحرك
   ════════════════════════════════════════════════════════════ */
.mp {
    width: 100%; height: 30px;
    display: flex; align-items: flex-end; justify-content: center;
    gap: 2px; overflow: hidden; position: relative;
    border-radius: 5px; background: rgba(0,0,0,0.25);
    margin-bottom: 3px;
}
/* في الشبكة 5-أعمدة، المعاينة أصغر قليلاً */
.tut-eff-grid-5 .mp { height: 22px; }


/* ════════════════════════════════════════════════════════════
   [1] معاينة: أعمدة (Bars)
   تُمثّل: أعمدة التردد، انعكاس مرآوي، أعمدة معكوسة،
           معادل 3D، أشعة شمسية، مصفوفة نقاط
   ════════════════════════════════════════════════════════════ */
.mp-bars s {
    flex: 1; border-radius: 2px 2px 0 0;
    background: var(--accent-color, #60a5fa);
    animation: mpBarsUp 0.7s ease-in-out infinite alternate;
    min-height: 3px;
}
/* كل عمود له ارتفاع مختلف وتأخير مختلف → تأثير عضوي */
.mp-bars s:nth-child(1) { --h: 55%; animation-delay: 0.00s; }
.mp-bars s:nth-child(2) { --h: 88%; animation-delay: 0.12s; }
.mp-bars s:nth-child(3) { --h: 65%; animation-delay: 0.06s; }
.mp-bars s:nth-child(4) { --h: 95%; animation-delay: 0.18s; }
.mp-bars s:nth-child(5) { --h: 48%; animation-delay: 0.09s; }
@keyframes mpBarsUp {
    from { height: 12%; }
    to   { height: var(--h, 70%); }
}

/* أعمدة تنمو للأسفل (أعمدة معكوسة) */
.mp-bars-dn { align-items: flex-start; }
.mp-bars-dn s { border-radius: 0 0 2px 2px; }

/* أعمدة تنمو من المنتصف للأعلى والأسفل (انعكاس مرآوي) */
.mp-bars-mirror { align-items: center; }
.mp-bars-mirror s { border-radius: 2px; }

/* تدرّج لوني يوحي بالعمق 3D */
.mp-bars-3d s {
    background: linear-gradient(to top,
        var(--accent-color, #60a5fa),
        rgba(96,165,250,0.35));
}

/* نقاط بدل أعمدة (مصفوفة نقاط) */
.mp-dots { gap: 4px; align-items: center; }
.mp-dots s { border-radius: 50% !important; flex: 0 0 5px !important; }


/* ════════════════════════════════════════════════════════════
   [2] معاينة: موجة (Wave)
   تُمثّل: موجة الصوت، شريط مموج، معدن سائل
   ════════════════════════════════════════════════════════════ */
.mp-wave { align-items: center; gap: 3px; }
.mp-wave s {
    width: 3px; background: var(--accent-color, #60a5fa);
    border-radius: 2px;
    animation: mpWaveScale 0.9s ease-in-out infinite alternate;
}
/* الارتفاعات تشكّل منحنى جيبي مرئي */
.mp-wave s:nth-child(1) { height: 3px;  animation-delay: 0.0s; }
.mp-wave s:nth-child(2) { height: 11px; animation-delay: 0.1s; }
.mp-wave s:nth-child(3) { height: 21px; animation-delay: 0.2s; }
.mp-wave s:nth-child(4) { height: 26px; animation-delay: 0.3s; }
.mp-wave s:nth-child(5) { height: 21px; animation-delay: 0.4s; }
.mp-wave s:nth-child(6) { height: 11px; animation-delay: 0.5s; }
.mp-wave s:nth-child(7) { height: 3px;  animation-delay: 0.6s; }
@keyframes mpWaveScale {
    from { transform: scaleY(0.25); opacity: 0.45; }
    to   { transform: scaleY(1);    opacity: 1; }
}

/* شريط مموج بنفسجي */
.mp-wave-ribbon s { background: linear-gradient(to top, #a78bfa, #60a5fa); }

/* معدن سائل (رمادي لامع) */
.mp-wave-liquid s { background: linear-gradient(to top, #9ca3af, #e5e7eb); }


/* ════════════════════════════════════════════════════════════
   [3] معاينة: دائرة نابضة (Circle)
   تُمثّل: نبض دائري، حلقة الطاقة، كرة متوهجة، نجم نابض،
           تموجات الماء، حلقة قوس قزح، حلقات ديناميكية،
           توهج الحواف، أشعة شمسية، شمس صوتية
   ════════════════════════════════════════════════════════════ */
.mp-circle { align-items: center; justify-content: center; }
.mp-circle::after {
    content: '';
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid var(--accent-color, #60a5fa);
    animation: mpCircPulse 0.9s ease-in-out infinite alternate;
}
@keyframes mpCircPulse {
    from { transform: scale(0.45); opacity: 0.3; }
    to   { transform: scale(1);    opacity: 1; box-shadow: 0 0 8px var(--accent-color, #60a5fa); }
}

/* تموجات الماء → حلقات تتوسع وتختفي */
.mp-ripple::after {
    animation: mpRippleExpand 1s ease-out infinite;
}
@keyframes mpRippleExpand {
    from { transform: scale(0.15); opacity: 0.9; }
    to   { transform: scale(1.6);  opacity: 0; }
}

/* حلقة الطاقة → توهج برتقالي */
.mp-energy::after { border-color: #f59e0b; box-shadow: 0 0 6px #f59e0b; }

/* نجم نابض → توهج أحمر وردي */
.mp-pulsar::after { border-color: #f43f5e; box-shadow: 0 0 6px #f43f5e; }

/* حلقة قوس قزح → دوران بألوان */
.mp-rainbow::after {
    border: none;
    background: conic-gradient(#f43f5e, #fb923c, #facc15, #4ade80, #60a5fa, #a78bfa, #f43f5e);
    animation: mpRainbowSpin 1.5s linear infinite;
}
@keyframes mpRainbowSpin { to { transform: rotate(360deg); } }

/* حلقات ديناميكية → حلقتان بتزامن مختلف */
.mp-dynrings::before, .mp-dynrings::after {
    content: ''; position: absolute; border-radius: 50%;
    border: 1.5px solid var(--accent-color, #60a5fa);
    animation: mpCircPulse 0.8s ease-in-out infinite alternate;
}
.mp-dynrings::before { width: 9px;  height: 9px;  animation-delay: 0s; }
.mp-dynrings::after  { width: 20px; height: 20px; animation-delay: 0.4s; }

/* أشعة شمسية → تدرّج شعاعي ينبض */
.mp-radial::after {
    border: none;
    background: radial-gradient(circle, var(--accent-color,#60a5fa) 25%, transparent 70%);
    animation: mpRadialPulse 0.8s ease-in-out infinite alternate;
}
@keyframes mpRadialPulse {
    from { transform: scale(0.4); opacity: 0.35; }
    to   { transform: scale(1.1); opacity: 1; }
}

/* شمس صوتية → تدرّج شعاعي ذهبي */
.mp-sun::after {
    border: none;
    background: radial-gradient(circle, #fbbf24 30%, rgba(251,191,36,0.15) 70%, transparent);
    animation: mpSunPulse 0.7s ease-in-out infinite alternate;
}
@keyframes mpSunPulse {
    from { transform: scale(0.55); }
    to   { transform: scale(1.15); box-shadow: 0 0 10px rgba(251,191,36,0.6); }
}

/* توهج الحواف → يملأ الحاوية بالكامل */
.mp-edge-glow::after {
    width: 90%; height: 80%; border-radius: 4px;
    background: none; border: none;
    animation: mpEdgePulse 0.9s ease-in-out infinite alternate;
}
@keyframes mpEdgePulse {
    from { box-shadow: 0 0 4px var(--accent-color,#60a5fa), inset 0 0 4px var(--accent-color,#60a5fa); opacity: 0.4; }
    to   { box-shadow: 0 0 12px var(--accent-color,#60a5fa), inset 0 0 10px var(--accent-color,#60a5fa); opacity: 1; }
}

/* كرة متوهجة → كرة مضيئة بالكامل */
.mp-sphere::after {
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), var(--accent-color,#60a5fa) 60%, rgba(0,0,200,0.4));
    border: none;
}


/* ════════════════════════════════════════════════════════════
   [4] معاينة: نجوم ومتناثرة (Stars / Particles)
   تُمثّل: حقل النجوم، مجرة، جزيئات متناثرة، مسارات النجوم، قطرات المطر
   ════════════════════════════════════════════════════════════ */
.mp-stars { position: relative; }
.mp-stars s {
    position: absolute; width: 3px; height: 3px;
    border-radius: 50%; background: #fff;
    animation: mpStarTwinkle 1.3s ease-in-out infinite;
}
/* توزيع النجوم عبر الحاوية */
.mp-stars s:nth-child(1) { top: 18%; left: 12%; animation-delay: 0.0s; }
.mp-stars s:nth-child(2) { top: 55%; left: 32%; animation-delay: 0.3s; width: 2px; height: 2px; }
.mp-stars s:nth-child(3) { top: 25%; left: 62%; animation-delay: 0.6s; }
.mp-stars s:nth-child(4) { top: 72%; left: 80%; animation-delay: 0.9s; width: 2px; height: 2px; }
.mp-stars s:nth-child(5) { top: 45%; left: 50%; animation-delay: 0.4s; width: 4px; height: 4px; }
@keyframes mpStarTwinkle {
    0%, 100% { opacity: 0.12; transform: scale(0.4); }
    50%       { opacity: 1;    transform: scale(1.4); }
}

/* مجرة → نجوم بلون التوكيد */
.mp-galaxy s { background: var(--accent-color, #60a5fa); }

/* جزيئات متناثرة → تتطاير للخارج */
.mp-scatter s {
    animation: mpScatterOut 1s ease-out infinite;
    background: var(--accent-color, #60a5fa);
}
.mp-scatter s:nth-child(1) { --sx:  9px; --sy: -9px; animation-delay: 0.0s; }
.mp-scatter s:nth-child(2) { --sx: -9px; --sy: -7px; animation-delay: 0.2s; }
.mp-scatter s:nth-child(3) { --sx:  7px; --sy:  9px; animation-delay: 0.4s; }
.mp-scatter s:nth-child(4) { --sx: -7px; --sy:  7px; animation-delay: 0.6s; }
.mp-scatter s:nth-child(5) { --sx:  1px; --sy:-11px; animation-delay: 0.1s; }
@keyframes mpScatterOut {
    0%   { transform: translate(0,0) scale(1);     opacity: 1; }
    100% { transform: translate(var(--sx),var(--sy)) scale(0); opacity: 0; }
}

/* مسارات النجوم → خطوط مائلة تتلاشى */
.mp-trails { align-items: center; gap: 3px; }
.mp-trails s {
    width: 2px !important; height: 10px !important;
    border-radius: 1px !important;
    transform: rotate(-40deg);
    animation: mpTrailsFade 1s ease-in-out infinite;
}
.mp-trails s:nth-child(1) { animation-delay: 0.0s; background: rgba(255,255,255,0.9); }
.mp-trails s:nth-child(2) { animation-delay: 0.2s; background: rgba(255,255,255,0.65); }
.mp-trails s:nth-child(3) { animation-delay: 0.4s; background: rgba(255,255,255,0.45); }
.mp-trails s:nth-child(4) { animation-delay: 0.6s; background: rgba(255,255,255,0.25); }
.mp-trails s:nth-child(5) { animation-delay: 0.8s; background: rgba(255,255,255,0.1); }
@keyframes mpTrailsFade {
    0%, 100% { opacity: 0.15; }
    50%       { opacity: 1; }
}

/* قطرات المطر → تتساقط من الأعلى للأسفل */
.mp-rain { align-items: flex-start; gap: 5px; }
.mp-rain s {
    width: 2px !important; border-radius: 1px !important;
    height: 8px !important; background: var(--accent-color, #60a5fa);
    animation: mpRainFall 0.7s linear infinite;
}
.mp-rain s:nth-child(1) { animation-delay: 0.00s; }
.mp-rain s:nth-child(2) { animation-delay: 0.14s; }
.mp-rain s:nth-child(3) { animation-delay: 0.28s; }
.mp-rain s:nth-child(4) { animation-delay: 0.42s; }
.mp-rain s:nth-child(5) { animation-delay: 0.56s; }
@keyframes mpRainFall {
    from { transform: translateY(-4px); opacity: 1; }
    to   { transform: translateY(28px); opacity: 0; }
}


/* ════════════════════════════════════════════════════════════
   [5] معاينة: نفق/دوامة (Tunnel)
   تُمثّل: نفق فضائي، دوامة، لولب مزدوج، نفق بلازما
   ════════════════════════════════════════════════════════════ */
.mp-tunnel { align-items: center; justify-content: center; }
/* حلقات تتوسع وتختفي لتعطي إحساس الانطلاق في النفق */
.mp-tunnel::before, .mp-tunnel::after {
    content: ''; position: absolute; border-radius: 50%;
    border: 1px solid var(--accent-color, #60a5fa);
    animation: mpTunnelZoom 1.2s ease-out infinite;
}
.mp-tunnel::before { animation-delay: 0s; }
.mp-tunnel::after  { animation-delay: 0.6s; }
@keyframes mpTunnelZoom {
    from { width: 3px; height: 3px; opacity: 0.9; }
    to   { width: 38px; height: 38px; opacity: 0; }
}

/* نفق سريع → سرعة أعلى */
.mp-tunnel-fast::before, .mp-tunnel-fast::after { animation-duration: 0.65s; }

/* لولب مزدوج → دوران مع توسع */
.mp-helix::before, .mp-helix::after {
    border-color: #a78bfa;
    animation: mpHelixSpin 1.1s ease-out infinite;
}
.mp-helix::after { animation-delay: 0.55s; }
@keyframes mpHelixSpin {
    from { width: 3px; height: 3px; transform: rotate(0deg); opacity: 0.9; }
    to   { width: 36px; height: 36px; transform: rotate(180deg); opacity: 0; }
}

/* نفق بلازما → وردي متوهج */
.mp-plasma::before, .mp-plasma::after {
    border-color: #f472b6;
    box-shadow: 0 0 4px #f472b6;
    animation-duration: 0.9s;
}


/* ════════════════════════════════════════════════════════════
   [6] معاينة: تشويش رقمي (Glitch / Tech)
   تُمثّل: تشويش رقمي، شبكة نيون، شلال رقمي، مربعات متزامنة
   ════════════════════════════════════════════════════════════ */
.mp-glitch { align-items: center; flex-direction: column; gap: 4px; }
.mp-glitch s {
    height: 4px; border-radius: 2px;
    background: var(--accent-color, #60a5fa);
    animation: mpGlitchJump 0.28s step-end infinite;
}
.mp-glitch s:nth-child(1) { width: 72%; animation-delay: 0.00s; }
.mp-glitch s:nth-child(2) { width: 48%; animation-delay: 0.09s; }
.mp-glitch s:nth-child(3) { width: 62%; animation-delay: 0.05s; }
@keyframes mpGlitchJump {
    0%, 100% { transform: translateX(0px);  opacity: 1; }
    33%       { transform: translateX(-4px); opacity: 0.6; }
    66%       { transform: translateX(3px);  opacity: 0.85; }
}

/* شبكة نيون → خطوط خضراء */
.mp-neon s { background: #4ade80; box-shadow: 0 0 4px #4ade80; }

/* شلال رقمي → خطوط سماوية تتحرك عمودياً */
.mp-waterfall { flex-direction: row; align-items: flex-start; gap: 3px; }
.mp-waterfall s {
    width: 5px !important; height: 12px !important;
    border-radius: 2px !important;
    background: #22d3ee; animation: mpWaterfallDrop 0.5s linear infinite;
}
.mp-waterfall s:nth-child(1) { animation-delay: 0.00s; }
.mp-waterfall s:nth-child(2) { animation-delay: 0.17s; }
.mp-waterfall s:nth-child(3) { animation-delay: 0.33s; }
@keyframes mpWaterfallDrop {
    0%   { transform: translateY(-8px); opacity: 0; }
    30%  { opacity: 1; }
    100% { transform: translateY(16px); opacity: 0; }
}

/* مربعات متزامنة → مربعات تنبض معاً */
.mp-squares { flex-direction: row; align-items: center; gap: 4px; }
.mp-squares s {
    width: 8px !important; height: 8px !important;
    border-radius: 2px !important;
    background: var(--accent-color, #60a5fa);
    animation: mpSquarePop 0.6s ease-in-out infinite;
}
.mp-squares s:nth-child(1) { animation-delay: 0.0s; }
.mp-squares s:nth-child(2) { animation-delay: 0.2s; }
.mp-squares s:nth-child(3) { animation-delay: 0.4s; }
@keyframes mpSquarePop {
    0%, 100% { transform: scale(0.4); opacity: 0.3; }
    50%       { transform: scale(1);   opacity: 1; }
}


/* ════════════════════════════════════════════════════════════
   [7] معاينة: شبكة/هندسة (Web / Geometric)
   تُمثّل: شبكة عنكبوتية، خطوط دوارة، أشكال هندسية
   ════════════════════════════════════════════════════════════ */
.mp-web { align-items: center; justify-content: center; }
/* مربع يدور ويتحول إلى دائرة ويعود */
.mp-web::after {
    content: ''; width: 20px; height: 20px;
    border: 1.5px solid var(--accent-color, #60a5fa);
    animation: mpWebMorph 2s ease-in-out infinite;
}
@keyframes mpWebMorph {
    0%  { transform: rotate(0deg);   border-radius: 0; }
    50% { transform: rotate(90deg);  border-radius: 50%; }
    100%{ transform: rotate(180deg); border-radius: 0; }
}

/* خطوط دوارة → خطوط تدور 360 */
.mp-lines::after {
    width: 22px; height: 2px; border-radius: 1px;
    background: var(--accent-color, #60a5fa);
    box-shadow: 0 7px 0 var(--accent-color, #60a5fa), 0 -7px 0 var(--accent-color, #60a5fa);
    border: none; border-radius: 0;
    animation: mpLinesSpin 1s linear infinite;
}
@keyframes mpLinesSpin { to { transform: rotate(360deg); } }

/* أشكال هندسية → تحوّل بطيء بين أشكال */
.mp-geo::after {
    animation: mpGeoMorph 2.5s ease-in-out infinite;
    border-color: #a78bfa;
}
@keyframes mpGeoMorph {
    0%   { transform: rotate(0deg);   border-radius: 0; }
    25%  { transform: rotate(45deg);  border-radius: 25%; }
    50%  { transform: rotate(90deg);  border-radius: 50%; }
    75%  { transform: rotate(135deg); border-radius: 25%; }
    100% { transform: rotate(180deg); border-radius: 0; }
}


/* ════════════════════════════════════════════════════════════
   [8] معاينة: انفجار (Burst / Fireworks)
   تُمثّل: ألعاب نارية، انفجار قصاصات، فقاعات ليزر
   ════════════════════════════════════════════════════════════ */
.mp-burst { align-items: center; justify-content: center; }
.mp-burst s {
    position: absolute; width: 5px; height: 5px;
    border-radius: 50%; background: var(--accent-color, #60a5fa);
    animation: mpBurstOut 1.1s ease-out infinite;
}
.mp-burst s:nth-child(1) { --bx:  11px; --by: -11px; animation-delay: 0.00s; }
.mp-burst s:nth-child(2) { --bx: -11px; --by: -11px; animation-delay: 0.27s; }
.mp-burst s:nth-child(3) { --bx:  11px; --by:  11px; animation-delay: 0.55s; }
.mp-burst s:nth-child(4) { --bx: -11px; --by:  11px; animation-delay: 0.82s; }
@keyframes mpBurstOut {
    0%   { transform: translate(0,0) scale(1.2); opacity: 1; }
    100% { transform: translate(var(--bx), var(--by)) scale(0); opacity: 0; }
}

/* انفجار قصاصات → ألوان احتفالية */
.mp-confetti s:nth-child(1) { background: #f43f5e; }
.mp-confetti s:nth-child(2) { background: #fb923c; }
.mp-confetti s:nth-child(3) { background: #facc15; }
.mp-confetti s:nth-child(4) { background: #4ade80; }
.mp-confetti s { border-radius: 1px; }

/* فقاعات ليزر → دوائر شفافة */
.mp-bubbles s { background: transparent; border: 1.5px solid #a78bfa; }


/* ═══════════════════════════════════════════════════════════
   [v11] تحسينات ملء الشاشة + سرعة التشغيل + الكلمات
   ═══════════════════════════════════════════════════════════ */

/* ── معلومات المقطع في ملء الشاشة — أعلى الشاشة ── */
.fs-track-info {
    position: absolute;
    top: 14px;           /* أعلى الشاشة تحت شريط الأيقونات مباشرةً */
    left: 50%;
    transform: translateX(-50%);
    z-index: 2015;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.45s ease, transform 0.45s ease;
    animation: fsInfoSlideDown 0.45s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    max-width: min(80%, 420px);
    padding: 8px 18px;
    background: rgba(0,0,0,0.52);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.fs-track-info.fs-info-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px);   /* يختفي لأعلى */
}
@keyframes fsInfoSlideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-14px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0);     }
}
.fs-info-title {
    font-size: clamp(14px, 2.5vw, 22px);
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fs-info-artist {
    font-size: clamp(11px, 1.8vw, 16px);
    color: rgba(255,255,255,0.65);
    text-shadow: 0 1px 8px rgba(0,0,0,0.8);
    margin-top: 3px;
}

/* ── تحسين كلمات الأغنية في ملء الشاشة ── */
#mediaContainer.fullscreen-active #lyricsDisplay,
#mediaContainer:fullscreen #lyricsDisplay,
#mediaContainer:-webkit-full-screen #lyricsDisplay,
#mediaContainer:-moz-full-screen #lyricsDisplay,
#mediaContainer:-ms-fullscreen #lyricsDisplay {
    position: absolute !important;
    bottom: 8% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    min-width: 55% !important;
    max-width: 88% !important;
    max-height: 38vh !important;
    background: linear-gradient(
        135deg,
        rgba(0,0,0,0.82) 0%,
        rgba(10,10,30,0.85) 100%
    ) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    border-radius: 24px !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6),
                0 0 0 1px rgba(255,255,255,0.06) !important;
    padding: 18px 30px !important;
    text-align: center !important;
    font-size: clamp(16px, 2.5vw, 26px) !important;
    line-height: 1.7 !important;
    color: rgba(255,255,255,0.88) !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7) !important;
    z-index: 2010 !important;
    overflow-y: auto !important;
    animation: lyricsPopIn 0.35s ease forwards !important;
}
@keyframes lyricsPopIn {
    from { opacity: 0; transform: translateX(-50%) scale(0.96); }
    to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* السطر الحالي المضيء في ملء الشاشة */
#mediaContainer.fullscreen-active .highlighted-lyric,
#mediaContainer:fullscreen .highlighted-lyric,
#mediaContainer:-webkit-full-screen .highlighted-lyric,
#mediaContainer:-moz-full-screen .highlighted-lyric {
    color: var(--accent-color) !important;
    font-size: clamp(18px, 3vw, 30px) !important;
    font-weight: 800 !important;
    display: block !important;
    margin-bottom: 8px !important;
    text-shadow:
        0 0 20px var(--accent-color),
        0 0 40px color-mix(in srgb, var(--accent-color) 50%, transparent),
        0 2px 6px rgba(0,0,0,0.9) !important;
    animation: lyricHighlight 0.3s ease forwards !important;
}
@keyframes lyricHighlight {
    from { opacity: 0.5; transform: scale(0.97); }
    to   { opacity: 1;   transform: scale(1); }
}

/* ── سرعة التشغيل ── */
.speed-control-section {
    margin-bottom: 18px;
    padding: 14px 16px;
    background: var(--surface-color);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.07);
}
.speed-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color-primary);
}
.speed-current-badge {
    margin-left: auto;
    background: var(--accent-color);
    color: #000;
    font-size: 12px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    min-width: 38px;
    text-align: center;
    transition: background 0.25s, transform 0.15s;
}
.speed-current-badge.speed-badge-pulse {
    animation: speedBadgePop 0.3s ease;
}
@keyframes speedBadgePop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}
.speed-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 12px;
}
.speed-chip {
    flex: 1;
    min-width: 48px;
    padding: 7px 4px;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: var(--text-color-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}
.speed-chip:hover {
    background: rgba(255,255,255,0.12);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}
.speed-chip.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #000;
    font-weight: 800;
    box-shadow: 0 2px 12px color-mix(in srgb, var(--accent-color) 50%, transparent);
}

/* ── تحسين حقلَي الوقت المخصص (ساعات ودقائق) في المؤقت ── */
#customHours:focus,
#customMins:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* ── حقل اللايف (direction-safe scrollbar) ── */
#mediaContainer.fullscreen-active #lyricsDisplay::-webkit-scrollbar,
#mediaContainer:fullscreen #lyricsDisplay::-webkit-scrollbar {
    width: 4px;
}
#mediaContainer.fullscreen-active #lyricsDisplay::-webkit-scrollbar-thumb,
#mediaContainer:fullscreen #lyricsDisplay::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════
   أزرار السرعة والنبرة المنسدلة — داخل لوحة المعادل
   ======================================================= */

.audio-dropdowns-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    /* لا نحتاج position:relative هنا بعد الآن */
}

.audio-drop-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;  /* الزر فوق، اللوحة أسفله مباشرةً */
}

/* الزر الرئيسي */
.audio-drop-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    background: var(--surface-color, #2a2a2a);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: var(--text-color, #fff);
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.audio-drop-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
}

.audio-drop-btn.drop-active {
    background: rgba(138,43,226,0.18);
    border-color: rgba(138,43,226,0.55);
    box-shadow: 0 0 0 3px rgba(138,43,226,0.12);
}

/* قيمة السرعة المعروضة داخل الزر */
.speed-drop-val {
    margin-inline-start: auto;
    font-weight: 700;
    font-size: 12px;
    color: #c8a0ff;
    min-width: 36px;
    text-align: center;
}

.drop-chevron {
    opacity: 0.55;
    transition: transform 0.25s;
    flex-shrink: 0;
}

.audio-drop-btn.drop-active .drop-chevron {
    transform: rotate(180deg);
}

/* اللوحة المنسدلة — تتمدد inline أسفل الزر */
/* ✅ نستخدم scaleY + opacity بدلاً من max-height لأنها تعمل على GPU مباشرة */
.audio-drop-panel {
    background: var(--bg-color, #1a1a2e);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 14px;
    margin-top: 4px;
    overflow: hidden;

    /* نجعل التحريك يبدأ من الأعلى */
    transform-origin: top center;

    /* الحالة المغلقة: مخفية ومضغوطة */
    transform: scaleY(0);
    opacity: 0;
    pointer-events: none;

    /* نُخبر المتصفح مسبقاً بما سيتغير → يرفع العنصر إلى طبقة GPU */
    will-change: transform, opacity;

    /* سرعة عالية: 180ms فقط مع cubic-bezier سلسة */
    transition: transform 0.18s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.15s ease;

    /* نمنع احتساب ارتفاع العنصر حين يكون مغلقاً */
    visibility: hidden;
}

.audio-drop-panel.speed-panel-open {
    transform: scaleY(1);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.drop-panel-title {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* متبقٍّ للتوافق: speed-current-badge */
.speed-current-badge {
    font-weight: 700;
    color: #c8a0ff;
    font-size: 12px;
}
