/* EduSeries Builder - Brand Identity System (v3.0) 
   Identity: IBM Plex Sans Arabic + Deep Navy & Cyan
*/

/* 1. Typography & Global Reset */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap');

:root {
    /* Brand Colors extracted from Identity */
    --brand-dark: #0f152d;
    /* الكحلي العميق */
    --brand-accent: #00e0c6;
    /* الفيروزي المضيء */
    --brand-accent-hover: #00c4ad;

    /* Neutrals */
    --surface-white: #ffffff;
    --surface-light: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-on-dark: #ffffff;
    --text-muted-on-dark: #94a3b8;

    /* System */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --sidebar-width: 340px;
    --wp-admin-bar-height: 32px;

    --font-family: 'IBM Plex Sans Arabic', sans-serif;
}

/* Global Reset */
.eduseries-course-container,
.eduseries-course-container *,
.eduseries-archive-container,
.eduseries-archive-container * {
    box-sizing: border-box;
    font-family: var(--font-family);
}

/* =========================================
   2. Archive Page (المكتبة) - Clean & Modern
   ========================================= */

.eduseries-archive-container {
    max-width: 1240px;
    margin: 40px auto;
    padding: 0 24px;
}

/* Hero Section */
.eduseries-archive-hero {
    text-align: center;
    margin-bottom: 60px;
    padding: 80px 24px;
    background: var(--brand-dark);
    /* خلفية داكنة حسب الهوية */
    border-radius: var(--radius-lg);
    color: white;
    position: relative;
    overflow: hidden;
}

/* زخرفة خلفية بسيطة */
.eduseries-archive-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 224, 198, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
}

.eduseries-archive-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: white !important;
    /* ضمان اللون الأبيض */
}

.eduseries-archive-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted-on-dark);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

/* Filters & Search */
.eduseries-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-top: 40px;
}

.eduseries-filter-btn {
    background: rgba(255, 255, 255, 0.05);
    /* زجاجي شفاف */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted-on-dark);
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.eduseries-filter-btn:hover,
.eduseries-filter-btn.active {
    background: var(--brand-accent);
    color: var(--brand-dark);
    /* نص داكن على خلفية فاتحة */
    border-color: var(--brand-accent);
    font-weight: 600;
}

.eduseries-search-box input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    width: 280px;
}

.eduseries-search-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Grid & Cards */
.eduseries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 32px;
}

.eduseries-card {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
}

.eduseries-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
    border-color: var(--brand-accent);
}

.eduseries-card-thumb {
    padding-top: 60%;
    position: relative;
    background: #e2e8f0;
}

.eduseries-card-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.eduseries-card:hover .eduseries-card-thumb img {
    transform: scale(1.05);
}

.eduseries-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.eduseries-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: white;
    color: var(--brand-dark);
    padding: 4px 12px;
    border-radius: 4px;
    /* زوايا أقل استدارة حسب الهوية */
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* =========================================
   3. Single Course (Dark Sidebar)
   ========================================= */

.eduseries-course-container {
    display: flex;
    background-color: var(--surface-light);
    min-height: calc(100vh - var(--wp-admin-bar-height));
}

/* Sidebar Styling - DARK THEME */
.eduseries-course-sidebar {
    width: var(--sidebar-width);
    background-color: var(--brand-dark);
    /* تحويل السايدبار للداكن */
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 32px);
    position: sticky;
    top: 32px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

body:not(.admin-bar) .eduseries-course-sidebar {
    height: 100vh;
    top: 0;
}

/* Sidebar Nav (Back to Library) */
.eduseries-sidebar-nav {
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.eduseries-browse-all-link {
    color: var(--text-muted-on-dark);
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: color 0.2s;
}

.eduseries-browse-all-link:hover {
    color: var(--brand-accent);
}

/* Sidebar Header */
.eduseries-sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.eduseries-sidebar-title {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.eduseries-sidebar-meta {
    color: var(--text-muted-on-dark);
    font-size: 0.85rem;
}

/* Sidebar Progress */
.eduseries-progress-container {
    padding: 20px 24px;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.eduseries-progress-text {
    color: var(--text-muted-on-dark);
}

.eduseries-progress-bar {
    background: rgba(255, 255, 255, 0.1);
    /* خلفية الشريط باهتة */
}

.eduseries-progress-fill {
    background: var(--brand-accent);
    /* تعبئة فيروزي */
    box-shadow: 0 0 10px rgba(0, 224, 198, 0.4);
}

/* Lessons List (Dark items) */
.eduseries-lessons-nav {
    background: transparent;
    padding: 16px;
}

.eduseries-lesson-link {
    color: var(--text-muted-on-dark);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
}

.eduseries-lesson-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.eduseries-lesson-item.active .eduseries-lesson-link {
    background: var(--brand-accent);
    color: var(--brand-dark);
    font-weight: 700;
    border-color: transparent;
}

.eduseries-lesson-item.active .eduseries-lesson-link::before {
    display: none;
}

/* Lesson Number Circle */
.eduseries-lesson-number {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted-on-dark);
}

.eduseries-lesson-item.active .eduseries-lesson-number {
    background: rgba(0, 0, 0, 0.15);
    color: var(--brand-dark);
    box-shadow: none;
}

.eduseries-lesson-item.completed .eduseries-lesson-number {
    background: transparent;
    border: 1px solid var(--brand-accent);
    color: var(--brand-accent);
}

/* Sidebar Footer */
.eduseries-sidebar-footer {
    background: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted-on-dark);
}

/* Content Area */
.eduseries-course-content {
    background: var(--surface-light);
    padding: 40px 5%;
}

.eduseries-lesson-viewer {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.eduseries-lesson-title {
    color: var(--brand-dark);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 32px;
}

.eduseries-lesson-content, .eduseries-body-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #334155;
    margin-bottom: 40px;
}

/* Content Formatting Fallbacks */
.eduseries-lesson-content ul, .eduseries-body-text ul {
    list-style-type: disc !important;
    padding-inline-start: 2rem !important;
    margin-inline-start: 0 !important;
    margin-bottom: 1.5rem !important;
}
.eduseries-lesson-content ol, .eduseries-body-text ol {
    list-style-type: decimal !important;
    padding-inline-start: 2rem !important;
    margin-inline-start: 0 !important;
    margin-bottom: 1.5rem !important;
}
.eduseries-lesson-content ul ul { list-style-type: circle !important; }
.eduseries-lesson-content ul ul ul { list-style-type: square !important; }
.eduseries-lesson-content ol ol { list-style-type: lower-alpha !important; }
.eduseries-lesson-content li, .eduseries-body-text li {
    margin-bottom: 0.5rem;
    display: list-item !important;
    list-style-position: outside;
}
.eduseries-lesson-content blockquote, .eduseries-body-text blockquote {
    border-inline-start: 4px solid var(--brand-accent) !important;
    background: var(--surface-light) !important;
    margin: 1.5rem 0 !important;
    padding: 1rem 1.5rem !important;
    font-style: italic;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}
.eduseries-lesson-content p, .eduseries-body-text p {
    margin-bottom: 1.5rem;
}
.eduseries-lesson-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}
.eduseries-lesson-content table, .eduseries-body-text table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}
.eduseries-lesson-content th, .eduseries-lesson-content td,
.eduseries-body-text th, .eduseries-body-text td {
    border: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
    text-align: right;
}
.eduseries-lesson-content th, .eduseries-body-text th {
    background: var(--surface-light);
    font-weight: 700;
}
.eduseries-lesson-content pre, .eduseries-body-text pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-bottom: 1.5rem;
    direction: ltr;
    text-align: left;
}
.eduseries-lesson-content code, .eduseries-body-text code {
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Navigation Buttons */
.eduseries-nav-button {
    background: transparent;
    border: 1px solid #e2e8f0;
    color: var(--text-secondary);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.eduseries-nav-button:hover:not(:disabled) {
    border-color: var(--brand-dark);
    color: var(--brand-dark);
}

.eduseries-nav-next,
.eduseries-nav-complete {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: white;
}

.eduseries-nav-next:hover,
.eduseries-nav-complete:hover {
    background: #1e2538;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(15, 21, 45, 0.2);
}

/* =========================================
   4. Mobile Responsiveness
   ========================================= */

@media (max-width: 1024px) {
    .eduseries-course-content {
        padding: 20px;
        padding-bottom: 100px;
    }

    .eduseries-lesson-viewer {
        padding: 24px;
        border-radius: var(--radius-md);
    }

    .eduseries-course-sidebar {
        background: var(--brand-dark);
        width: 85%;
        max-width: 320px;
    }

    .eduseries-mobile-fab {
        background: var(--brand-accent);
        color: var(--brand-dark);
        box-shadow: 0 4px 15px rgba(0, 224, 198, 0.4);
    }

    .eduseries-mobile-header {
        background: white;
        border-bottom: 1px solid #e2e8f0;
    }

    .eduseries-mobile-title {
        color: var(--brand-dark);
        font-weight: 700;
    }
}

/* =========================================
   2. Archive Page (Modern Smart Design v4)
   ========================================= */

.eduseries-archive-page {
    background: #f8fafc;
    min-height: 100vh;
    direction: rtl; /* ???? ??????? */
    overflow-x: hidden;
}

/* --- Hero Section --- */
.eduseries-hero-section {
    background: #0f172a; /* Slate 900 */
    color: #fff;
    padding: 80px 0 120px 0;
    position: relative;
    overflow: hidden;
    text-align: center;
}

/* ?????? ????? (Abstract Backgrounds) */
.eduseries-hero-glow-1 {
    position: absolute; top: -20%; left: -10%; 
    width: 600px; height: 600px; 
    background: radial-gradient(circle, rgba(37, 99, 235, 0.25) 0%, transparent 60%); 
    filter: blur(80px);
    animation: pulseGlow 10s infinite alternate;
}

.eduseries-hero-glow-2 {
    position: absolute; bottom: -20%; right: -10%; 
    width: 500px; height: 500px; 
    background: radial-gradient(circle, rgba(6, 182, 212, 0.2) 0%, transparent 60%); 
    filter: blur(60px);
    animation: pulseGlow 10s infinite alternate-reverse;
}

.eduseries-hero-grid {
    position: absolute; inset: 0; 
    background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), 
                      linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px); 
    background-size: 40px 40px; 
    opacity: 0.5;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 0.5; }
}

.eduseries-hero-content {
    position: relative; 
    z-index: 10; 
    max-width: 900px; 
    margin: 0 auto; 
    padding: 0 24px;
}

.eduseries-pill-label {
    display: inline-block; 
    padding: 8px 16px; 
    background: rgba(56, 189, 248, 0.1); 
    color: #38bdf8; 
    border: 1px solid rgba(56, 189, 248, 0.2); 
    border-radius: 999px; 
    font-size: 13px; 
    font-weight: 700; 
    margin-bottom: 24px;
}

.eduseries-main-title {
    font-size: clamp(2.5rem, 5vw, 3.8rem); 
    font-weight: 900; 
    margin: 0 0 24px 0; 
    letter-spacing: -1px; 
    line-height: 1.2;
    color: white;
}

.eduseries-gradient-text {
    color: transparent; 
    background-clip: text; 
    -webkit-background-clip: text; 
    background-image: linear-gradient(to right, #60a5fa, #22d3ee);
}

.eduseries-hero-desc {
    font-size: 1.1rem; 
    line-height: 1.7; 
    color: #94a3b8; 
    max-width: 650px; 
    margin: 0 auto;
}

/* --- Filter & Search Bar --- */
.eduseries-filters-container {
    margin-top: -50px; 
    position: relative; 
    z-index: 20; 
    padding: 0 24px;
    margin-bottom: 60px;
}

.eduseries-filters-wrapper {
    max-width: 1000px; 
    margin: 0 auto; 
    background: #ffffff; 
    border-radius: 20px; 
    padding: 10px; 
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.1); 
    display: flex; 
    flex-wrap: wrap; 
    gap: 12px; 
    border: 1px solid #e2e8f0; 
    align-items: center;
}

.eduseries-filters-scroll {
    display: flex; 
    gap: 8px; 
    overflow-x: auto; 
    padding: 4px; 
    scrollbar-width: none; 
    flex-grow: 1;
}

.eduseries-filters-scroll::-webkit-scrollbar { display: none; }

.eduseries-filter-btn {
    padding: 10px 24px;
    border-radius: 99px;
    background: transparent;
    color: #64748b; 
    border: none;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.eduseries-filter-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.eduseries-filter-btn.active {
    background: #0f172a;
    color: #ffffff;
}

.eduseries-search-wrap {
    position: relative; 
    flex-shrink: 0;
}

.eduseries-search-input {
    padding: 12px 16px 12px 40px; 
    border-radius: 12px; 
    border: 1px solid #e2e8f0; 
    background: #f8fafc; 
    font-family: inherit; 
    font-size: 14px; 
    width: 240px;
    transition: 0.2s; 
    outline: none;
}
.eduseries-search-input:focus {
    background: white;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.eduseries-search-icon {
    position: absolute; 
    left: 12px; 
    top: 50%; 
    transform: translateY(-50%); 
    pointer-events: none;
    color: #94a3b8;
}

/* --- Cards Grid --- */
.eduseries-grid-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 80px 24px;
}

.eduseries-smart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 32px;
}

/* --- Smart Card Design --- */
.eduseries-smart-card {
    background: #ffffff;
    border-radius: 24px; /* Increased radius */
    border: 1px solid #e2e8f0;
    overflow: hidden;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.eduseries-smart-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.eduseries-card-thumb-wrapper {
    height: 220px;
    position: relative;
    overflow: hidden;
}

.eduseries-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.eduseries-smart-card:hover .eduseries-card-img {
    transform: scale(1.05);
}

.eduseries-card-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.6) 0%, transparent 60%);
}

.eduseries-level-badge {
    position: absolute;
    top: 16px; right: 16px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* ??? ????? ??? ????? */
.eduseries-level-badge.beginner { border-bottom: 2px solid #22d3ee; }
.eduseries-level-badge.intermediate { border-bottom: 2px solid #818cf8; }
.eduseries-level-badge.advanced { border-bottom: 2px solid #f472b6; }

.eduseries-card-content {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.eduseries-meta-row {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.eduseries-category-pill {
    font-size: 0.75rem;
    font-weight: 700;
    color: #0369a1;
    background: #e0f2fe;
    padding: 6px 12px;
    border-radius: 8px;
}

.eduseries-lesson-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.eduseries-card-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 12px 0;
    line-height: 1.4;
    transition: color 0.2s;
}

.eduseries-smart-card:hover .eduseries-card-title {
    color: #2563eb;
}

.eduseries-card-excerpt {
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 24px 0;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.eduseries-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px dashed #e2e8f0;
    padding-top: 20px;
    margin-top: auto;
}

.eduseries-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.eduseries-author img {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
}

.eduseries-author span {
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
}

.eduseries-arrow-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #f8fafc;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.eduseries-smart-card:hover .eduseries-arrow-btn {
    background: #2563eb;
    color: #fff;
    transform: rotate(45deg); 
}



/* =========================================
   3. Single Series Layout (Theater Mode v5)
   ========================================= */

/* Reset for Player Layout */
.eduseries-player-layout {
    display: flex;
    min-height: calc(100vh - 32px); /* Fallback */
    background: #f1f5f9;
    font-family: 'IBM Plex Sans Arabic', sans-serif;
    position: relative;
    /* ??? ??????? ?? ?????? ??????? ??? ??????? */
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
}

/* --- Sidebar (Dark Theme) --- */
.eduseries-player-sidebar {
    width: 350px;
    background: #0f172a; /* Navy Dark */
    color: #fff;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255,255,255,0.05); /* Separator */
    
    /* Sticky Logic */
    position: sticky;
    top: 32px; /* Admin Bar offset */
    height: calc(100vh - 32px);
    overflow: hidden;
    flex-shrink: 0;
    z-index: 100;
}

body:not(.admin-bar) .eduseries-player-sidebar {
    top: 0;
    height: 100vh;
}

/* Sidebar Header */
.eduseries-sidebar-header {
    padding: 24px;
    background: rgba(0,0,0,0.2);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.eduseries-back-btn {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8; text-decoration: none;
    transition: 0.2s;
    flex-shrink: 0;
}
.eduseries-back-btn:hover { background: #22d3ee; color: #0f172a; }

.eduseries-series-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.4;
    color: white;
}

.eduseries-meta-badges {
    display: flex; gap: 8px;
}
.eduseries-badge-sm {
    font-size: 0.7rem;
    background: rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 4px;
    color: #cbd5e1;
}

/* Sidebar Progress */
.eduseries-sidebar-progress {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.eduseries-progress-label {
    display: flex; justify-content: space-between;
    font-size: 0.8rem; color: #94a3b8; margin-bottom: 8px;
}
.eduseries-progress-track {
    height: 6px; background: rgba(255,255,255,0.1); border-radius: 10px; overflow: hidden;
}
.eduseries-progress-fill {
    height: 100%; background: #22d3ee; width: 0; transition: 0.5s;
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.4);
}

/* Playlist (Lessons) */
.eduseries-lessons-scroll {
    flex: 1; overflow-y: auto; padding: 12px;
}
.eduseries-lessons-scroll::-webkit-scrollbar { width: 6px; }
.eduseries-lessons-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.eduseries-playlist {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 4px;
}

.eduseries-track { margin: 0; }

.eduseries-track-link {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    text-decoration: none;
    transition: 0.2s;
    border: 1px solid transparent;
}

.eduseries-track-link:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

/* Active Track Style */
.eduseries-track.active .eduseries-track-link {
    background: rgba(34, 211, 238, 0.1); /* Cyan tint */
    border-color: rgba(34, 211, 238, 0.2);
    color: #22d3ee;
}

/* Status Icons */
.eduseries-track-status {
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
}
.track-number { font-size: 0.85rem; font-weight: 600; }
.playing-icon { display: none; gap: 2px; align-items: flex-end; height: 12px; }
.playing-icon span { background: #22d3ee; width: 3px; border-radius: 2px; animation: sound 1s infinite alternate; }
.playing-icon span:nth-child(1) { height: 60%; animation-delay: 0.1s; }
.playing-icon span:nth-child(2) { height: 100%; animation-delay: 0.2s; }
.playing-icon span:nth-child(3) { height: 40%; animation-delay: 0.3s; }

@keyframes sound { 0% { height: 20%; } 100% { height: 100%; } }

.eduseries-track.active .track-number { display: none; }
.eduseries-track.active .playing-icon { display: flex; }

.eduseries-track-info { flex: 1; }
.track-title { display: block; font-size: 0.9rem; line-height: 1.3; }

/* --- Main Viewer --- */
.eduseries-player-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    height: calc(100vh - 32px); /* Independent Scroll */
    position: sticky; top: 32px;
}
body:not(.admin-bar) .eduseries-player-content { top: 0; height: 100vh; }

.eduseries-viewer-container {
    max-width: 850px; margin: 0 auto;
}

/* Content Box */
.eduseries-article-box {
    background: white;
    padding: 60px;
    border-radius: 24px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.eduseries-content-header { margin-bottom: 40px; border-bottom: 1px solid #f1f5f9; padding-bottom: 24px; }
.eduseries-pill { 
    display: inline-block; background: #e0f2fe; color: #0369a1; 
    font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 20px; margin-bottom: 12px;
}
.eduseries-content-header h1 {
    font-size: 2.2rem; color: #0f172a; margin: 0; line-height: 1.2;
}

.eduseries-body-text {
    font-size: 1.15rem; line-height: 1.9; color: #334155; margin-bottom: 60px;
}

/* Controls */
.eduseries-player-controls {
    display: flex; justify-content: space-between; gap: 20px;
    border-top: 1px solid #f1f5f9; padding-top: 30px;
}

.eduseries-btn {
    padding: 14px 28px; border-radius: 12px; border: none; font-weight: 700; 
    font-family: inherit; cursor: pointer; display: flex; align-items: center; gap: 8px;
    transition: 0.2s; font-size: 0.95rem;
}

.eduseries-btn.prev { background: #f1f5f9; color: #64748b; }
.eduseries-btn.prev:hover:not([disabled]) { background: #e2e8f0; color: #334155; }
.eduseries-btn.prev[disabled] { opacity: 0.5; cursor: not-allowed; }

.eduseries-btn.next { background: #0f172a; color: white; }
.eduseries-btn.next:hover { background: #1e293b; transform: translateX(-4px); }

/* --- Mobile Responsive (Drawer) --- */
.eduseries-mobile-nav { display: none; }
.eduseries-sidebar-overlay { display: none; }

@media (max-width: 1024px) {
    .eduseries-player-layout { display: block; } /* Disable flex for mobile */
    
    .eduseries-player-sidebar {
        position: fixed; top: 0; right: 0; bottom: 0; height: 100%;
        transform: translateX(100%); transition: transform 0.3s ease;
        z-index: 1000; width: 85%; max-width: 300px;
        border-right: 1px solid rgba(255,255,255,0.1);
    }
    
    .eduseries-player-sidebar.active { transform: translateX(0); }
    
    .eduseries-sidebar-overlay {
        position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 999;
        display: none; backdrop-filter: blur(2px);
    }
    .eduseries-sidebar-overlay.active { display: block; }
    
    .eduseries-player-content {
        padding: 20px; height: auto; position: static;
    }
    
    .eduseries-article-box { padding: 24px; border-radius: 16px; }
    
    /* Mobile Top Bar */
    .eduseries-mobile-nav {
        display: flex; align-items: center; gap: 16px;
        background: white; padding: 16px; margin-bottom: 20px;
        border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        position: sticky; top: 10px; z-index: 90;
    }
    
    .eduseries-mobile-btn {
        background: #f1f5f9; border: none; padding: 8px 16px; border-radius: 8px;
        font-weight: 700; color: #334155; display: flex; align-items: center; gap: 6px;
    }
    
    .mobile-series-title {
        font-size: 1rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    
    .eduseries-content-header h1 { font-size: 1.6rem; }
}



/* =========================================
   4. Mobile Scroll & Fixes (v6.0)
   ========================================= */

@media (max-width: 1024px) {
    
    /* ????? ?????? ??????? ???????? ?? ???????? */
    .eduseries-player-sidebar {
        height: 100% !important; /* ??? ???????? ?????? */
        height: 100vh !important;
        overflow-y: hidden; /* ??????? ??????? ??? ??????? */
        display: flex;
        flex-direction: column;
        padding-bottom: 0; /* ????? ?? ??? ????? */
    }

    /* ????? ?????? ??? ?? ???? ????? ??????? */
    .eduseries-lessons-scroll {
        flex: 1;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch; /* ????? ???? ??????? */
        padding-bottom: 80px; /* ????? ?????? ?? ?????? ?????? ?????? ???? ???? */
    }

    /* ?????? ?? ???? ??????? ??? ?? ??? */
    .eduseries-player-sidebar.active {
        box-shadow: -10px 0 50px rgba(0,0,0,0.5); /* ?? ???? */
    }
}



/* =========================================
   5. Completed State & Completion Message
   ========================================= */

/* ????? ??????? ?? ??????? */
.eduseries-track.completed .eduseries-track-link {
    color: #94a3b8; /* ???? ?????? */
}

.eduseries-track.completed .track-number {
    display: none;
}

.eduseries-track.completed .eduseries-track-status::after {
    content: '\f147'; /* Dashicon Check */
    font-family: 'dashicons';
    color: #22d3ee; /* Cyan */
    font-size: 16px;
}

/* ????? ????? ??????? */
.eduseries-completion-message {
    text-align: center;
    padding: 80px 40px;
}

.eduseries-completion-icon {
    width: 100px; height: 100px;
    background: linear-gradient(135deg, #22d3ee 0%, #38bdf8 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 30px auto;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.eduseries-completion-icon .dashicons {
    font-size: 50px; color: white;
}

.eduseries-completion-message h2 {
    font-size: 2rem; color: #0f172a; margin: 0 0 15px 0;
}

.eduseries-completion-message p {
    color: #64748b; font-size: 1.1rem; margin: 0 0 30px 0;
}

.eduseries-button-primary {
    display: inline-block;
    background: #0f172a;
    color: white;
    padding: 14px 32px;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: 0.2s;
}
.eduseries-button-primary:hover {
    background: #1e293b;
    transform: translateY(-2px);
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Loader Spinner */
.eduseries-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.spinner-ring {
    width: 40px; height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #22d3ee;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* =========================================
   6. Landing Page (Refined & Responsive)
   ========================================= */

.ar-series-page {
    background: #f8fafc;
    font-family: 'IBM Plex Sans Arabic', sans-serif;
    direction: rtl;
    color: #0f172a;
    padding-bottom: 80px;
}

.ar-hero-section {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}

.ar-hero-bg-decoration {
    position: absolute;
    top: -50%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
    filter: blur(60px);
    z-index: 1;
}

.ar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 10;
}

.ar-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 32px;
    font-weight: 700;
}

.ar-breadcrumbs a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.ar-breadcrumbs a:hover {
    color: #0f172a;
}

.ar-hero-content-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 48px;
    align-items: center;
}

.ar-badge-pill {
    display: inline-block;
    padding: 6px 14px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 20px;
    border: 1px solid #dbeafe;
}

.ar-hero-title {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    font-weight: 900;
    line-height: 1.1;
    margin: 0 0 24px 0;
    letter-spacing: -1px;
    color: #0f172a;
}

.ar-hero-desc {
    font-size: 18px;
    line-height: 1.7;
    color: #475569;
    margin-bottom: 32px;
    max-width: 600px;
}

.ar-cta-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.ar-cta-btn {
    padding: 16px 32px;
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.ar-cta-btn:hover {
    background: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(15, 23, 42, 0.3);
}

.ar-visual-container {
    position: relative;
}

.ar-visual-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, #2563eb, #06b6d4);
    filter: blur(80px);
    opacity: 0.2;
    border-radius: 50%;
}

.ar-visual-img {
    width: 100%;
    border-radius: 32px;
    transform: rotate(-2deg);
    border: 8px solid #fff;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.15);
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease;
}

.ar-visual-container:hover .ar-visual-img {
    transform: rotate(0) scale(1.02);
}

.ar-floating-badge {
    position: absolute;
    bottom: 40px;
    right: -20px;
    background: #fff;
    padding: 16px 24px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: floatBadge 3s ease-in-out infinite alternate;
}

@keyframes floatBadge {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

.ar-badge-icon {
    width: 48px;
    height: 48px;
    background: #ecfdf5;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #059669;
}

.ar-main-grid {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 40px;
    align-items: start;
    padding: 60px 24px;
}

.ar-content-heading {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 24px;
    color: #0f172a;
}

.ar-content-text {
    font-size: 16px;
    line-height: 1.8;
    color: #475569;
}

.ar-chapter-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ar-chapter-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    padding: 24px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: inherit;
    position: relative;
    overflow: hidden;
}

.ar-chapter-card:hover {
    border-color: #3b82f6;
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.1);
}

.ar-idx {
    width: 56px;
    height: 56px;
    background: #f1f5f9;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 20px;
    color: #94a3b8;
    flex-shrink: 0;
    transition: 0.3s;
}

.ar-chapter-card:hover .ar-idx {
    background: #eff6ff;
    color: #2563eb;
}

.ar-info h3 {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
}

.ar-info p {
    font-size: 14px;
    margin: 0;
    color: #64748b;
}

.ar-icon-arrow {
    margin-right: auto;
    color: #cbd5e1;
    transition: 0.3s;
}

.ar-chapter-card:hover .ar-icon-arrow {
    color: #2563eb;
    transform: translateX(-4px);
}

.ar-sidebar-widget {
    background: #fff;
    padding: 24px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.ar-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ar-stat-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ar-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
}

.ar-stat-val {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}

/* --- Mobile Responsiveness (Updated) --- */

@media (max-width: 900px) {
    .ar-hero-content-grid {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .ar-hero-title {
        font-size: 2rem; /* Better for mobile */
    }

    .ar-breadcrumbs {
        justify-content: center;
    }

    .ar-hero-desc {
        margin-left: auto;
        margin-right: auto;
    }

    .ar-cta-group {
        justify-content: center;
    }

    .ar-main-grid {
        grid-template-columns: 1fr;
        padding: 40px 24px;
    }

    /* Stack Sidebar below content, or Order it differently if needed */
    /* Usually sidebar info comes after content on mobile for courses */
}

@media (max-width: 600px) {
    .ar-chapter-card {
        padding: 16px;
        gap: 12px;
    }

    .ar-idx {
        width: 40px;
        height: 40px;
        font-size: 16px;
        border-radius: 12px;
    }

    .ar-info h3 {
        font-size: 16px;
    }
    
    .ar-floating-badge {
        position: static;
        margin-top: -20px;
        margin-bottom: 20px;
        transform: none !important;
        animation: none;
        justify-content: center;
        width: 100%;
        box-sizing: border-box;
    }
}
