/* css/style.css - Corrected Brand Color & Dark Mode Fixes */

:root {
    --primary: #F2CE5A;
    --primary-hover: #e6c045;

    --secondary: #09090b;
    --dark-bg: #09090b;
    --dark-surface: #18181b;
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --dark-glass-bg: rgba(24, 24, 27, 0.96);
    --dark-glass-border: rgba(255, 255, 255, 0.08);
}

body.dark-mode {
    background-color: var(--dark-bg) !important;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-100 {
    animation-delay: 0.1s;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
}

.dark-mode .custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #475569;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary);
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Glass Panel Component */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* يحد نطاق إعادة الرسم ليسرع الـ scroll */
    contain: layout style;
}

.dark-mode .glass-panel {
    background: var(--dark-glass-bg);
    border-color: var(--dark-glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.dark-mode .glass-card {
    background: var(--dark-glass-bg);
    border-color: var(--dark-glass-border);
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.2);
    border-color: var(--primary);
}

.profile-grid-bg {
    background-image: linear-gradient(to right, rgba(128, 128, 128, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(128, 128, 128, 0.08) 1px, transparent 1px);
    background-size: 24px 24px;
}

.dark-mode .profile-grid-bg {
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
}

/* ابحث عن هذا الكلاس وعدله */
.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background-color: #f9fafb;

    /* التعديل هنا: غيرنا transparent لـ لون رصاصي #e5e7eb */
    border: 1px solid #e5e7eb;

    color: #1f2937;
    font-weight: 500;
    transition: all 0.2s;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* تأكد إن الدارك مود لسه زي ما هو بيغير اللون */
.dark-mode .input-field {
    background-color: #1f1f1f !important;
    border: 1px solid #374151 !important;
    color: #ffffff !important;
}

.input-field:focus {
    background-color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(242, 206, 90, 0.2);
}

.dark-mode .input-field:focus {
    background-color: #000;
    border-color: var(--primary);
}

/* Label Custom */
.label-custom {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.dark-mode .label-custom {
    color: #e5e7eb;
}

/* Buttons */
.btn-primary-custom {
    background: var(--primary);
    color: #000000;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(242, 206, 90, 0.2);
}

.btn-primary-custom:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(242, 206, 90, 0.3);
}

.btn-primary-custom:active {
    transform: scale(0.98);
}

.btn-secondary-outline {
    background: transparent;
    border: 2px solid var(--secondary);
    color: var(--secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.dark-mode .btn-secondary-outline {
    border-color: #e5e7eb;
    color: #e5e7eb;
}

.btn-secondary-outline:hover {
    background: var(--secondary);
    color: white;
}

.dark-mode .btn-secondary-outline:hover {
    background: #e5e7eb;
    color: black;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

/* Tabs */
.tab-button {
    padding: 0.6rem 1.2rem;
    border-radius: 99px;
    color: #6b7280;
    font-weight: 600;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.dark-mode .tab-button {
    color: #d1d5db;
}

.tab-button:hover:not(:disabled) {
    background-color: #fff9c4;
    color: #a16207;
}

.dark-mode .tab-button:hover:not(:disabled) {
    background-color: #333;
    color: var(--primary);
}

.tab-button.active {
    background-color: var(--primary);
    color: black;
    box-shadow: 0 4px 12px rgba(242, 206, 90, 0.3);
}

.tab-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(100%);
}

/* Record Items */
.record-item {
    background: white;
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    border: 1px solid #f3f4f6;
    transition: transform 0.2s, box-shadow 0.2s;
    /* تحسين أداء السكرول والتحميل للقوائم الطويلة */
    content-visibility: auto;
    contain-intrinsic-size: 80px;
}

.dark-mode .record-item {
    background: var(--dark-bg);
    border-color: #333;
    color: #fff;
}

.dark-mode .record-item p,
.dark-mode .record-item span {
    color: #fff !important;
}

.dark-mode .record-item p.text-sm {
    color: #9ca3af !important;
}

.record-item:hover {
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-right: 4px solid var(--primary);
}

html[dir="rtl"] .record-item:hover {
    border-right: 4px solid var(--primary);
    border-left: 1px solid #f3f4f6;
}

/* Student Rows */
.student-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-radius: 12px;
    margin-bottom: 4px;
    background-color: #fff;
    border: 1px solid #f3f4f6;
    transition: background-color 0.3s;
}

.dark-mode .student-row {
    background-color: var(--dark-bg);
    border-color: #333;
    color: #fff;
}

.dark-mode .student-name {
    color: #ffffff !important;
    font-weight: 600;
}

.student-row:hover {
    background-color: #fff9c4;
}

.dark-mode .student-row:hover {
    background-color: #2c2c2c;
}

.student-row .attendance-status-select,
.student-row .grade-input {
    padding: 0.4rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background-color: #f9fafb;
    font-size: 0.9rem;
    text-align: center;
    outline: none;
    transition: all 0.2s;
}

.dark-mode .student-row .attendance-status-select,
.dark-mode .student-row .grade-input {
    background-color: #000;
    color: #fff;
    border-color: #444;
}

.student-row .attendance-status-select:focus,
.student-row .grade-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(242, 206, 90, 0.2);
}

/* Checkboxes */
.day-checkbox-container {
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    user-select: none;
}

.dark-mode .day-checkbox-container {
    background: var(--dark-bg);
    border-color: #333;
    color: #d1d5db;
}

.day-checkbox-container:hover {
    border-color: var(--primary);
}

.day-checkbox-container:has(input:checked) {
    background-color: var(--primary);
    color: black;
    border-color: var(--primary);
    font-weight: bold;
}

.day-checkbox {
    display: none;
}

/* Selects */
#recurringTimeContainer select,
#exceptionNewTimeContainer select {
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background-color: #fff;
    width: 100%;
    outline: none;
}

.dark-mode #recurringTimeContainer select,
.dark-mode #exceptionNewTimeContainer select {
    background-color: var(--dark-bg);
    border-color: #333;
    color: white;
}

/* ========================================= */
/* FIX STATUS INDICATOR (CLEAN STYLE)        */
/* ========================================= */

#statusIndicator {
    transition: all 0.3s ease;
    background-color: transparent !important;
    /* إلغاء المربع الخلفي تماماً */
    border: 1px solid transparent !important;
    /* إلغاء البرواز */
    padding: 0 5px;
    /* مسافة بسيطة */
}

/* --- في الوضع الليلي (Dark Mode) --- */

/* حالة الاتصال (Online) */
.dark-mode #statusIndicator.online {
    color: #ffffff !important;
    /* النص أبيض زي ما طلبت */
}

/* حالة عدم الاتصال (Offline) */
.dark-mode #statusIndicator.offline {
    color: #ffffff !important;
    /* النص أبيض برضه */
    opacity: 0.7;
    /* نخلي النص باهت سنة بسيطة عشان يبان إنه أوفلاين */
}

/* --- ألوان النقطة (Dot Colors) --- */

/* النقطة الخضراء (أونلاين) */
#statusIndicator.online .status-dot {
    background-color: #22c55e !important;
    /* أخضر */
    box-shadow: 0 0 8px #22c55e;
    /* لمعة خضراء */
}

/* النقطة الحمراء (أوفلاين) */
#statusIndicator.offline .status-dot {
    background-color: #ef4444 !important;
    /* أحمر */
    box-shadow: none;
}

/* --- (اختياري) الوضع النهاري Light Mode --- */
/* عشان يفضل شكله حلو في الفاتح */
#statusIndicator.online {
    color: #166534;
}

#statusIndicator.offline {
    color: #991b1b;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.section-header i {
    font-size: 1.5rem;
    color: var(--primary);
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1f2937;
}

.dark-mode .section-header h3 {
    color: #f3f4f6;
}

/* Scanner Overlay */
#scannerOverlay.success {
    border-color: #10b981;
}

#scannerOverlay.error {
    border-color: #ef4444;
}

/* Message Box */
.message-box {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-bg);
    color: var(--primary);
    padding: 12px 24px;
    border-radius: 99px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(242, 206, 90, 0.3);
    z-index: 3000;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@media print {
    body * {
        visibility: hidden;
    }

    #printableIdCard,
    #printableIdCard * {
        visibility: visible;
    }

    #printableIdCard {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 350px;
        border: 2px solid black !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ========================================= */
/* CRITICAL DARK MODE & TRANSLATION FIXES   */
/* ========================================= */

/* 1. Force Gray Text to be Visible in Dark Mode */
.dark-mode .text-gray-500 {
    color: #9ca3af !important;
}

/* Equivalent to gray-400 */
.dark-mode .text-gray-600 {
    color: #d1d5db !important;
}

/* Equivalent to gray-300 */
.dark-mode .text-gray-700 {
    color: #e5e7eb !important;
}

/* Equivalent to gray-200 */
.dark-mode .text-gray-800 {
    color: #f3f4f6 !important;
}

/* Equivalent to gray-100 */
.dark-mode .text-gray-900 {
    color: #ffffff !important;
}

/* Pure White */

/* 2. Input Fields & Placeholders */
.dark-mode .input-field {
    background-color: #1f1f1f !important;
    border: 1px solid #374151 !important;
    color: #ffffff !important;
}

.dark-mode .input-field::placeholder {
    color: #9ca3af !important;
    /* Make placeholders clearly visible */
    opacity: 1;
}

.dark-mode select:not(.appearance-none) {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 0.5rem center;
    /* مكان السهم لليسار لأننا RTL */
    background-size: 1.5em;
    padding-left: 2rem !important;
    /* مساحة للسهم */
}

/* 2. القائمة العلوية (Group Select) */
/* هذه القائمة لديها class="appearance-none" ولديها أيقونة HTML خاصة */
/* لذلك نمنع ظهور سهم الخلفية فيها حتى لا يتكرر */
.dark-mode select.appearance-none {
    background-image: none !important;
}

/* 3. Dropdowns inside tables */
.dark-mode .att-select,
.dark-mode .grade-input {
    background-color: #2d2d2d !important;
    color: #ffffff !important;
    border-color: #4b5563 !important;
}

/* 4. Modal Backgrounds & Text */
.dark-mode .glass-panel,
.dark-mode .bg-white {
    background-color: var(--dark-surface) !important;
    color: white !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

.dark-mode .modal-content {
    background-color: var(--dark-surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* 5. Icons inside inputs */
.dark-mode .ri-smartphone-line,
.dark-mode .ri-lock-password-line,
.dark-mode .ri-search-line {
    color: #9ca3af !important;
}

/* 6. Tabs Background in Dark Mode */
.dark-mode .tab-button:hover:not(.active) {
    background-color: #333 !important;
    color: var(--primary) !important;
}

/* ============================================================ */
/* FORCE ID CARD TO STAY LIGHT IN DARK MODE (FIX FOR SCREENSHOT) */
/* ============================================================ */

/* 1. إجبار خلفية الكارت تكون بيضاء دائماً */
.dark-mode #printableIdCard {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
}

/* 2. إجبار النصوص الأساسية تكون سوداء */
.dark-mode #printableIdCard h2,
.dark-mode #printableIdCard #idStudentName {
    color: #111827 !important;
    /* أسود غامق */
}

/* 3. النصوص الفرعية تكون رصاصي (مش أبيض) */
.dark-mode #printableIdCard h4,
.dark-mode #printableIdCard p,
.dark-mode #printableIdCard span {
    color: #4b5563 !important;
    /* رصاصي متوسط */
}

/* 4. إصلاح خلفية مربع اللوجو ومربع اسم المعلم */
.dark-mode #printableIdCard .bg-white {
    background-color: #ffffff !important;
    border-color: #f3f4f6 !important;
}

.dark-mode #printableIdCard .bg-gray-50 {
    background-color: #f9fafb !important;
    /* خلفية فاتحة جداً */
    color: #374151 !important;
}

/* 5. أيقونة واسم المعلم */
.dark-mode #printableIdCard #idTeacherName {
    color: #374151 !important;
}

/* 6. التأكد إن الـ QR Code خلفيته بيضاء */
.dark-mode #idQrcode,
.dark-mode #idQrcode img {
    background-color: #ffffff !important;
}

/* ========================================= */
/* FIX DOUBLE ARROWS IN DARK MODE            */
/* ========================================= */

.dark-mode select:not(.appearance-none) {
    /* إخفاء سهم المتصفح الافتراضي عشان السهم الأبيض بتاعنا يظهر لوحده */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;

    /* التأكد من إعدادات السهم المخصص */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: left 0.5rem center !important;
    padding-left: 2.5rem !important;
    /* وسعنا المسافة شوية عشان الكلام ميدخلش في السهم */
}

/* ========================================= */
/* FIX PLACEHOLDER COLORS                    */
/* ========================================= */

/* لون الـ Placeholder في الوضع الفاتح (رمادي واضح) */
.input-field::placeholder {
    color: #6B7280 !important;
    /* لون رمادي متوسط */
    opacity: 1;
    /* لضمان الظهور في فايرفوكس */
}

/* لون الـ Placeholder في الوضع المظلم (رمادي فاتح عشان يبان ع الخلفية السوداء) */
.dark-mode .input-field::placeholder {
    color: #9CA3AF !important;
    /* لون رمادي فاتح */
    opacity: 1;
}

/* حل إضافي لو بتستخدم select */
select.input-field:invalid,
.dark-mode select.input-field:invalid {
    color: #9CA3AF !important;
}

/* الوضع الطبيعي (للكل): بدون عكس */
#reader video,
video {
    transform: scaleX(1) !important;
    -webkit-transform: scaleX(1) !important;
}

/* ✅ يطبق العكس فقط لو الجافاسكريبت قال إن ده ديسك توب */
body.desktop-device #reader video,
body.desktop-device video {
    transform: scaleX(-1) !important;
    -webkit-transform: scaleX(-1) !important;
}

/* في ملف style.css لو مش موجود */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}


/* التعديل هنا: استبدلنا الـ shimmer الـ "مزعجة" بـ pulse هادي وأشيك */
@keyframes skeleton-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.skeleton-row {
    background-color: #f1f5f9;
    /* رمادي فاتح هادي */
    animation: skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    border-radius: 12px;
}

.dark-mode .skeleton-row {
    background-color: #1e293b;
    /* رمادي غامق للهوية الليلية */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.animate-pulse-slow {
    animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.shake-anim {
    animation: shake 0.3s ease-in-out;
    border-color: #ef4444 !important;
    /* لون أحمر */
}

/* Deluxe Landing Page Additions */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

.deluxe-float {
    animation: float 6s ease-in-out infinite;
    /* ترفع العنصر لطبقة GPU منفصلة فوراً قبل بدء الحركة */
    will-change: transform;
}

@keyframes pulse-ring {
    0% { transform: scale(0.95); opacity: 0.5; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(0.95); opacity: 0.5; }
}

.deluxe-pulse-ring {
    animation: pulse-ring 4s ease-in-out infinite;
    will-change: transform, opacity;
}

.glass-feature-card {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.dark-mode .glass-feature-card {
    background: rgba(30, 30, 30, 0.45);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.glass-feature-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(242, 206, 90, 0.4);
    box-shadow: 0 20px 40px rgba(242, 206, 90, 0.08);
}

.dark-mode .glass-feature-card:hover {
    border-color: rgba(242, 206, 90, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.premium-gradient-text {
    background: linear-gradient(135deg, #F2CE5A 0%, #d97706 50%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* تسريع وتخفيف الـ Navigation Bar العلوي أثناء السكرول */
.app-bar {
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* يعزل الـ nav عن باقي طبقات الصفحة لمنع إعادة الرسم عند السكرول */
    isolation: isolate;
    contain: layout style;
}

/* تحسين كل عناصر الـ animate-pulse الداخلية */
.animate-pulse {
    will-change: opacity;
}

/* 🚀 إلغاء جميع فلاتر الـ backdrop-blur لتسريع السكرول والمتصفح بالكامل */
*, ::before, ::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* 🚀 إخفاء دوائر الخلفية المضيئة الكبيرة لأن فلاتر الـ blur الضخمة تهنج كارت الشاشة والمتصفح */
.blur-3xl {
    display: none !important;
}

/* 🚀 تحسين أداء السكرول في قائمة الحصة اليومية */
.daily-student-row {
    content-visibility: auto;
    contain-intrinsic-size: 50px;
    will-change: transform;
}

/* 🔍 تنسيق حقول وأيقونات البحث لضمان عدم التلامس ودعم الاتجاهين */
.search-container {
    position: relative;
    width: 100%;
}
.search-input {
    padding-right: 3rem !important;
    padding-left: 1rem !important;
}
[dir="ltr"] .search-input {
    padding-left: 3rem !important;
    padding-right: 1rem !important;
}
.search-icon {
    position: absolute;
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 1rem !important;
    left: auto !important;
    pointer-events: none;
    font-size: 1.1rem;
}
[dir="ltr"] .search-icon {
    right: auto !important;
    left: 1rem !important;
}

/* 🚀 تخطيط لوحة التحكم المستقل للـ Scroll بالقائمة الجانبية والمحتوى على الشاشات الكبيرة */
@media (min-width: 1024px) {
    body.is-logged-in {
        overflow: hidden !important;
    }
    
    #mainContent {
        height: 100vh !important;
        padding-top: 6.5rem !important; /* pt-26 equivalent */
        padding-bottom: 1rem !important;
        box-sizing: border-box;
    }

    #mainContent > .flex {
        height: calc(100vh - 8rem);
        overflow: hidden;
        gap: 1.5rem !important; /* reduce gap between sidebar and content */
    }
    
    aside {
        height: auto !important;
        max-height: 100%;
        overflow-y: auto !important;
        padding-bottom: 1rem;
        display: flex;
        flex-direction: column;
        gap: 1rem !important; /* reduce spacing between cards */
    }
    
    #rightMainContent {
        height: 100%;
        max-height: 100%;
        overflow-y: auto !important;
        padding-bottom: 6rem !important; /* give extra space at the bottom so buttons aren't cut off */
    }

    /* Tighten Overview Tab on Desktop to fit on a single screen without scrolling */
    #tab-overview .grid.gap-6 {
        gap: 1rem !important;
        margin-bottom: 1rem !important;
    }
    #tab-overview .glass-card {
        padding: 1rem !important;
    }
    #tab-overview .glass-card.min-h-\[350px\] {
        min-height: 330px !important;
    }
    #groupPerformanceChartContainer {
        height: 240px !important;
    }
    #tab-overview #topPerformersList,
    #tab-overview #atRiskStudentsList {
        min-height: auto !important;
        display: flex;
        flex-direction: column;
        gap: 0.5rem !important;
    }
    #tab-overview #topPerformersList > div,
    #tab-overview #atRiskStudentsList > div {
        padding: 0.5rem 0.75rem !important;
    }
    #monthlyCollectionSummary {
        margin-top: 0.25rem !important;
        display: flex;
        flex-direction: column;
        gap: 0.5rem !important;
    }
    #monthlyCollectionSummary .flex-col {
        padding-top: 0 !important;
        padding-bottom: 0.25rem !important;
    }
    #monthlyCollectionSummary i.text-6xl {
        font-size: 2.5rem !important;
        margin-bottom: 0 !important;
    }

    /* Hide scrollbar completely for sidebar and main content */
    aside::-webkit-scrollbar,
    #rightMainContent::-webkit-scrollbar {
        display: none !important;
    }
    aside,
    #rightMainContent {
        -ms-overflow-style: none !important; /* IE and Edge */
        scrollbar-width: none !important; /* Firefox */
    }
}