/* Content Type Modal Styles - Based on Inbox.html */
.content-type-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 10002;
    justify-content: center;
    align-items: center;
    visibility: hidden;
}

.content-type-modal.open {
    visibility: visible;
}

.content-type-modal .modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 500px;
    transition: transform 0.3s ease;
    min-height: 270px;
    max-height: 90vh;
    overflow-y: auto;
    /* We'll switch between hidden overflow during animated resize and auto after settled */
    border: 1px solid #eee;
    position: relative;
}

.content-type-modal .modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 1;
    transition: opacity 200ms ease;
}

/* Desktop close button */
.content-type-close-btn {
    position: absolute;
    top: 5px;
    left: 5px;
    background: none;
    border: none;
    font-size: 40px;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.content-type-close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

/* Modal body */
.content-type-modal .modal-body {
    padding: 20px 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Spinner global styles (ensure visible & centered even if earlier nested rules didn't apply) */
.content-types-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
}
.spinner-svg {
    width: 40px;
    height: 40px;
    animation: spinner-rotate 1s linear infinite;
}
.spinner-svg .path {
    stroke: #348796;
    stroke-linecap: round;
    stroke-dasharray: 90;
    stroke-dashoffset: 60;
    transform-origin: 50% 50%;
}
@keyframes spinner-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Content types list */
.content-types-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.content-type-card {
    display: flex;
    padding: 15px;
    background-color: white;
    border-radius: 14px;
    border: 1px solid #ddddddc0;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: visible;
    align-items: center;
    cursor: pointer;
    z-index: 1;
}

.content-type-card:hover,
.content-type-card:focus {
    background-color: #fafafa;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 3px 8px, rgba(0, 0, 0, 0.05) 0px 1px 5px;
    transform: translateY(-2px);
}

.content-type-card:active {
    transform: translateY(0);
}

.content-type-card.active {
    background-color: #34879611;
}

/* Content type icon */
.content-type-icon {
    width: 44px;
    height: 44px;
    overflow: visible;
    flex-shrink: 0;
    margin-left: 5px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #348796;
}

.content-type-icon svg {
    width: 40px;
    height: 40px;
    transition: transform 0.3s ease;
}

.content-type-card:hover .content-type-icon svg {
    transform: scale(1.05);
}

/* Content type content */
.content-type-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 50px;
    padding-right: 10px;
}

.content-type-title {
    font-size: 16px;
    font-weight: 600;
    color: #223636;
    margin-bottom: 4px;
    line-height: 1.4;
}

.content-type-grades-count {
    font-size: 13px;
    color: #7f8c8d;
    opacity: 0.8;
}

/* Action indicator */
.content-type-action {
    display: flex;
    align-items: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.content-type-arrow {
    width: 35px;
    height: 35px;
    color: #348796;
    opacity: 0.7;
    transition: transform 0.2s ease;
    stroke-width: 2.5;
}

.content-type-checkmark {
    width: 35px;
    height: 35px;
    color: #348796;
    stroke-width: 2.5;
}

.content-type-spinner {
    width: 35px;
    height: 35px;
    animation: spinner-rotate 1s linear infinite;
}

.content-type-spinner circle {
    stroke: #348796;
    stroke-linecap: round;
    stroke-dasharray: 90;
    stroke-dashoffset: 60;
    transform-origin: 50% 50%;
}

.content-type-card:hover .content-type-arrow {
    transform: translateX(-2px);
}

/* Mobile modal header */
.modal-mobile-header {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    direction: ltr;
}

.modal-back-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    margin-left: 8px;
    margin-right: 0;
    order: 2;
}

.modal-back-button svg {
    width: 24px;
    height: 24px;
    color: #333;
}

.modal-mobile-header .modal-title {
    order: 1;
}

.modal-title {
    flex-grow: 1;
    text-align: right;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: rtl;
    padding-right: 10px;
}

/* Mobile styles */
@media screen and (max-width: 800px) {
    .content-type-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        display: none;
        background-color: transparent;
        align-items: initial;
        justify-content: initial;
    }

    .content-type-modal.open {
        display: flex;
    }

    .content-type-modal .modal-content {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        margin: 0;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1001;
        max-height: 80vh;
        overflow-y: auto;
        padding: 15px;
        padding-bottom: env(safe-area-inset-bottom, 15px);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }

    .content-type-modal.open .modal-content {
        transform: translateY(0);
    }

    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .content-type-modal.open .modal-overlay {
        opacity: 1;
    }

    .content-type-modal .modal-body {
        /* Allow room for header and comfortable spacing. We animate modal max-height
           to avoid layout jumps when content loads. */
        max-height: calc(80vh - 60px);
        padding-bottom: 40px;
    }

    .content-type-close-btn {
        display: none;
    }
}

/* Desktop styles */
@media screen and (min-width: 801px) {
    .modal-mobile-header {
        display: none;
    }

    .content-type-close-btn {
        display: flex;
    }
}

/* Modal content fixes */
.content-type-modal .modal-content {
    overscroll-behavior: contain;
}

.content-type-modal .modal-overlay {
    transition: opacity 0.3s ease;
}

.mobile-top-navbar {
        display: none; /* Hidden by default on desktop */
    }

    @media screen and (max-width: 800px) {
        .mobile-top-navbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 0 6px 0;
            border-bottom: 1px solid #dddddd7a;
            z-index: 2004; /* Increased z-index to appear above skeleton loading overlay */
            height: 45px;
            box-sizing: border-box;
            direction: ltr;
            /* Spinner styles for content type loader */
            .content-types-spinner {
                display: flex;
                align-items: center;
                justify-content: center;
                height: 50vh;
            }
            .spinner-svg {
                width: 40px;
                height: 40px;
                animation: spinner-rotate 1s linear infinite;
            }
            .spinner-svg .path {
                stroke: #348796;
                stroke-linecap: round;
                stroke-dasharray: 90;
                stroke-dashoffset: 60;
                transform-origin: 50% 50%;
            }
            @keyframes spinner-rotate {
                0% { transform: rotate(0deg); }
                100% { transform: rotate(360deg); }
            }
            position: relative; /* Ensure proper stacking context */
        }

    .mobile-top-navbar .left-section {
        display: flex;
        align-items: center;
        margin-top: -5px;
    }

    .mobile-top-navbar .right-section {
        display: flex;
        align-items: center;
    }

    .mobile-top-navbar .navLogo img {
        height: 40px;
        width: auto;
    }

    .mobile-top-navbar .icon-button {
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        padding: 0 5px;
        /* Reduce horizontal gap to the content-type toggle */
        margin-right: 0px;
        margin-bottom: -2px;
    }


    .mobile-top-navbar .icon-button img {
        width: 30px;
        height: 30px;
        filter: opacity(0.5);
    }

    /* Content Type Toggle Styling */
    .mobile-top-navbar .content-type-toggle {
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        background: none;
        border: none;
        padding: 0 0; /* slightly reduce padding so toggle sits closer to menu icon */
        min-height: 35px;
        direction: rtl;
        text-align: right;
        margin-left: 5px;
        margin-top: -1px;
    }

    .mobile-top-navbar .content-type-row-1 {
        font-size: 11px;
        color: #666666;
        opacity: 0.5;
        line-height: 1.2;
        margin-bottom: 1px;
        font-weight: 400;
    }

    .mobile-top-navbar .content-type-row-2 {
        display: flex;
        align-items: center;
        /* Use a small fixed gap instead of space-between to control spacing */
        justify-content: flex-end;
        gap: 3px; /* requested 5px gap between title and arrow */
        width: 100%;
        
        line-height: 1.3;
    }

    .mobile-top-navbar .content-type-row-2 span {
        /* Match the title size more closely and prevent the arrow from looking oversized */
        font-size: 13px;
        color: #223636;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100px;
        line-height: 1.3;
        display: inline-block;
        vertical-align: middle;
    }

    .mobile-top-navbar .content-type-arrow {
        flex-shrink: 0;
        transition: transform 0.2s ease;
        /* Increase arrow to be clearly visible but balanced with the title */
        width: 20px !important;
        height: 20px !important;
        stroke-width: 2.4 !important;
        margin-left: 0; /* spacing handled by gap */
        display: inline-block;
        vertical-align: middle;
    }

    .mobile-top-navbar .content-type-toggle:hover .content-type-arrow {
        transform: translateY(1px);
    }

    /* Notification badge styles */
    .mobile-top-navbar .inbox-icon-container {
        position: relative;
    }

    .mobile-top-navbar .notification-badge {
        position: absolute;
        top: 2px;
        right: 2px;
        background-color: #348796;
        color: white;
        font-size: 10px;
        font-weight: bold;
        min-width: 16px;
        height: 16px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        padding: 0 3px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        z-index: 10;
    }
    
    /* NEW SIDEBAR STYLES */

    /* Sidebar Container */
    .mobile-sidebar-container {
        position: fixed;
        top: 0;
        left: -100%; /* Start off-screen to the left */
        width: 280px;
        height: 100%;
        background-color: #ffffff;
        z-index: 10001;
        transition: left 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Animate the 'left' property */
        box-shadow: 0 0 15px rgba(0,0,0,0.2);
        display: flex;
        flex-direction: column;
        direction: rtl; /* Set content direction to RTL */
    }

    .mobile-sidebar-container.show {
        left: 0; /* Slide in from the left */
    }

    /* Sidebar Header */
    .mobile-sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        border-bottom: 1px solid #e9e9e9;
    }

    .mobile-sidebar-header h4 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: #333;
    }

    .mobile-sidebar-header .close-btn {
        background: none;
        border: none;
        cursor: pointer;
        color: #888;
        padding: 0 5px;
        line-height: 1;
    }
    .mobile-sidebar-header .close-btn img {
        width: 30px;
        height: 30px;
        filter: opacity(0.5);
        transition: filter 0.2s ease;
    }
    .mobile-sidebar-header .close-btn:hover {
        opacity: 0.8;
    }

    /* Sidebar Body/Links */
    .mobile-sidebar-body {
        padding: 15px 0;
        overflow-y: auto;
        flex-grow: 1;
    }

    .mobile-sidebar-body a {
        display: block;
        padding: 13px 20px;
        text-decoration: none;
        color: #1c1e21;
        font-size: 16px;
        font-weight: 500;
        transition: background-color 0.2s ease;
    }

    .mobile-sidebar-body a:hover {
        background-color: #f2f3f5;
    }

    .sidebar-divider {
        border-top: 1px solid #e9e9e9;
        margin: 10px 0;
    }

    .mobile-sidebar-body .text-danger {
        color: #c0392b !important;
        font-weight: 600;
    }
    .mobile-sidebar-body .text-danger:hover {
        background-color: #c0392b1a;
    }

    /* Overlay for background */
    #mobile-sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 10000;
        opacity: 0;
        transition: opacity 0.35s ease;
        pointer-events: none;
    }

    #mobile-sidebar-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }

    /* Hide the old popup if it still exists */
    .mobile-popup {
        display: none !important;
    }
}

@media screen and (min-width: 801px) {
    .mobile-top-navbar, .mobile-sidebar-container, #mobile-sidebar-overlay {
        display: none;
    }
}

    /* ===== MAIN CONTAINER ===== */
    /* Home page main container with RTL direction */
    .home-container {max-width: 1200px; margin: 30px auto 120px auto; direction: rtl; padding: 0 0;}

    /* ===== WELCOME SECTION ===== */
    /* Welcome section layout and styling */
    .home-container .welcome-section { text-align: right; margin-bottom: 50px; }
    .home-container .welcome-section h1 { font-size: 32px; font-weight: 700; color: #223636; margin-bottom: 5px; display: flex; align-items: center; justify-content: flex-start; gap: 10px; }
    .home-container .welcome-section .welcome-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; }
    .home-container .welcome-section .welcome-icon svg { width: 40px; height: 40px; color: #348796; }
    .home-container .welcome-section p { font-size: 18px; color: #7f8c8d; line-height: 1.5; }
    /* ===== SECTION TITLES ===== */
    /* Section title bar and links styling */
    .home-container .section-title-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
    .home-container .section-title-bar .section-title { font-size: 20px; font-weight: 600; color: #223636; margin-bottom: 0; }
    .home-container .section-title-bar .see-all-link { font-size: 14px; font-weight: 800; color: #223636; opacity: 0.6; text-decoration: none; display: flex; align-items: center; transition: all 0.5s ease-in-out; }
    .home-container .section-title-bar .see-all-link:hover { opacity: 1; }
    .home-container .section-title-bar .see-all-link svg { width: 16px; height: 16px; margin-left: 5px; }
    /* ===== GRADES SECTION ===== */
    /* Grades grid layout */
    .home-container .grades-grid {display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 80px;}

    /* ===== GRADE CARDS ===== */
    /* Modern card design with soft colors */
    .home-container .grades-grid .grade-card { background-color:#088395; border-radius: 16px; padding: 24px; border: 1px solid #ddddddc0; transition: all 0.3s ease; display: flex; flex-direction: column; justify-content: flex-start; text-decoration: none; position: relative; height: 190px; overflow: hidden; animation: cardFadeIn 0.5s ease-out; will-change: transform, box-shadow; }
    .home-container .grades-grid .grade-card:hover { transform: translateY(-5px); box-shadow: rgba(0, 0, 0, 0.1) 0px 12px 30px; }
    .home-container .grades-grid .grade-card:focus { outline: none; box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.185); }
    /* ===== ANIMATIONS ===== */
    /* Card fade-in animation */
    @keyframes cardFadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
    /* ===== CARD OVERLAYS ===== */
    /* Gradient overlay for better text contrast */
    .home-container .grades-grid .grade-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 100%; background: linear-gradient(0deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 40%); z-index: 0; border-radius: 20px; } */
    /* Grade title and info layout */
    .home-container .grades-grid .grade-card .grade-card-content { display: flex; flex-direction: column; align-items: flex-start; z-index: 1; }
    .home-container .grades-grid .grade-card .grade-card-content .grade-title { font-size: 24px; font-weight: bold; color: white; margin-bottom: 8px; line-height: 1.2; text-shadow: 0 1px 2px rgba(0,0,0,0.1); }
    .home-container .grades-grid .grade-card .grade-card-content .grade-info { font-size: 18px; color: white; opacity: .8; margin-bottom: 10px; }
    /* ===== DISCOUNT BADGE ===== */
    /* Discount badge styling */
    .home-container .grades-grid .grade-card .discount-badge { position: absolute; bottom: 15px; right: 15px; background-color: rgba(255, 255, 255, 0.85); color: var(--card-color, #348796); font-size: 12px; font-weight: bold; padding: 4px 10px; border-radius: 8px; z-index: 2; box-shadow: 0 3px 8px rgba(0,0,0,0.08), 0 0 0 1px rgba(255,255,255,0.2); backdrop-filter: blur(4px); }

    /* ===== GRADE ILLUSTRATIONS ===== */
    /* Grade image container positioned at bottom left */
    .home-container .grades-grid .grade-card .grade-illustration-wrapper { position: absolute; bottom: 0px; left: 25px; z-index: 1; transition: transform 0.3s ease; }
    .home-container .grades-grid .grade-card:hover .grade-illustration-wrapper { transform: translateY(-8px) rotate(3deg); }
    .home-container .grades-grid .grade-card .grade-illustration-wrapper .grade-illustration { width: 100px; height: 100px; filter: brightness(0) invert(1); object-fit: contain; }
    .home-container .grades-grid .grade-card .grade-illustration-wrapper .grade-default-icon { width: 100px; height: 100px; display: flex; align-items: center; justify-content: center; }
    .home-container .grades-grid .grade-card .grade-illustration-wrapper .grade-default-icon svg { width: 100%; height: 100%; stroke: white; }
    /* ===== BACKGROUND PATTERNS ===== */
    /* Background dots pattern */
    .home-container .grades-grid .grade-card::before {content: ''; position: absolute; top: 0px; right: 0px; width: 100%; height: 200px; background-image: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 2px); background-size: 12px 12px; z-index: 0; opacity: 0.5;}

    /* ===== NEW BADGE ===== */
    /* New content badge */
    .home-container .grades-grid .grade-card .new-badge { position: absolute; top: 15px; left: 15px; background-color: #ffffff; color: var(--card-color, #FFC8B4); font-size: 12px; font-weight: bold; padding: 4px 8px; border-radius: 10px; z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
    /* ===== MOBILE OPTIMIZATIONS ===== */
    /* Mobile responsive styles for home container and grades */
    @media screen and (max-width: 800px) {
        .home-container { width: 100%; padding: 0; }
        .home-container .welcome-section, .home-container .section-title, .home-container .featured-grades, .home-container .recent-tests, .home-container .stats-section, .home-container .auth-cta { padding: 0; }
        .home-container .grades-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
        .home-container .grades-grid .grade-card { height: 160px; padding: 16px; }
        .home-container .grades-grid .grade-card .grade-card-content .grade-title { font-size: 20px; }
        .home-container .grades-grid .grade-card .grade-card-content .grade-info { font-size: 16px; }
        .home-container .grades-grid .grade-card .grade-illustration-wrapper { bottom: -25px; left: 15px; }
        .home-container .grades-grid .grade-card .grade-illustration-wrapper .grade-illustration, .home-container .grades-grid .grade-card .grade-illustration-wrapper .grade-default-icon { width: 80px; height: 80px; }
    }

/* ===== FEATURES SECTION (MODERN HORIZONTAL DESIGN) ===== */
/* تنسيق قسم المميزات والشبكة */
.home-container .features-section { margin: 80px 0 0 0; }

.home-container .features-section .features-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 15px; 
}

/* تنسيق البطاقة الأساسي */
.home-container .features-section .features-grid .feature-card { 
    background-color: white; 
    border-radius: 25px; /* زوايا مستديرة ناعمة */
    padding: 20px; 
    border: 1px solid #f0f0f0; 
    display: flex; 
    flex-direction: column; 
    align-items: stretch; /* لضمان تمدد المحتوى */
    text-align: right; 
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 160px;
}

.home-container .features-section .features-grid .feature-card:hover { 
    transform: translateY(-5px); 
    box-shadow: rgba(0, 0, 0, 0.05) 0px 10px 25px; 
}

/* التنسيق الجديد للرأس: العنوان والايقونة في سطر واحد */
.feature-header {
    display: flex !important;
    flex-direction: row-reverse !important; /* وضع الأيقونة يسار والعنوان يمين */
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 15px !important;
    width: 100% !important;
}

/* الدائرة الملونة للأيقونة (نفس شكل ملخصات شاملة) */
.home-container .features-section .features-grid .feature-card .feature-icon { 
    width: 50px !important; 
    height: 50px !important; 
    background-color: #09637E !important; /* لون براند MYQ */
    border-radius: 50% !important; 
    display: flex !important; 
    align-items: center !important; 
    justify-content: center !important; 
    margin-bottom: 0 !important; /* إلغاء التوسيط القديم */
    flex-shrink: 0 !important;
}

.home-container .features-section .features-grid .feature-card .feature-icon svg { 
    width: 24px !important; 
    height: 24px !important; 
    color: white !important; /* الأيقونة بيضاء داخل الدائرة */
    stroke: white !important;
}

/* تنسيق العنوان ليكون بجانب الأيقونة */
.home-container .features-section .features-grid .feature-card .feature-title { 
    font-size: 17px !important; 
    font-weight: 700 !important; 
    color: #09637E !important; 
    margin: 0 !important;
    text-align: right !important;
    flex-grow: 1 !important;
}

/* تنسيق الوصف أسفل العنوان */
.home-container .features-section .features-grid .feature-card .feature-description { 
    font-size: 13.5px; 
    color: #7f8c8d; 
    line-height: 1.5; 
    margin: 0 !important;
}

/* ===== FEATURES MOBILE ===== */
@media screen and (max-width: 800px) {
    .home-container .features-section .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media screen and (max-width: 480px) {
    .home-container .features-section .features-grid { grid-template-columns: 1fr; }
}
    /* ===== FAQ SECTION ===== */
    /* FAQ section layout and accordion styling */
    .home-container .faq-section { margin: 80px 0 0 0; }
    .home-container .faq-section .accordion { display: flex; flex-direction: column; gap: 10px; }
    .home-container .faq-section .accordion .accordion-item { background-color: white; border-radius: 12px; overflow: hidden; border: 1px solid #ddddddc0; }
    .home-container .faq-section .accordion .accordion-item .accordion-header { padding: 18px 20px; background-color: white; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: #223636; user-select: none; transition: background-color 0.2s; }
    .home-container .faq-section .accordion .accordion-item .accordion-header:hover { background-color: #f8f9fa; }
    .home-container .faq-section .accordion .accordion-item .accordion-header.active { background-color: #effdfb; }
    .home-container .faq-section .accordion .accordion-item .accordion-content { padding: 0 20px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; }
    .home-container .faq-section .accordion .accordion-item .accordion-content.active { max-height: 200px; padding: 10px 20px 20px 20px; }
    .home-container .faq-section .accordion .accordion-item .accordion-content .accordion-text { color: #7f8c8d; line-height: 1.5; }
    .home-container .faq-section .accordion .accordion-item .accordion-header .accordion-icon { transition: transform 0.3s ease; }
    .home-container .faq-section .accordion .accordion-item .accordion-header.active .accordion-icon { transform: rotate(180deg); }

    /* ===== STATISTICS SECTION ===== */
    /* Statistics section layout and cards */
    .home-container .stats-section { margin-bottom: 80px; }
    .home-container .stats-section .stats-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
    .home-container .stats-section .stats-cards .stat-card { background-color: #fff; border-radius: 20px; padding: 20px; border: 1px solid #ddddddc0; transition: all 0.3s ease; text-align: center; }
    .home-container .stats-section .stats-cards .stat-card:hover { transform: translateY(-5px); box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px; }
    .home-container .stats-section .stats-cards .stat-card .stat-icon { width: 50px; height: 50px; margin: 0 auto 15px; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
    .home-container .stats-section .stats-cards .stat-card:nth-child(1) .stat-icon { background-color: rgba(52, 152, 219, 0.1); color: #348796; }
    .home-container .stats-section .stats-cards .stat-card:nth-child(2) .stat-icon { background-color: rgba(46, 204, 113, 0.1); color: #2ecc71; }
    .home-container .stats-section .stats-cards .stat-card:nth-child(3) .stat-icon { background-color: rgba(155, 89, 182, 0.1); color: #9b59b6; }
    .home-container .stats-section .stats-cards .stat-card .stat-value { font-size: 32px; font-weight: bold; color: #223636; margin-bottom: 5px; }
    .home-container .stats-section .stats-cards .stat-card .stat-label { font-size: 14px; color: #7f8c8d; }
    /* ===== EMPTY STATS STATE ===== */
    /* Empty statistics state styling */
    .home-container .stats-section .empty-stats-state { text-align: center; background-color: #fff; border-radius: 20px; padding: 30px; border: 1px solid #ddddddc0; }
    .home-container .stats-section .empty-stats-state svg { width: 60px; height: 60px; color: #bdc3c7; margin-bottom: 15px; }
    .home-container .stats-section .empty-stats-state h3 { font-size: 18px; color: #223636; margin-bottom: 10px; }
    .home-container .stats-section .empty-stats-state p { color: #7f8c8d; margin-bottom: 20px; font-size: 14px; }
    .home-container .stats-section .empty-stats-state .take-quiz-btn { display: inline-block; background-color: #348796; color: white; padding: 12px 24px; border-radius: 10px; font-size: 15px; font-weight: 600; text-decoration: none; transition: all 0.3s ease; box-shadow: 0 2px 5px rgba(52, 152, 219, 0.2); }
    .home-container .stats-section .empty-stats-state .take-quiz-btn:hover { background-color: #223636; color: white; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); }
    /* ===== STATISTICS MOBILE ===== */
    /* Mobile optimizations for statistics section */
    @media screen and (max-width: 800px) {
        .home-container .stats-section .stats-cards { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: auto auto; gap: 10px; }
        .home-container .stats-section .stats-cards .stat-card:nth-child(3) { grid-column: 1 / span 2; }
    }

    /* ===== EMPTY STATE ===== */
    /* Empty state styling */
    .home-container .empty-state { text-align: center; padding: 40px 20px; background-color: #fff; border-radius: 20px; border: 1px solid #ddddddc0; margin-bottom: 40px; }
    .home-container .empty-state svg { width: 60px; height: 60px; color: #bdc3c7; margin-bottom: 15px; }
    .home-container .empty-state h3 { font-size: 18px; color: #223636; margin-bottom: 10px; }
    .home-container .empty-state p { color: #7f8c8d; margin-bottom: 20px; font-size: 14px; max-width: 80%; margin-left: auto; margin-right: auto; }
    .home-container .empty-state .action-button { display: inline-block; background-color: #348796; color: white; padding: 12px 24px; border-radius: 10px; font-size: 15px; font-weight: 600; text-decoration: none; transition: all 0.3s ease; box-shadow: 0 2px 5px rgba(52, 152, 219, 0.2); }
    .home-container .empty-state .action-button:hover { background-color: #223636; color: white; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); }

    /* ===== USER TYPE OPTIONS ===== */
    /* User type selection options */
    .home-container .user-type-option { background-color: #fff; color: #333; padding: 15px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; text-align: center; font-size: 18px; font-weight: bold; border: none; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); position: relative; }
    .home-container .user-type-option:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
    .home-container .user-type-option.selected { background-color: #348796; color: white; box-shadow: 0 4px 12px #34d5db4d; }

    /* ===== SWIPER FOG EFFECTS ===== */
    /* Swiper fog effects for mobile scrolling */
    .home-container .swiper-fog { position: absolute; top: 0; bottom: 0; width: 50px; z-index: 100; pointer-events: none; opacity: 0; transition: opacity 0.3s ease-in-out; display: none; }
    .home-container .swiper-fog-left { left: 0; background: linear-gradient(to right, rgba(248, 249, 250, 1) 20%, rgba(248, 249, 250, 0)); }
    .home-container .swiper-fog-right { display: none; }

    /* ===== SWIPER FOG MOBILE ===== */
    /* Mobile swiper fog visibility */
    @media screen and (max-width: 800px) {
        .home-container .swiper-fog { display: block; }
        .home-container .swiper-fog.visible { opacity: 1; }
        .home-container .swiper-fog.hidden { opacity: 0; }
    }

    /* ===== TESTS SECTION ===== */
    /* Tests section layout and styling */
    .home-container .recent-tests { margin-bottom: 40px; }
    .home-container .recent-tests .test-list { display: flex; flex-direction: column; gap: 10px; }
    .home-container .recent-tests .test-list .test-item { background-color: #ffffff; border-radius: 12px; border: 1px solid #ddddddc0; transition: all 0.2s ease-in-out; text-decoration: none; display: block; padding: 5px; position: relative; }
    .home-container .recent-tests .test-list .test-item:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.07); }
    .home-container .recent-tests .test-list .test-item .test-item-content { padding: 16px; color: #374151; }
    .home-container .recent-tests .test-list .test-item .test-item-content .test-category { font-size: 12px; color: #6b7280; margin-bottom: 4px; text-transform: uppercase; }
    .home-container .recent-tests .test-list .test-item .test-item-content .test-details { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
    .home-container .recent-tests .test-list .test-item .test-item-content .test-details .test-info { flex: 1; }
    .home-container .recent-tests .test-list .test-item .test-item-content .test-details .test-info .test-title { font-size: 16px; font-weight: 600; color: #1f2937; margin: 0 0 4px 0; line-height: 1.4; }
    .home-container .recent-tests .test-list .test-item .test-item-content .test-details .test-info .test-description { font-size: 14px; color: #6b7280; margin: 0 0 8px 0; line-height: 1.5; }
    .home-container .recent-tests .test-list .test-item .test-item-content .test-details .test-info .test-meta-bar { display: flex; align-items: center; gap: 16px; font-size: 13px; color: #6b7280; }
    .home-container .recent-tests .test-list .test-item .test-item-content .test-details .test-info .test-meta-bar .test-meta-item { display: flex; align-items: center; gap: 4px; }
    .home-container .recent-tests .test-list .test-item .test-item-content .test-details .test-info .test-meta-bar .test-meta-item svg { width: 14px; height: 14px; color: #9ca3af; }
    .home-container .recent-tests .test-list .test-item .test-item-content .test-details .test-progress-indicator { display: flex; align-items: center; justify-content: center; }
    .home-container .recent-tests .test-list .test-item .test-item-content .test-details .test-progress-indicator .test-percentage { font-size: 13px; font-weight: 500; color: #348796; background-color: rgba(52, 152, 219, 0.1); padding: 3px 8px; border-radius: 6px; }
    .home-container .recent-tests .test-list .test-item.completed .test-progress-indicator { background-color: transparent; border-color: transparent; }

    /* ===== MOBILE RESPONSIVE STYLES ===== */
    /* Mobile responsive styles for grades and tests */
    @media screen and (max-width: 480px) {
        .home-container .grades-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
        .home-container .grades-grid .grade-card { height: 130px; padding: 14px; }
        .home-container .grades-grid .grade-card .grade-card-content .grade-title { font-size: 17px; }
        .home-container .grades-grid .grade-card .grade-card-content .grade-info { font-size: 13px; }
        .home-container .grades-grid .grade-card .discount-badge { bottom: 15px; right: 15px; font-size: 10px; padding: 3px 5px; border-radius: 6px; }
        .home-container .grades-grid .grade-card .grade-illustration-wrapper .grade-illustration, .home-container .grades-grid .grade-card .grade-illustration-wrapper .grade-default-icon { width: 70px; height: 70px; }
        .home-container .recent-tests .test-list { gap: 5px; }
        .home-container .recent-tests .test-list .test-item .test-item-content { padding: 10px; }
        .home-container .recent-tests .test-list .test-item .progress-circle { width: 30px; height: 30px; }
        .home-container .recent-tests .test-list .test-item .progress-text { font-size: 10px; }
        .home-container .recent-tests .test-list .test-item .test-item-content .test-details .test-info .test-title { font-size: 15px; }
        .home-container .recent-tests .test-list .test-item .test-item-content .test-details .test-info .test-description, .home-container .recent-tests .test-list .test-item .test-item-content .test-details .test-info .test-meta-bar { font-size: 13px; }
        .home-container .recent-tests .test-list .test-item .test-item-content .test-category { font-size: 11px; }
        .home-container .recent-tests .test-list .test-item .test-percentage { font-size: 13px; }
    }

    /* ===== MOBILE MODAL STYLES ===== */
    /* Mobile modal styles for sliding from bottom */
    @media screen and (max-width: 800px) {
        .modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; display: none; background-color: transparent; }
        .modal.open { display: flex; visibility: visible; opacity: 1; }
        .modal .modal-content { position: fixed; bottom: 0; left: 0; right: 0; width: 100vw; max-width: 100vw; margin: 0; border-radius: 20px 20px 0 0; transform: translateY(100%); transition: transform 0.3s ease-in-out; z-index: 1001; max-height: 80vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 20px); box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); overscroll-behavior: contain; }
        .modal.open .modal-content { transform: translateY(0); }
        .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.5); z-index: 1000; opacity: 0; transition: opacity 0.3s ease; }
        .modal.open .modal-overlay { opacity: 1; }
        /* ===== MOBILE MODAL HEADER ===== */
        /* Mobile modal header with back button */
        .modal-mobile-header { display: flex; align-items: center; padding: 15px 0; border-bottom: 1px solid #eee; }
        .modal-back-button { background: none; border: none; padding: 0; margin-right: 5px; cursor: pointer; order: 2; margin-left: auto; margin-right: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
        .modal-back-button:active { background-color: rgba(0, 0, 0, 0.05); }
        .modal-back-button svg { width: 24px; height: 24px; color: #333; }
        .modal-title { flex-grow: 1; text-align: center; font-size: 18px; font-weight: 600; margin: 0; }
        /* ===== MOBILE MODAL BODY ===== */
        /* Modal body styles */
        .modal-body { padding: 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; max-height: calc(90vh - 60px); padding-bottom: 40px; }
    }

    .menu {
        border-left: 0.2px solid #e9e9e9;
        width: 80px;
        position: fixed;
        right: 0;
        top: 0;
        z-index: 2002;
        background-color: #F3F6F8;
    }

    .menu .sticky {
        position: sticky;
        top: 0;
        height: calc(100vh);
        overflow-y: auto;
        scrollbar-width: none;
    }

    .menu .sticky a {
        text-decoration: none;
    }

    .menu .logo {
        position: fixed;
        top: 20px;
        display: block;
        padding: 10px;
    }

    .menu .logo img {
        width: 60px;
        transition: ease-in-out 0.2s all;
        margin: auto;
    }

    .menu .logo img:hover {
        transform: scale(1.05);
    }

    .menu .links {
        position: fixed;
        top: 45%;
        transform: translateY(-50%);
    }

    .menu .links .link {
        display: block;
        padding: 15px 20px;
    }

    .menu .links .link .linkIcon span,
    .menu .bottomLinks .link .linkIcon span {
        visibility: hidden;
    }

    .menu .links .link .linkIcon img {
        width: 40px;
        filter: opacity(30%);
    }

    /* Ensure the link icon container can host an absolute-positioned badge */
    .menu .links .link .linkIcon {
        position: relative;
    }

    /* Notification badge for inbox */
    .menu .links .link .notification-badge {
        position: absolute;
        top: -4px;
        right: -2px;
        background-color: #348796;
        color: white;
        font-size: 10px;
        font-weight: bold;
        min-width: 22px;
        height: 22px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        padding: 0 3px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }

    /* Override generic span hiding so notification badge remains visible on desktop
   and ensure it has full opacity and sits above other sidebar elements.
   Use a selector at least as specific as the original rule that targets
   `.linkIcon span` so we reliably override it. */
    .menu .links .link .linkIcon span.notification-badge,
    .menu .links .link .linkIcon .notification-badge,
    .menu .bottomLinks .link .linkIcon span.notification-badge,
    .menu .bottomLinks .link .linkIcon .notification-badge {
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 2025 !important;
        pointer-events: auto !important;
    }

    .menu .links .link:hover img {
        filter: opacity(100%);
        transition: all 0.3s ease-out;
        transform: scale(1.1);
    }

    .menu .bottomLinks {
        margin-top: 0;
        position: fixed;
        bottom: 20px;
        display: grid;
        grid-template-columns: 1fr;
    }

    .menu .bottomLinks .link {
        display: block;
        padding: 10px 20px;
        cursor: pointer;
    }

    .menu .bottomLinks .link .linkIcon img {
        width: 40px;
        filter: opacity(60%);
    }

    .menu .bottomLinks .link:hover img {
        filter: opacity(100%);
        transition: all 0.3s ease-out;
        transform: scale(1.1);
    }

    /* Letter-avatar styles: light, less saturated backgrounds with a solid letter color */
    .profile-avatar-container .avatar {
        /* Base small avatar (mobile) */
        width: 30px;
        height: 30px;
        min-width: 30px;
        min-height: 30px;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 18px;
        line-height: 1;
        box-sizing: border-box;
        text-transform: uppercase;
        /* Even darker visible fallback so letter is highly readable before JS runs */
        background-color: #b2d6d7;
        /* noticeably darker light teal */
        color: #031919;
        /* very dark letter color for maximum contrast */
        padding: 6px;
        /* some breathing room */
        flex-shrink: 0;
        border: 1px solid rgba(0, 0, 0, 0.06);
        transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
        will-change: transform, box-shadow;
    }

    /* default wrapper used when no avatar is set; will be replaced by letter avatar when JS runs */
    .profile-avatar-container .default-avatar-wrapper {
        width: 30px;
        height: 30px;
        border-radius: 10px;
        background-color: #ffffff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        overflow: hidden;
    }

    /* If an <img> is still present (fallback), hide it visually but keep for accessibility if needed */
    .profile-avatar-container .default-avatar-wrapper img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0;
        /* hidden visually; letter avatar will show */
        pointer-events: none;
    }

    /* Popup styles */
    .popup {
        display: none;
        position: fixed;
        right: 20px;
        /* Adjust as needed */
        bottom: 20px;
        /* Adjust as needed */
        background-color: white;
        border: 1px solid #ccc;
        padding: 10px;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        z-index: 1002;
        /* Ensure it is above the menu */
        direction: rtl;
        border-radius: 10px;
        width: 230px;
        transition: opacity 0.3s ease-in-out;
    }

    .popup.show {
        display: block;
    }

    .popup a {
        display: block;
        padding: 5px 10px;
        text-decoration: none;
        color: #333;
        border-radius: 8px;
    }

    .popup a:hover {
        background-color: #f0f0f0;
    }

    /* Mobile styles */
    @media screen and (max-width: 800px) {
        .menu {
            display: block;
            width: 100%;
            height: 60px;
            right: 0;
            bottom: 0;
            top: auto;
            border-left: none;
            border-top: 0.2px solid #e9e9e9;
            background-color: #FFF;
            transition: transform 0.3s ease-in-out;
            z-index: 2002;
        }

        .menu.hidden {
            transform: translateY(100%);
        }

        .menu .sticky {
            position: relative;
            height: 100%;
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            align-items: center;
            justify-items: center;
            padding: 0;
            margin: 0;
            direction: rtl;
        }

        .menu .logo {
            display: none;
            /* Remove logo from bottom nav */
        }

        .menu .links {
            position: static;
            transform: none;
            display: contents;
            /* Allows grid to control layout */
        }

        .menu .bottomLinks {
            position: static;
            display: contents;
            /* Allows grid to control layout */
            margin-top: 0;
            bottom: auto;
        }

        #listLinkForSidebar {
            display: none;
            /* Hide list icon in bottom nav; it's in top navbar */
        }

        .menu .links .link,
        .menu .bottomLinks .link {
            padding: 0;
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .menu .links .link .linkIcon,
        .menu .bottomLinks .link .linkIcon {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
        }

        .menu .links .link .linkIcon img,
        .menu .bottomLinks .link .linkIcon img {
            width: 30px;
        }

        .profile-avatar-container .avatar {
            width: 30px;
            height: 30px;
            min-width: 30px;
            min-height: 30px;
            padding: 4px;
        }

        .profile-avatar-container .default-avatar-wrapper {
            width: 30px;
            height: 30px;
            border-radius: 6px;
        }

        /* NOTE: desktop-specific larger avatar rules and hover effects moved outside the mobile media block */

        .menu .links .link .linkIcon span,
        .menu .bottomLinks .link .linkIcon span {
            visibility: visible;
            font-size: 12px;
            color: #000;
            opacity: .5;
            font-weight: 300;
        }

        .menu .links .link .notification-badge {
            top: -2px;
            right: 6px;
            min-width: 16px;
            height: 16px;
            padding: 0 3px;
        }

        /* Ensure the notification badge isn't affected by the reduced label opacity on mobile */
        .menu .links .link .linkIcon span.notification-badge,
        .menu .links .link .linkIcon .notification-badge,
        .menu .bottomLinks .link .linkIcon span.notification-badge,
        .menu .bottomLinks .link .linkIcon .notification-badge {
            visibility: visible !important;
            opacity: 1 !important;
            z-index: 2025 !important;
            pointer-events: auto !important;
            color: white !important;
            font-size: 8px !important;

        }

        .popup {
            top: 60px;
            /* Below mobile top navbar */
            left: 10px;
            max-height: 250px;
            transform: none;
            background-color: white;
            border-radius: 10px;
        }
    }

    /* Larger avatar on wide screens for better presence */
    @media screen and (min-width: 1200px) {
        .profile-avatar-container .avatar {
            width: 40px;
            height: 40px;
            min-width: 40px;
            min-height: 40px;
            font-size: 22px;
            border-radius: 10px;
            padding: 8px;
        }

        .profile-avatar-container .default-avatar-wrapper {
            width: 40px;
            height: 40px;
            border-radius: 12px;
        }

        /* Slight lift on hover for desktop */
        .menu .bottomLinks .link:hover .avatar,
        .menu .links .link:hover .avatar {
            transform: translateY(-2px) scale(1.02);
            box-shadow: 0 6px 14px rgba(30, 50, 60, 0.08);
        }
    }

    /* Subtle hover effect for all sizes */
    .menu .bottomLinks .link:hover .avatar,
    .menu .links .link:hover .avatar {
        transform: translateY(-1px);
        box-shadow: 0 4px 10px rgba(20, 30, 35, 0.06);
    }


<!-- Rotator styles and script (applies to all grade cards) -->

/* Rotator styles for grade stats: single display element that fades/translates */
.grade-stats-rotator { position: relative; overflow: hidden; height: 26px; }
.grade-stat-display { display: block; cfont-weight: 600; transition: opacity 420ms cubic-bezier(.2,.8,.2,1), transform 420ms cubic-bezier(.2,.8,.2,1); will-change: opacity, transform; }
.grade-stat-hidden { opacity: 0; transform: translateY(6px); }
.grade-stat-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .grade-stat-display { transition: none !important; }
}


.main-slider {
    margin-bottom: 60px;
    width: 100%;
}

.swiper {
    width: 100%;
    height: 300px;
    border-radius: 30px; /* نفس انحناء البطاقات */
    overflow: hidden;
}

.slider-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 50px;
    color: white;
    direction: rtl;
}

.slider-content .text-side h2 {
    font-size: 30px;
    margin-bottom: 10px;
}

.slider-content .slider-btn {
    display: inline-block;
    padding: 10px 25px;
    background: white;
    color: #09637E;
    border-radius: 12px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 15px;
}

.slider-content .image-side img {
    height: 200px;
    object-fit: contain;
}

/* تخصيص نقاط التنقل */
.swiper-pagination-bullet-active {
    background: white !important;
}

/* للجوال */
@media screen and (max-width: 600px) {
    .swiper { height: 200px; }
    .slider-content { padding: 0 20px; }
    .slider-content .text-side h2 { font-size: 20px; }
    .slider-content .image-side img { height: 100px; }
}
        /* ===== FONT FACES ===== */
        /* Use IBM Plex Sans Arabic from Google Fonts and map it to the project's
           existing family names ('IBM-Regular' and 'IBM-Bold'). We reference
           the Google-hosted woff2 files directly so the fonts load reliably
           even after removing local TTF files.
        */
        @font-face {
            font-family: 'IBM-Regular';
            src: url('https://fonts.gstatic.com/s/ibmplexsansarabic/v14/Qw3CZRtWPQCuHme67tEYUIx3Kh0PHR9N6Ys43PWrfQ.woff2') format('woff2');
            font-weight: 400;
            font-style: normal;
            font-display: swap;
        }

        @font-face {
            font-family: 'IBM-Bold';
            src: url('https://fonts.gstatic.com/s/ibmplexsansarabic/v14/Qw3NZRtWPQCuHme67tEYUIx3Kh0PHR9N6YOG-eCRXMR5Kw.woff2') format('woff2');
            font-weight: 700;
            font-style: normal;
            font-display: swap;
        }
        
        @import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&display=swap');

        
        /* Force Amiri for all MathJax elements with maximum specificity */
        .MathJax .mtext { font-family: 'Amiri', !important; }
        
        /* Override MathJax's internal font settings */
        .MathJax .mi, .MathJax .mn {
            font-family: 'Amiri', !important;
        }
        
        /* ===== CAPACITOR APP FIXES ===== */
        /* Fix input fields for Arabic text in Capacitor WebView */
        .blank-input, .typeinblank-slot input, .fillblank-slot input, .tfwb-slot input, input.blank-input {
            font-family: 'IBM-Regular', 'Tahoma', Arial, sans-serif !important;
            direction: rtl !important;
            text-align: center !important;
            -webkit-text-fill-color: #223636 !important;
            -webkit-opacity: 1 !important;
            opacity: 1 !important;
            color: #223636 !important;
            -webkit-user-select: auto !important;
            user-select: auto !important;
            -webkit-writing-mode: horizontal-tb !important;
        }
        
        /* Ensure all text inputs support RTL */
        input[type="text"], textarea { -webkit-text-fill-color: #223636 !important; -webkit-opacity: 1 !important; unicode-bidi: plaintext !important; }

        /* ===== GLOBAL RESET ===== */
        /* Universal reset and scrollbar hiding */
        * { box-sizing: border-box; margin: 0; padding: 0; -ms-overflow-style: none; scrollbar-width: none; }

        ::-webkit-scrollbar { width: 0; background: transparent; }
        *::-webkit-scrollbar { display: none; }

        /* ===== BASE ELEMENTS ===== */
        /* Basic element styling */
        body { font-family: 'IBM-Regular', Arial, sans-serif; background-color: #F3F6F8; color: #223636; line-height: 1.6; overflow-x: hidden; direction: rtl; }
        h1, h2, h3, h4, h5, h6 { font-family: 'IBM-Bold', Arial, sans-serif; color: #223636; }
        strong, b { margin: 0 3px; }
        a { color: #348796; text-decoration: none; transition: color 0.3s ease; }
        a:hover, a:focus { color: #223636; outline: none; }
        button, input { font-family: 'IBM-Bold', Arial, sans-serif; }

        /* Prevent blue/gray tap highlight on mobile (iOS/Android) and improve touch responsiveness for interactive elements like links and buttons. */
        a, a * , button, input, label { -webkit-tap-highlight-color: transparent; touch-action: manipulation; -ms-touch-action: manipulation; -webkit-user-select: text; user-select: text; }

        /* Remove default outline for focus but keep an accessible visible focus style when needed */
        a:focus, button:focus, input:focus { outline: none; }

        /* ===== LAYOUT COMPONENTS ===== */
        /* Main layout and action elements */
        .action { font-family: 'IBM-Bold', Arial, sans-serif; border: none; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; }
        .abstractAction { font-size: 16px; }
        .content { margin-right: 80px; padding: 30px 0 0 0; min-height: 100vh; background-color: #F3F6F8; transition: margin-left 0.3s ease; position: relative; }

        /* ===== MESSAGES SYSTEM ===== */
        /* Notification messages styling */
        .messages { position: fixed; top: 10px; left: calc(50% - 40px); transform: translateX(-50%); width: 600px; list-style: none; padding: 0; z-index: 2010; }
        .messages li { position: relative; padding: 20px 25px; border-radius: 12px; font-size: 16px; animation: slideIn 0.3s ease forwards; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); direction: rtl; margin-bottom: 10px; }
        .messages .success { background-color: #d1f1e5; color: #0c6044; }
        .messages .error, .messages .warning { background-color: #f8d7da; color: #721c24; }
        .messages .info { background-color: #d1ecf1; color: #0c5460; }
        .messages .close-btn { display: none; }

        /* ===== TRANSLATION POPUP ===== */
        /* Translation popup styling */
        .translation-popup { position: absolute; background-color: #fff; border: 1px solid #ccc; padding: 10px 15px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); border-radius: 5px; z-index: 2000; opacity: 0; transition: opacity 0.2s ease; }
        .translation-popup.visible { opacity: 1; }

        /* ===== MATHEMATICAL EXPRESSIONS ===== */
        /* Mathematical expressions and fraction styles */
        .math-exp { direction: rtl; unicode-bidi: embed; display: inline-flex !important; align-items: center !important; flex-wrap: wrap !important; gap: 5px !important; }
        .math-exp p { display: inline !important; margin: 0 !important; padding: 0 !important; }
        .math-exp sup, .math-exp .sup { vertical-align: super !important; font-size: smaller !important; }
        .math-exp sub, .math-exp .sub { vertical-align: sub !important; font-size: smaller !important; }

        /* CRITICAL: MathJax renders correctly with MathJax v2 Arabic extension
           DO NOT force direction/unicode-bidi on MathJax elements
           The Arabic extension handles this internally and correctly
           Forcing direction breaks the RTL text algorithm */
        .MathJax { display: inline !important; vertical-align: baseline !important; }
        .mjx-math { display: inline !important; }
        .mjx-chtml { display: inline !important; }
        .mjx-mtext { direction: inherit !important; text-align: inherit !important; font-family: inherit !important; }
        .mjx-mrow { display: inline !important; }

        /* ===== FRACTION CONTAINERS ===== */
        /* Support for both div and span fraction containers */
        .fraction-container, div.fraction-container, span.fraction-container { display: inline-block !important; text-align: center !important; vertical-align: middle !important; margin: 0 3px !important; line-height: 1.2em !important; height: auto !important; }
        .fraction-container .numerator, .fraction-container span.numerator { display: block !important; border-bottom: 1px solid black !important; padding-bottom: 0.1em !important; font-size: 0.9em !important; }
        .fraction-container .denominator, .fraction-container span.denominator { display: block !important; padding-top: 0.1em !important; font-size: 0.9em !important; }
        .small-fraction-container .fraction-container { font-size: 0.9em; }

        /* ===== MIXED NUMBERS ===== */
        /* Mixed number wrapper styling */
        .mixed-number-wrapper { display: inline-flex; align-items: baseline; direction: ltr; }
        .mixed-number-wrapper .whole-number { margin-right: 0.15em; }

        /* ===== MATHEMATICAL SYMBOLS ===== */
        /* Square root and cube root styling */
        .overline { text-decoration: overline !important; }
        .sqrt-wrapper { display: inline-flex; align-items: center; }
        .sqrt-wrapper .sqrt-symbol { display: inline-block; transform: scaleX(-1); margin-left: 0.1em; }
        .sqrt-wrapper .radicand { text-decoration: overline; padding-right: 0.1em; }
        .cuberoot-symbol-wrapper { display: inline-flex; align-items: baseline; position: relative; }
        .cuberoot-symbol-wrapper .cuberoot-index { font-size: 0.7em; vertical-align: super; margin-right: -0.2em; position: relative; top: -0.4em; }

        /* ===== EXAM & QUESTION STYLING ===== */
        /* Styles for tables, questions, answers, and commentary, adapted from exam analysis files */
        .table-responsive { overflow-x: auto; }
        table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
        th, td { border: 1px solid #ccc; padding: 12px; text-align: right; vertical-align: top; }
        th { background-color: #3498db; color: white; font-weight: bold; }
        caption { caption-side: top; font-size: 1.5em; font-weight: bold; margin-bottom: 15px; color: #0056b3; }
        .question-text { font-weight: bold; color: #2980b9; }
        .options { padding-right: 20px; }
        .correct-answer { font-weight: bold; color: #27ae60; }
        .explanation, .commentary { text-align: justify; direction: rtl !important; unicode-bidi: embed !important; }
        .commentary p { margin-bottom: 0.5em; }
        .commentary strong, .commentary .highlight { color: #c0392b; font-weight: bold; }
        .commentary ul, .commentary ol { margin-right: 20px; padding-right: 0; margin-top: 5px; margin-bottom: 5px; }
        .commentary li { margin-bottom: 5px; }
        .textbook-ref, .curriculum-ref, .source-ref { display: block; border-top: 1px dashed #cccccc; padding-top: 6px; margin-top: 10px; color: #586069; }
        .expand-section { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #ccc; }
        .code-snippet, .code-block { font-family: 'Courier New', Courier, monospace; direction: ltr; text-align: left; background-color: #e0f2f1; padding: 8px; border-radius: 4px; border: none; display: block; white-space: pre; overflow-x: auto; word-break: break-word; scrollbar-width: thin; scrollbar-color: #348796 #F3F6F8; }
        .code-snippet::-webkit-scrollbar, .code-block::-webkit-scrollbar { height: 8px; display: block; }
        .code-snippet::-webkit-scrollbar-track, .code-block::-webkit-scrollbar-track { background-color: #F3F6F8; }
        .code-snippet::-webkit-scrollbar-thumb, .code-block::-webkit-scrollbar-thumb { background-color: #348796; border-radius: 10px; border: 2px solid #F3F6F8; }
        .code-snippet { display: inline-block; padding: 1px 6px; margin: 2px 4px -8px 4px; }
        .has-image, .commentary-has-image { text-align: center; }
        .question-image-note { color: #6c757d; font-style: italic; font-size: 0.9em; }

        /* ===== LOADING OVERLAYS ===== */
        /* Internal navigation skeleton loading */
        .skeleton-loading-overlay { position: fixed; top: 0; right: 40px; width: 100%; height: 100%; background-color: #F3F6F8; z-index: 2001; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
        .skeleton-loading-overlay.active { opacity: 1; pointer-events: auto; }
        .skeleton-loading-overlay .skeleton-wrapper { width: 600px; margin: 56px auto 50px auto; background-color: #F3F6F8; padding: 60px 0 60px 0; direction: rtl; }
        .skeleton-loading-overlay .skeleton { background: #e0e6ed; position: relative; overflow: hidden; }
        .skeleton-loading-overlay .skeleton::after { content: ''; position: absolute; top: 0; left: -150%; width: 150%; height: 100%; background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 100%); animation: shimmer 1.5s infinite; }
        .skeleton-loading-overlay .skeleton-heading { width: 70%; height: 40px; margin-bottom: 10px; border-radius: 12px; }
        .skeleton-loading-overlay .skeleton-subheading { width: 40%; height: 20px; margin-bottom: 20px; border-radius: 8px; }
        .skeleton-loading-overlay .skeleton-piece2-list { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; width: 600px; margin: 0 auto; margin-bottom: 15px; }
        .skeleton-loading-overlay .skeleton-piece2 { height: 140px; border-radius: 16px; }
        .skeleton-loading-overlay .skeleton-piece3 { width: 600px; height: 140px; margin: 0 auto 15px auto; border-radius: 16px; }

        /* ===== ANIMATIONS ===== */
        /* Animation keyframes */
        @keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

        @keyframes slideIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

        @keyframes slideOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-20px); } }

            /* ===== INITIAL LOAD OVERLAY ===== */
        /* Facebook-style initial page load overlay for external navigation
           Hide the overlay by default to prevent blocking content rendering.
           Only show it when explicitly needed for external navigation.
        */
        .initial-load-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #F3F6F8; display: none; justify-content: center; align-items: center; z-index: 2015; opacity: 1; visibility: visible; transition: opacity 0.8s ease, visibility 0.8s ease; }
        .initial-load-overlay.show { display: flex; }
        .initial-load-overlay.hidden { opacity: 0; visibility: hidden; }
        .initial-load-overlay .fb-spinner-container { display: flex; flex-direction: column; align-items: center; justify-content: center; }
        .initial-load-overlay .logo-container { position: relative; margin-bottom: 35px; }
        .initial-load-overlay .logo { width: 200px; height: 200px; object-fit: contain; }
        .initial-load-overlay .fb-spinner-wrapper { position: relative; width: 90px; height: 5px; }
        .initial-load-overlay .fb-spinner { position: absolute; width: 90px; height: 5px; background-color: #e4e6eb; border-radius: 2.5px; overflow: hidden; }
        .initial-load-overlay .fb-spinner::after { content: ''; position: absolute; width: 70%; height: 100%; background-color: #348796; border-radius: 2.5px; animation: fbProgress 1.5s ease infinite; transform: translateX(-100%); }

        /* ===== FACEBOOK PROGRESS ANIMATION ===== */
        /* Facebook-style progress bar animation */
        @keyframes fbProgress { 0% { transform: translateX(-100%); } 50% { transform: translateX(30%); } 100% { transform: translateX(200%); } }

        /* ===== FOOTER ===== */
        /* Footer styling */
        .footer { width: 600px; margin: auto; position: relative; right: 40px; text-align: center; padding: 20px 0; margin-top: 40px; font-size: 14px; color: #6c757d; border-top: 1px solid #e7e7e7; }

        /* ===== RESPONSIVE DESIGN ===== */
        /* Mobile and tablet responsive styles */
        @media screen and (max-width: 800px) { body { background-color: #FFFFFF; }
        .content { background-color: #FFFFFF; margin-right: 0; padding: 15px 15px 0 15px; }
        .messages { left: calc(50%); transform: translateX(-50%); width: 90%; max-width: 500px; }
        .initial-load-overlay .logo-container { display: none; }
        .skeleton-loading-overlay { right: 0; background-color: #FFFFFF; }
        .skeleton-loading-overlay .skeleton-wrapper { width: 100%; padding: 40px 15px 15px 15px; background-color: #FFFFFF; }
        .skeleton-loading-overlay .skeleton-piece2-list { width: 100%; padding: 0; gap: 10px; margin-bottom: 10px; }
        .skeleton-loading-overlay .skeleton-piece2 { height: 120px; }
        .skeleton-loading-overlay .skeleton-piece3 { width: 100%; padding: 0; margin-bottom: 10px; }
        .initial-load-overlay { background: #FFFFFF; }
        .initial-load-overlay .logo { width: 150px; height: 150px; }
        .initial-load-overlay .fb-spinner-wrapper { width: 60px; height: 4px; }
        .initial-load-overlay .fb-spinner { width: 60px; height: 4px; }
        .footer { width: 100%; margin-bottom: 0; right: 0; }
        }

        /* Ensure math-rendered titles don't stretch full width */
        .question-title .dynamic-math-render, .thread-question-title .dynamic-math-render, .exercise-card-title .dynamic-math-render { display: inline-flex !important; width: auto !important; margin: 0 0.25em !important; flex-wrap: wrap; }

        /* Add bold IBM font for question titles */
        .question-title, .thread-question-title, .exercise-card-title { font-family: 'IBM-Regular', Arial, sans-serif !important; font-weight: bold !important; }

/* تنسيق صفحة الدخول المركزة */
.auth-page {
    background-color: #f8fafc; /* خلفية رمادية فاتحة جداً كما في الصورة */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.auth-box {
    background: white;
    width: 100%;
    max-width: 420px;
    padding: 60px 40px;
	margin: auto !important; /* يضمن التمركز داخل الحاوية */
    border-radius: 20px; /* زوايا دائرية كما في الصورة */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.03);
    text-align: center;
}

.auth-logo img {
    width: 70px;
    margin-bottom: 25px;
}

.auth-box h2 {
    font-size: 24px;
    color: #1a1a2e;
    margin-bottom: 30px;
    font-weight: 700;
}

.input-group {
    margin-bottom: 15px;
}

.input-group input {
    width: 100%;
    padding: 15px 20px;
    border: 1.5px solid #d1e3e7; /* اللون السماوي الباهت للإطار */
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.input-group input:focus {
    border-color: #088395; /* لون البراند عند التركيز */
}

.auth-btn {
    width: 100%;
    padding: 15px;
    background-color: #088395; /* اللون التركوازي المطابق للصورة */
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.3s;
}

.auth-btn:hover {
    background-color: #066b7a;
}

.auth-footer {
    margin-top: 25px;
    font-size: 14px;
    color: #64748b;
}

.auth-footer a {
    color: #088395;
    text-decoration: none;
    font-weight: 700;
    margin-right: 5px;
}
/* تنسيق إضافي لصفحة التسجيل لتناسب عدد الحقول */
.register-box {
    padding: 40px !important; /* تقليل الحشو العلوي قليلاً ليعطي مساحة للحقول */
    max-width: 450px !important; /* زيادة العرض قليلاً للتوازن */
}

/* في حال كان الارتفاع كبيراً على الشاشات الصغيرة */
@media screen and (max-height: 850px) {
    .auth-page-body {
        height: auto !important; /* السماح بالتمرير إذا كانت الشاشة قصيرة */
        padding: 40px 0 !important;
    }
}
.auth-form .input-group input {
    text-align: left !important; /* توحيد اتجاه النص لليسار كما في التصميم */
    padding: 12px 20px !important; /* إضافة مساحة داخلية (Padding) لمنع التصاق النص بالحواف */
    direction: ltr !important; /* لضمان ظهور الـ Placeholder بشكل صحيح */
    width: 100% !important;
    box-sizing: border-box !important; /* لضمان عدم خروج الحقل عن إطار الصندوق */
	color: #2c3e50 !important; /* لون نص داكن وواضح للقراءة */
}
.auth-form .input-group input::-webkit-input-placeholder { color: #a0bec4 !important; }
.auth-form .input-group input::-moz-placeholder { color: #a0bec4 !important; }

.day-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        color: #cbd5e1;
        font-size: 12px;
    }
    
    .check-circle {
        width: 35px;
        height: 35px;
        border-radius: 50%;
        background: #f1f5f9;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid #f1f5f9;
        transition: all 0.3s ease;
    }

    .day-item.active .check-circle {
        background: #088395; /* لون براند Dal */
        border-color: #088395;
        color: white;
    }

    .day-item.active span {
        color: #088395;
        font-weight: bold;
    }

    .flame-icon img {
        filter: drop-shadow(0 0 5px rgba(255, 69, 0, 0.3));
        animation: flicker 1.5s infinite alternate;
    }

    @keyframes flicker {
        0% { transform: scale(1); opacity: 0.9; }
        100% { transform: scale(1.1); opacity: 1; }
    }