/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: white;
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
    /* Prevent horizontal scrolling */
    width: 100%;
}

/* Header Styles */
.header-section {
    background: #14445A;
    color: white;
    border-bottom: none;
}

.main-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
@font-face {
    font-family: 'Majallab';
    src: url('majallab.ttf') format('truetype');
}

@font-face {
    font-family: 'Majalla';
    src: url('majalla.ttf') format('truetype');
}

.cover-form .form-label,
.cover-form .form-control,
.cover-form textarea {
    font-family: 'Majalla', sans-serif;
}

.cover-form .majallab-field {
    font-family: 'Majallab', sans-serif;
}

.sub-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.school-title {
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.8;
}

/* إضافة تنسيق لوجو وزارة التعليم */
.ministry-logo {
    max-height: 80px;
    width: auto;
    object-fit: contain;
}

/* تصغير حجم بطاقات الإحصائيات */
.stat-card {
    background: white;
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    background: linear-gradient(135deg, #3c7db8, #06a869);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-left: 1rem;
}

.stat-content h4 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.3rem;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    color: #3c7db8;
}

/* تكبير أزرار العمل الرئيسية */
.action-buttons {
    display: flex;
    gap: 3rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 3rem;
}

.action-btn {
    background: #14445A;
    border: none;
    border-radius: 25px;
    padding: 3rem 4rem;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    min-width: 250px;
}

.action-btn:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.action-btn i {
    font-size: 4rem;
}

.action-btn span {
    font-size: 1.8rem;
    font-weight: 700;
}

.primary-btn i {
    color: white;
}

.primary-btn span {
    color: white;
}

.secondary-btn i {
    color: #06a869;
}

.secondary-btn span {
    color: #06a869;
}

/* Cards */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    background: #14445A;
    color: white;
    border: none;
    padding: 1.5rem;
}

.card-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.card-body {
    padding: 2rem;
}

/* Form Styles */
.form-control {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: #3c7db8;
    box-shadow: 0 0 0 0.2rem rgba(60, 125, 184, 0.25);
}

.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

/* Summary Cards */
.summary-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-3px);
}

.summary-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.summary-card .count {
    font-size: 2rem;
    font-weight: bold;
    display: block;
    margin-bottom: 0.5rem;
}

.summary-card small {
    color: #666;
    font-size: 0.8rem;
}

.excellent {
    border-right: 5px solid #28a745;
}

.excellent .count {
    color: #28a745;
}

.very-good {
    border-right: 5px solid #17a2b8;
}

.very-good .count {
    color: #17a2b8;
}

.good {
    border-right: 5px solid #ffc107;
}

.good .count {
    color: #ffc107;
}

.acceptable {
    border-right: 5px solid #fd7e14;
}

.acceptable .count {
    color: #fd7e14;
}

.weak {
    border-right: 5px solid #dc3545;
}

.weak .count {
    color: #dc3545;
}

.total {
    border-right: 5px solid #6f42c1;
}

.total .count {
    color: #6f42c1;
}

.average {
    border-right: 5px solid #20c997;
}

.average .count {
    color: #20c997;
}

.percentage {
    border-right: 5px solid #3c7db8;
}

.percentage .count {
    color: #3c7db8;
}

/* Students List */
.student-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 0.5rem;
    /* Reduced vertical padding */
    margin-bottom: 0.2rem;
    /* Reduced vertical spacing */
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    /* Ensure full width without overflow */
    overflow-x: hidden;
    /* Prevent horizontal overflow */
}

.student-grade {
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    /* Adjusted padding for compactness */
    border-radius: 20px;
    color: white;
    font-size: 0.9rem;
    /* Slightly reduced font size */
}

.grade-excellent {
    background-color: #28a745;
}

.grade-very-good {
    background-color: #17a2b8;
}

.grade-good {
    background-color: #ffc107;
    color: #333;
}

.grade-acceptable {
    background-color: #fd7e14;
}

.grade-weak {
    background-color: #dc3545;
}

/* Footer */
.footer-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    margin-top: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        min-height: 100vh;
        overflow-x: hidden;
    }

    .container {
        padding: 0.5rem;
    }

    .header-section {
        padding: 1rem 0;
    }

    .main-title {
        font-size: 1.5rem;
        margin-bottom: 0.3rem;
    }

    .sub-title {
        font-size: 1rem;
        margin-bottom: 0.3rem;
    }

    .school-title {
        font-size: 0.9rem;
    }

    .ministry-logo {
        max-height: 50px;
    }

    .row.mb-4 {
        display: flex;
        gap: 0.5rem;
    }

    .row.mb-4 .col-md-6 {
        flex: 1;
        max-width: 50%;
    }

    .stat-card {
        padding: 0.4rem;
        margin-bottom: 0.5rem;
        flex-direction: column;
        text-align: center;
        min-height: auto;
    }

    .stat-icon {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
        margin-left: 0;
        margin-bottom: 0.3rem;
    }

    .stat-content h4 {
        font-size: 0.7rem;
        margin-bottom: 0.1rem;
        line-height: 1.2;
    }

    .stat-number {
        font-size: 1rem;
    }

    .action-buttons {
        gap: 1rem;
        margin-top: 1.5rem;
    }

    .action-btn {
        padding: 1.5rem 2rem;
        min-width: 350px;
        max-width: 400px;
    }

    .action-btn i {
        font-size: 2.5rem;
    }

    .action-btn span {
        font-size: 1.4rem;
    }

    .py-5 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    .py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .mb-5 {
        margin-bottom: 1.5rem !important;
    }

    .footer-section {
        padding: 1rem 0;
    }

    .footer-section p {
        font-size: 0.8rem;
        margin: 0;
    }

    .main-content {
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }

    /* Adjusted for mobile students list */
    .student-item {
        padding: 0.3rem;
        /* Further reduced padding */
        margin-bottom: 0.1rem;
        /* Minimized vertical spacing */
        font-size: 0.9rem;
        /* Reduced font size for compactness */
    }

    .student-item span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 50%;
        /* Limit width to prevent overflow */
    }

    .student-item div {
        display: flex;
        gap: 2px;
        /* Reduced gap between elements */
    }

    .student-item div span {
        font-size: 0.8rem;
        /* Adjusted font size */
        padding: 0.1rem 0.3rem;
        /* Reduced padding */
    }

    .student-grade {
        padding: 0.1rem 0.3rem;
        /* Further reduced padding */
        font-size: 0.8rem;
        /* Smaller font size */
    }
}

/* تحسينات إضافية للشاشات الصغيرة جداً */
@media (max-width: 480px) {
    .main-title {
        font-size: 1.3rem;
    }

    .action-btn {
        padding: 1rem 1.5rem;
        min-width: 250px;
    }

    .action-btn i {
        font-size: 2rem;
    }

    .action-btn span {
        font-size: 1.1rem;
    }

    .stat-card {
        padding: 0.4rem;
    }

    .stat-number {
        font-size: 1rem;
    }

    .container {
        padding: 0.3rem;
    }

    .student-item {
        padding: 0.2rem;
        /* Even tighter padding for very small screens */
        margin-bottom: 0.05rem;
        /* Minimal vertical spacing */
    }

    .student-item span {
        max-width: 45%;
        /* Further limit width */
    }

    .student-grade {
        padding: 0.1rem 0.2rem;
        /* Tightest padding */
        font-size: 0.7rem;
        /* Smallest font size */
    }
}

/* Chart Container */
#resultsChart {
    max-width: 100%;
    height: auto;
}

/* Button Styles */
.btn {
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #3c7db8, #06a869);
    border: none;
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Students List in Mobile */
@media (max-width: 768px) {
    .student-item span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .student-item div span {
        font-size: 0.8rem;
    }
}