* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    direction: rtl;
    text-align: right;
}

html {
    direction: rtl;
}

/* Header */
.main-header {
    background: linear-gradient(135deg, #20b2aa 0%, #17a2b8 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-header .navbar {
    padding: 15px 0;
}

.navbar-brand {
    text-decoration: none;
}

.site-title {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 8px 20px !important;
    margin: 0 5px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.3);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Footer */
.main-footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #fff;
    padding: 50px 0 20px;
    margin-top: 60px;
}

.footer-section {
    margin-bottom: 30px;
}

.footer-title {
    color: #20b2aa;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(32, 178, 170, 0.3);
}

.footer-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    line-height: 1.8;
    margin: 0;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: inline-block;
    padding-right: 10px;
    position: relative;
}

.footer-links a::before {
    content: '←';
    position: absolute;
    right: -15px;
    opacity: 0;
    transition: all 0.3s ease;
}

.footer-links a:hover {
    color: #20b2aa;
    padding-right: 20px;
}

.footer-links a:hover::before {
    opacity: 1;
    right: -10px;
}

.footer-bottom {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.copyright {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin: 0;
}

/* Responsive Header & Footer */
@media (max-width: 768px) {
    .site-title {
        font-size: 1.4rem;
    }
    
    .navbar-nav .nav-link {
        font-size: 1rem;
        padding: 8px 15px !important;
    }
    
    .footer-title {
        font-size: 1.3rem;
    }
    
    .footer-text {
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    .main-header .navbar {
        padding: 10px 0;
    }
    
    .site-title {
        font-size: 1.2rem;
    }
    
    .main-footer {
        padding: 40px 0 15px;
    }
    
    .footer-section {
        margin-bottom: 25px;
    }
}

/* القسم الأول */
.section-one {
    padding: 20px 0;
    background-color: #fff;
}

.section-one img {
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* القسم الثاني */
.section-two {
    padding: 40px 0;
    background-color: #fff;
}

.section-two .row {
    display: flex;
    align-items: stretch;
}

.section-two .semester-section {
    flex: 1 1 0;
    min-width: 0;
}

.semester-section {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.semester-title {
    text-align: center;
    color: #333;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

/* الشريط الأصفر الفاصل */
.divider-column {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yellow-divider {
    width: 100%;
    max-width: 12px;
    height: 100%;
    background-color: #ffd700;
    min-height: 500px;
    margin: 0 auto;
}

/* بطاقات الصفوف */
.grades-grid {
    padding: 0 10px;
    direction: rtl;
}

.grade-card {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.grade-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.grade-card.empty-card {
    background-color: #fafafa;
    border: 1px solid #e0e0e0;
    cursor: default;
}

.grade-card.empty-card:hover {
    transform: none;
    box-shadow: none;
}

/* الأشكال المنحنية */
.card-shape {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    direction: rtl;
}

.teal-shape {
    position: absolute;
    top: 0;
    right: 0;
    width: 70%;
    height: 100%;
    background: linear-gradient(135deg, #20b2aa 0%, #17a2b8 100%);
    clip-path: polygon(30% 0%, 100% 0%, 100% 100%, 0% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.lime-shape {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50%;
    height: 60%;
    background: linear-gradient(135deg, #32cd32 0%, #90ee90 100%);
    clip-path: polygon(0% 40%, 100% 0%, 100% 100%, 0% 100%);
    z-index: 1;
}

/* النقاط على الشكل الأخضر */
.lime-shape::before {
    content: '';
    position: absolute;
    top: 20%;
    right: 15%;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 2px, transparent 2px);
    background-size: 8px 8px;
    border-radius: 50%;
}

/* رقم الصف */
.grade-number {
    color: #fff;
    font-size: 3.5rem;
    font-weight: bold;
    z-index: 3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* نص الصف */
.grade-text {
    position: relative;
    z-index: 3;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: auto;
    text-align: center;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    width: 100%;
    border-radius: 0 0 8px 8px;
}

/* صورة الصف */
.grade-image {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.grade-card:hover .grade-image {
    opacity: 0.1;
}

/* النقاط الصفراء في الزاوية */
.grade-card::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #ffd700 2px, transparent 2px);
    background-size: 6px 6px;
    z-index: 3;
    opacity: 0.6;
}

/* Responsive Design */
@media (max-width: 992px) {
    .yellow-divider {
        width: 100%;
        height: 8px;
        min-height: 8px;
        max-width: 100%;
    }
    
    .divider-column {
        padding: 20px 0;
        width: 100%;
    }
    
    .semester-section {
        margin-bottom: 40px;
        width: 100%;
    }
    
    .section-two .row {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .semester-title {
        font-size: 1.5rem;
    }
    
    .grade-number {
        font-size: 2.5rem;
    }
    
    .grade-text {
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    .section-two {
        padding: 20px 0;
    }
    
    .semester-section {
        padding: 10px;
    }
    
    .grades-grid {
        padding: 0 5px;
    }
}

/* القسم الثالث */
.section-three {
    padding: 60px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.about-platform {
    text-align: center;
    padding: 40px;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
}

.platform-title {
    color: #20b2aa;
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 30px;
    position: relative;
    padding-bottom: 20px;
}

.platform-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #20b2aa, #32cd32);
    border-radius: 2px;
}

.platform-description {
    color: #555;
    font-size: 1.2rem;
    line-height: 2;
    margin-bottom: 35px;
    text-align: justify;
    text-align-last: center;
}

.btn-learn-more {
    background: linear-gradient(135deg, #20b2aa 0%, #17a2b8 100%);
    border: none;
    padding: 12px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 30px;
    color: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(32, 178, 170, 0.3);
}

.btn-learn-more:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(32, 178, 170, 0.4);
    background: linear-gradient(135deg, #17a2b8 0%, #20b2aa 100%);
}

.btn-learn-more:active {
    transform: translateY(-1px);
}

/* القسم الرابع */
.section-four {
    padding: 60px 0;
    background-color: #fff;
}

.stats-title {
    text-align: center;
    color: #333;
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 50px;
    position: relative;
    padding-bottom: 20px;
}

.stats-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, #20b2aa, #32cd32);
    border-radius: 2px;
}

.stat-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 15px;
    padding: 40px 20px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #20b2aa, #32cd32);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-color: #20b2aa;
}

.stat-number {
    font-size: 3.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #20b2aa 0%, #32cd32 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    line-height: 1;
}

.stat-label {
    color: #555;
    font-size: 1.3rem;
    font-weight: 600;
}

/* Responsive للقسمين الجديدين */
@media (max-width: 768px) {
    .platform-title {
        font-size: 2rem;
    }
    
    .platform-description {
        font-size: 1.1rem;
        line-height: 1.8;
    }
    
    .stats-title {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 2.8rem;
    }
    
    .stat-label {
        font-size: 1.1rem;
    }
    
    .about-platform {
        padding: 30px 20px;
    }
}

@media (max-width: 576px) {
    .section-three,
    .section-four {
        padding: 40px 0;
    }
    
    .platform-title {
        font-size: 1.75rem;
    }
    
    .platform-description {
        font-size: 1rem;
        line-height: 1.7;
    }
    
    .stats-title {
        font-size: 1.75rem;
        margin-bottom: 30px;
    }
    
    .stat-card {
        padding: 30px 15px;
    }
    
    .stat-number {
        font-size: 2.5rem;
    }
    
    .stat-label {
        font-size: 1rem;
    }
    
    .btn-learn-more {
        padding: 10px 30px;
        font-size: 1rem;
    }
}

/* Nested Dropdown Styles */
.dropdown-menu {
    border: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    padding: 10px 0;
    margin-top: 5px;
}

.dropdown-item {
    padding: 10px 20px;
    transition: all 0.3s ease;
    color: #333;
    font-weight: 500;
}

.dropdown-item:hover {
    background-color: #20b2aa;
    color: #fff;
    transform: translateX(-5px);
}

.dropend .dropdown-menu {
    top: 0;
    right: 100%;
    margin-top: 0;
    margin-right: 0.125rem;
}

.dropend .dropdown-toggle::after {
    margin-right: auto;
    margin-left: 0.5em;
    border-width: 0.3em 0 0.3em 0.3em;
    border-left-color: currentColor;
}

/* RTL Support for nested dropdowns */
[dir="rtl"] .dropend .dropdown-menu {
    right: auto;
    left: 100%;
    margin-right: 0;
    margin-left: 0.125rem;
}

[dir="rtl"] .dropend .dropdown-toggle::after {
    margin-left: auto;
    margin-right: 0.5em;
    border-width: 0.3em 0.3em 0.3em 0;
    border-right-color: currentColor;
    border-left-color: transparent;
}

