/* Unified App CSS Design System */
:root {
    /* Light Theme (Default) */
    --primary-bg: #f8fafc;
    --sidebar-bg: #1a2942;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --nav-bg: rgba(255, 255, 255, 0.8);
    --accent-teal: #1abc9c;
    --white: #ffffff;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    
    scroll-behavior: smooth;
}

/* Dark Theme Overrides */
:root.dark-theme {
    --primary-bg: #0f172a;
    --sidebar-bg: #020617;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --nav-bg: rgba(15, 23, 42, 0.8);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body {
    font-family: 'IBM Plex Sans Arabic', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-main);
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom Cursor - Pointer for all clickable elements */
a,
button,
.sidebar-item,
.cat-card,
.btn-primary,
.btn-secondary,
.school-card,
.nearby-item,
input[type="file"],
input[type="submit"],
input[type="button"],
.avatar-item,
.bg-item,
.modal-close,
.btn-details-circle,
.btn-filter,
i.fa-solid:not(.fa-school-flag):not(.fa-bars):not(.fa-arrow-left) {
    cursor: url('../img/cursor-pointer.svg') 24 18, pointer !important;
}

/* القائمة الجانبية */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 0;
    z-index: 10000;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
}

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

/* Chrome/Safari */

.sidebar-item {
    color: rgba(255, 255, 255, 0.7);
    margin: 8px 0;
    padding: 12px 0;
    text-align: center;
    font-size: 11.5px;
    cursor: pointer;
    width: 76px;
    border-radius: 18px;
    /* Large rounded corner */
    background: rgba(255, 255, 255, 0.03);
    /* Glassmorphism base */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    /* Edge lighting */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.sidebar-item i {
    font-size: 22px;
    display: block;
    margin-bottom: 6px;
    transition: transform 0.3s;
}

.sidebar-item.active {
    color: white;
    background: linear-gradient(135deg, #3e9e9a 0%, #25706c 100%);
    /* Soft Teal gradient */
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 6px 20px rgba(62, 158, 154, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.4);
    font-weight: bold;
}

.sidebar-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
    /* slight brightness on hover */
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.sidebar-item.active:hover {
    transform: translateY(-2px);
}

.sidebar-item:hover i {
    transform: scale(1.15);
}

.sidebar-item.fav-item {
    background: rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.02);
    margin-top: 15px;
    /* Separate visually */
}

.sidebar-item.fav-item:hover {
    color: white;
    background: rgba(243, 156, 18, 0.15);
    border-color: rgba(243, 156, 18, 0.4);
    box-shadow: 0 6px 25px rgba(243, 156, 18, 0.2), inset 0 1px 1px rgba(243, 156, 18, 0.3);
}

.sidebar-item.fav-item.active {
    background: linear-gradient(135deg, #f39c12 0%, #d68910 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4), inset 0 2px 2px rgba(255, 255, 255, 0.3);
}

/* المحتوى الرئيسي */
.main-container {
    margin-right: 100px;
    flex: 1;
    padding: 25px;
    background-color: var(--primary-bg);
    transition: background-color 0.3s ease, margin-right 0.4s ease;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* شريط التنقل العلوي الاحترافي (Top Navbar) */
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 25px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.top-navbar:hover {
    border-color: var(--accent-teal);
    box-shadow: 0 12px 40px rgba(26, 188, 156, 0.1);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-main);
    cursor: pointer;
}

@keyframes floatAndZoom {
    0% {
        transform: translateY(0) scale(1) perspective(500px) rotateX(0deg) rotateY(0deg);
    }

    100% {
        transform: translateY(-4px) scale(1.04) perspective(500px) rotateX(5deg) rotateY(-2deg);
    }
}

.nav-brand-logo {
    height: 48px;
    width: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: white;
    animation: glowTrace 3s infinite linear;
}

@keyframes glowTrace {
    0% {
        box-shadow: -4px -4px 10px rgba(62, 158, 154, 0.8), 4px 4px 10px rgba(255, 255, 255, 0.2);
    }

    25% {
        box-shadow: 4px -4px 10px rgba(62, 158, 154, 0.8), -4px 4px 10px rgba(255, 255, 255, 0.2);
    }

    50% {
        box-shadow: 4px 4px 10px rgba(62, 158, 154, 0.8), -4px -4px 10px rgba(255, 255, 255, 0.2);
    }

    75% {
        box-shadow: -4px 4px 10px rgba(62, 158, 154, 0.8), 4px -4px 10px rgba(255, 255, 255, 0.2);
    }

    100% {
        box-shadow: -4px -4px 10px rgba(62, 158, 154, 0.8), 4px 4px 10px rgba(255, 255, 255, 0.2);
    }
}

.nav-brand-text {
    font-size: 24px;
    font-weight: 800;
    position: relative;
    overflow: hidden;
    display: inline-block;
    text-shadow: 0 2px 5px rgba(26, 41, 66, 0.15);
    padding-right: 5px;
    padding-left: 5px;
}

.nav-brand-text::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
    transform: skewX(-20deg);
    animation: textFlare 4s infinite ease-in-out;
}

@keyframes textFlare {
    0% {
        left: -100%;
    }

    20% {
        left: 150%;
    }

    100% {
        left: 150%;
    }
}

.nav-pin-icon {
    font-size: 22px;
    color: #1a2942;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
    margin-right: 20px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
    animation: fadeSlideIn 0.4s backwards ease-out;
    border: 1px solid transparent;
}

.nav-link:hover, .nav-link.active {
    color: var(--sidebar-bg);
    background: #f1f5f9;
    border-color: var(--border-color);
}

.nav-link.active {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.nav-links a:nth-child(1) {
    animation-delay: 0.05s;
}

.nav-links a:nth-child(2) {
    animation-delay: 0.1s;
}

.nav-links a:nth-child(3) {
    animation-delay: 0.15s;
}

.nav-links a:nth-child(4) {
    animation-delay: 0.2s;
}

.nav-links a:nth-child(5) {
    animation-delay: 0.25s;
}

@keyframes fadeSlideIn {
    0% {
        opacity: 0;
        transform: translateX(10px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-link:hover {
    color: #3e9e9a;
}

.nav-link.active {
    color: #1a2942;
    position: relative;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0px;
    height: 2px;
    background-color: #1a2942;
    border-radius: 2px;
    animation: elasticSweep 2.5s infinite alternate cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes elasticSweep {
    0% {
        left: 15%;
        width: 30%;
    }

    100% {
        left: 0%;
        width: 100%;
    }
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: var(--card-bg);
    padding: 6px 14px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-left:hover {
    border-color: var(--accent-teal);
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(26, 188, 156, 0.1);
}

.login-text {
    font-weight: 600;
    color: #1a2942;
    font-size: 14px;
}

.user-icon {
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #1a2942;
    cursor: pointer;
    transition: 0.3s;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
}

.user-profile-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
}

@keyframes userLoadGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(62, 158, 154, 0.6);
    }

    60% {
        box-shadow: 0 0 0 15px rgba(62, 158, 154, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(62, 158, 154, 0);
    }
}

.login-text {
    color: #1a2942;
    font-size: 15px;
    font-weight: 600;
}

/* الهيدر (تحويله للون الأبيض لاستيعاب الشعار) */
.header-section {
    background-color: white;
    /* تم تغييره للأبيض */
    height: 280px;
    border-radius: 25px;
    position: relative;
    display: flex;
    flex-direction: column;
    /* لوضع الشعار فوق البحث */
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    /* تم تقليل المساحة لأن شريط التنقل أخذ مكانه */
    margin-bottom: 80px;
    border: 1px solid #eaeaea;
    /* حدود خفيفة لتمييزه عن الخلفية العامة */
}

.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 25px;
    overflow: hidden;
    z-index: 0;
}

.header-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: bgZoom 20s infinite alternate ease-in-out;
}

@keyframes bgZoom {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1);
    }
}

/* شريط البحث */
.search-container {
    background: rgba(255, 255, 255, 0.95);
    width: 70%;
    padding: 12px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
    /* ليبقى فوق الصورة */
    animation: searchPulse 3s infinite ease-in-out;
    backdrop-filter: blur(5px);
}

@keyframes searchPulse {
    0% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }

    50% {
        box-shadow: 0 4px 35px rgba(255, 255, 255, 0.6), 0 0 15px rgba(255, 255, 255, 0.4);
    }

    100% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }
}

/* Glass Title */
.glass-title {
    margin-top: 25px;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 30px;
    border-radius: 30px;
    color: #1a2942;
    font-size: 20px;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    z-index: 2;
    letter-spacing: 0.5px;
    animation: fadeInGlass 1s ease-out;
}

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

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

.search-container input {
    border: none;
    outline: none;
    width: 100%;
    margin: 0 15px;
    font-size: 16px;
    text-align: right;
}

.search-container i {
    color: #888;
    cursor: pointer;
}

/* الأزرار (البطاقات) - تم تعديلها لتكون تحت البحث */
.categories-grid {
    position: absolute;
    bottom: -50px;
    /* جعلها تنزل عن حافة الهيدر */
    width: 90%;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    z-index: 2;
}

.cat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 20px 10px;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transition: 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: floatUp 4s ease-in-out infinite alternate;
}

/* Staggered floating effect */
.cat-card:nth-child(1) {
    animation-delay: 0.0s;
}

.cat-card:nth-child(2) {
    animation-delay: 0.4s;
}

.cat-card:nth-child(3) {
    animation-delay: 0.8s;
}

.cat-card:nth-child(4) {
    animation-delay: 0.2s;
}

.cat-card:nth-child(5) {
    animation-delay: 0.6s;
}

.cat-card:nth-child(6) {
    animation-delay: 1.0s;
}

@keyframes floatUp {
    0% {
        transform: translateY(0px);
    }

    100% {
        transform: translateY(-10px);
    }
}

/* Glassmorphism Shine */
.cat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    animation: glare 5s infinite ease-in-out;
}

@keyframes glare {
    0% {
        left: -150%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

.cat-card:hover {
    animation-play-state: paused;
    border-color: #3e9e9a;
    box-shadow: 0 15px 35px rgba(62, 158, 154, 0.2);
    background: var(--card-bg);
}

.cat-card i {
    font-size: 24px;
    color: var(--text-main);
    margin-bottom: 10px;
    display: block;
}

.cat-card span {
    font-weight: bold;
    color: var(--text-main);
    font-size: 14px;
}

/* منطقة الخريطة والقائمة */
.content-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 25px;
    margin-top: 20px;
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    color: var(--text-main);
    transition: background 0.3s ease, color 0.3s ease;
}

.card h3 {
    margin-top: 0;
    color: #444;
    font-size: 18px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* المدارس القريبة */
.school-list-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid #f9f9f9;
}

.school-thumb {
    width: 70px;
    height: 50px;
    border-radius: 8px;
    background: #eee;
    background-size: cover;
    background-position: center;
    object-fit: cover;
}

.status-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-block;
    margin-top: 5px;
}

.status-green {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-orange {
    background: #fff3e0;
    color: #ef6c00;
}

.status-red {
    background: #ffebee;
    color: #c62828;
}

/* الاحصائيات السفلية */
.stats-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin: 40px 0;
}

.stat-box {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 30px;
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 15px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stat-box:hover {
    transform: scale(1.05);
    border-color: var(--accent-teal);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.stat-icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(26, 188, 156, 0.1);
    color: var(--accent-teal);
    transition: all 0.3s ease;
}

.ready .stat-icon-circle { background: rgba(39, 174, 96, 0.1); color: #27ae60; }
.partial .stat-icon-circle { background: rgba(243, 156, 18, 0.1); color: #f39c12; }
.not-ready .stat-icon-circle { background: rgba(231, 76, 60, 0.1); color: #e74c3c; }

.stat-number {
    font-size: 36px;
    font-weight: 900;
    color: var(--text-main);
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
}

/* زر المدارس المطور والعملاق */
.explore-btn-container {
    display: flex;
    justify-content: center;
    margin: 60px 0 80px;
}

.btn-explore {
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #34495e 100%);
    color: white;
    padding: 22px 60px;
    border-radius: 60px;
    font-size: 22px;
    font-weight: 800;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    box-shadow: 0 15px 45px rgba(26, 41, 66, 0.25);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255,255,255,0.1);
    cursor: pointer;
    min-width: 350px;
    position: relative;
    overflow: hidden;
}

.btn-explore::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.btn-explore:hover::before {
    left: 100%;
}

.btn-explore:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 55px rgba(26, 41, 66, 0.4);
    background: linear-gradient(135deg, #2c3e50 0%, var(--sidebar-bg) 100%);
}

.btn-explore i {
    font-size: 26px;
    transition: transform 0.4s ease;
}

.btn-explore:hover i {
    transform: translateX(-10px);
}

.stat-box:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-box:nth-child(2) {
    animation-delay: 0.25s;
}

.stat-box:nth-child(3) {
    animation-delay: 0.4s;
}

.stat-box:nth-child(4) {
    animation-delay: 0.55s;
}

@keyframes slideUpFadeInStats {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

.stat-box:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.stat-box i,
.stat-box .dot {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stat-box:hover i,
.stat-box:hover .dot {
    transform: scale(1.2) rotate(5deg);
}

.stat-number {
    font-size: 26px;
    font-weight: bold;
    color: #333;
}

.stat-label {
    color: #777;
    font-size: 13px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    /* Bottom Navigation Bar */
    .sidebar {
        flex-direction: row;
        width: 100%;
        height: 75px;
        padding: 10px 15px;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 1000;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
        gap: 15px;
        box-sizing: border-box;
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
        border-top-left-radius: 15px;
        border-top-right-radius: 15px;
    }

    .sidebar::-webkit-scrollbar {
        display: none;
        /* Chrome */
    }

    .sidebar-item {
        flex: 0 0 55px;
        height: 55px;
        padding: 0;
        margin: 0;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-item span {
        display: none;
    }

    .sidebar-item i {
        margin-bottom: 0;
        font-size: 20px;
    }

    .sidebar-item.fav-item {
        margin-top: 0;
    }

    .sidebar-item:first-child {
        display: none;
    }

    .main-container {
        padding: 15px;
        padding-bottom: 130px;
        width: 100%;
        box-sizing: border-box;
    }

    .top-navbar {
        padding: 10px 15px;
        margin-bottom: 15px;
    }

    .nav-links {
        display: none;
    }

    .nav-brand-text {
        font-size: 18px;
    }

    .nav-brand-logo {
        height: 36px;
        width: 36px;
    }

    .login-text {
        display: none;
    }

    .nav-left {
        padding: 5px;
    }

    .header-section {
        height: auto;
        min-height: 250px;
        padding: 30px 15px;
        margin-bottom: 30px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        gap: 15px;
    }

    .bg-layer {
        filter: blur(3px) brightness(0.8);
        transform: scale(1.05);
        /* hide blur edges */
    }

    .glass-title {
        font-size: 14px;
        padding: 8px 15px;
        margin-top: 15px;
        text-align: center;
        width: 85%;
    }

    .search-container {
        width: 92%;
        padding: 12px 20px;
    }

    .categories-grid {
        position: relative;
        /* إزالة الـ absolute حسب المطلوب */
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        width: 100%;
        margin-top: 10px;
        bottom: auto;
        left: auto;
        align-items: stretch;
    }

    .cat-card {
        padding: 12px 10px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        margin: 0;
    }

    .cat-card i {
        font-size: 20px;
        /* Resize icon on mobile */
        margin-bottom: 8px;
    }

    .cat-card span {
        font-size: 13px;
        font-weight: bold;
        text-align: center;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .modal-box {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .school-list-item {
        flex-direction: column-reverse;
        align-items: flex-start;
    }

    .school-thumb {
        width: 100%;
        height: 120px;
    }

    .avatar-grid,
    .bg-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 41, 66, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show, .modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--card-bg);
    color: var(--text-main);
    width: 90%;
    max-width: 420px;
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.show .modal-box, .modal-overlay.active .modal-box {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.modal-title {
    font-size: 20px;
    color: var(--text-main);
    margin: 0;
    font-weight: bold;
}

.modal-close {
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: 0.3s;
}

.modal-close:hover {
    color: var(--text-main);
}

/* Settings Specific Styles */
.modal-body-custom {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--primary-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.setting-label {
    font-weight: bold;
    color: var(--text-main);
}

.font-controls {
    display: flex;
    gap: 8px;
}

.font-controls button {
    padding: 6px 12px;
    margin: 0;
    font-size: 13px;
}
    cursor: pointer;
    transition: 0.2s;
}

.modal-close:hover {
    color: #dc3545;
}

.modal-step {
    display: none;
    flex-direction: column;
    animation: slideIn 0.4s ease;
}

.modal-step.active {
    display: flex;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-15px);
    }

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

.input-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 14px;
    font-weight: 600;
    color: #444;
}

.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: 0.3s;
    box-sizing: border-box;
    background: #fdfdfd;
}

.form-input:focus {
    border-color: #1a2942;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(26, 41, 66, 0.08);
}

.file-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    color: #64748b;
    transition: 0.3s;
    background: #f8fafc;
}

.file-upload-btn:hover {
    border-color: #3e9e9a;
    color: #3e9e9a;
    background: #f0fbfb;
}

.file-upload-btn input[type="file"] {
    display: none;
}

.btn-primary {
    background: #1a2942;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
    width: 100%;
}

.btn-primary:hover {
    background: #2b3a4e;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.avatar-grid,
.bg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.avatar-item {
    width: 70px;
    height: 70px;
    background: #f8fafc;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.3s;
    overflow: hidden;
}

.avatar-item.selected {
    border-color: #3e9e9a;
    background: rgba(62, 158, 154, 0.05);
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(62, 158, 154, 0.2);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.3s;
}

/* Custom Notification (Toast) System */
.toast-container {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #1a2942;
    color: white;
    padding: 12px 25px;
    border-radius: 40px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    justify-content: center;
    animation: toastSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: auto;
}

.toast.error {
    background: #e74c3c;
    border-bottom: 3px solid #c0392b;
}

.toast.success {
    background: #27ae60;
    border-bottom: 3px solid #2ecc71;
}

.toast.fadeOut {
    animation: toastFadeOut 0.4s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

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

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.bg-item {
    height: 50px;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.3s;
}

.bg-item:hover,
.bg-item.selected {
    border-color: #1a2942;
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* High Contrast Mode */
body.high-contrast-mode * {
    outline: 1px solid rgba(0, 0, 0, 0.85) !important;
    box-shadow: none !important;
}

body.high-contrast-mode .sidebar {
    background-color: #000;
}

body.high-contrast-mode {
    font-weight: 900 !important;
}

body.high-contrast-mode .nav-brand-text,
body.high-contrast-mode .page-title,
body.high-contrast-mode .modal-title {
    color: #000;
}

/* Voice Reader Interactive Tooltip */
.reader-tooltip {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    padding: 8px 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    direction: rtl;
}

.reader-highlight {
    outline: 2px solid rgba(26, 188, 156, 0.8) !important;
    box-shadow: 0 0 15px rgba(26, 188, 156, 0.4) !important;
    border-radius: 8px;
    /* Safe default radius */
    transition: outline 0.2s, box-shadow 0.2s;
}

/* Prevent override issues for specific items */
.school-card.reader-highlight,
.stat-box.reader-highlight,
.modal-box.reader-highlight {
    border-radius: 20px;
}

.soundwave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 16px;
}

.soundwave span {
    display: block;
    width: 3px;
    height: 4px;
    background: #1a2942;
    border-radius: 3px;
    transition: height 0.1s ease;
}

.reader-tooltip.active .soundwave span {
    animation: wavePulse 1s infinite ease-in-out;
}

.reader-tooltip.active .soundwave span:nth-child(2) {
    animation-delay: 0.1s;
    background: #1abc9c;
}

.reader-tooltip.active .soundwave span:nth-child(3) {
    animation-delay: 0.2s;
}

.reader-tooltip.active .soundwave span:nth-child(4) {
    animation-delay: 0.3s;
    background: #1abc9c;
}

@keyframes wavePulse {

    0%,
    100% {
        height: 4px;
    }

    50% {
        height: 16px;
    }
}

/* Cinematic Settings Modal Animations */
@keyframes lockShake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-10deg);
    }

    75% {
        transform: rotate(10deg);
    }
}

.coming-soon-box {
    text-align: center;
    padding: 40px;
    max-width: 350px;
}

.lock-icon-container {
    font-size: 80px;
    color: #1a2942;
    margin-bottom: 20px;
    filter: drop-shadow(0 10px 15px rgba(26, 41, 66, 0.2));
    animation: lockShake 1.5s infinite ease-in-out;
}

.soon-text {
    font-family: 'Kufam', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: #1a2942;
    margin: 10px 0;
    text-transform: uppercase;
    letter-spacing: 4px;
}

.soon-subtext {
    color: #64748b;
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.6;
}

.modal-overlay.show .modal-box-animated {
    animation: scaleFadeInSoft 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: none;
    /* override default modal transition */
}

@keyframes scaleFadeInSoft {
    0% {
        opacity: 0;
        transform: scale(0.85);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-overlay.show .setting-row {
    opacity: 0;
    animation: slideUpBounce 0.6s forwards cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.show .setting-row:nth-child(1) {
    animation-delay: 0.15s;
}

.modal-overlay.show .setting-row:nth-child(2) {
    animation-delay: 0.3s;
}

.modal-overlay.show .setting-row:nth-child(3) {
    animation-delay: 0.45s;
}

@keyframes slideUpBounce {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.glow-moon {
    animation: goldenMoonGlow 3s infinite alternate ease-in-out;
}

@keyframes goldenMoonGlow {
    0% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.2);
    }

    100% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6), inset 0 0 5px rgba(255, 215, 0, 0.3);
        border-color: rgba(255, 215, 0, 0.5);
        color: #b8860b;
    }
}

.pulse-save {
    animation: gentlePulse 2.5s infinite;
}

@keyframes gentlePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(26, 41, 66, 0.4);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(26, 41, 66, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(26, 41, 66, 0);
    }
}

/* Glassmorphism School Cards Redesign */
.school-card {
    background: var(--card-bg);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow);
    /* very light shadow for depth */
    position: relative;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
    min-height: 380px;
    border: none;
    text-align: right;
}

.school-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
}

/* Thumbnail Background */
.school-card-thumb {
    height: 220px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.gender-badge-glass {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #1a2942;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Glassmorphism Slice */
.school-card-glass {
    padding: 22px 20px;
    background: var(--nav-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    margin-top: -40px;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.02);
}

.school-card-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 10px;
    line-height: 1.4;
}

.stars-minimal {
    font-size: 10px;
    color: #f39c12;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.stars-minimal span {
    color: #aaa;
    font-size: 10px;
    letter-spacing: 0;
    font-weight: bold;
    margin-right: 4px;
}

.school-card-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.district-info {
    font-size: 11.5px;
    color: #666;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Circular gradient modern detail button */
.btn-details-circle {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #3e9e9a 0%, #25706c 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(62, 158, 154, 0.35);
    transition: all 0.3s ease;
    text-decoration: none;
    z-index: 3;
}

.btn-details-circle span {
    font-size: 9px;
    margin-top: 2px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.btn-details-circle i {
    font-size: 14px;
}

.btn-details-circle:hover {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 10px 25px rgba(62, 158, 154, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a2942;
    color: white;
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Favorite Button */
.fav-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #64748b;
    font-size: 16px;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.fav-btn:hover {
    transform: scale(1.15);
    background: white;
    color: #f59e0b;
    box-shadow: 0 6px 15px rgba(245, 158, 11, 0.3);
}

.fav-btn .fav-active {
    color: #f59e0b;
    animation: favPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes favPop {
    0% {
        transform: scale(0.5);
    }

    100% {
        transform: scale(1);
    }
}


/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: rgba(26, 41, 66, 0.9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    background: #1a2942;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

/* أزرار التصفية الجديدة */
.filters-bar {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    width: 100%;
    font-size: 14px;
    color: var(--text-main);
    font-family: inherit;
}

.btn-filter-pill {
    background: #1a2942;
    color: white;
    padding: 12px 28px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 15px rgba(26, 41, 66, 0.2);
    font-size: 14px;
    user-select: none;
}

.btn-filter-pill:hover {
    background: #2c3e50;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(26, 41, 66, 0.3);
}

.btn-filter-pill i {
    font-size: 18px;
}

/* تنسيق المودال الخاص بالتصفية */
.filter-modal-content {
    max-width: 500px !important;
}

.filter-group {
    margin-bottom: 25px;
}

.filter-label {
    display: block;
    margin-bottom: 12px;
    font-weight: 800;
    color: var(--text-main);
    font-size: 14px;
}

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

.filter-chip {
    padding: 10px 18px;
    background: rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.filter-chip:hover {
    background: rgba(0,0,0,0.06);
}

.filter-chip.active {
    background: var(--accent-teal);
    color: white;
    border-color: var(--accent-teal);
    box-shadow: 0 4px 12px rgba(26, 188, 156, 0.25);
}