/**
 * Dar Al-Khair Results Portal - Custom CSS Stylesheet
 * المسار: portal/assets/css/style.css
 * الهوية اللونية: الأزرق (#1b75bc) والبرتقالي الذهبي (#f58220) المستوحاة من شعار المجمع
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800;900&family=Tajawal:wght@400;500;700;800;900&display=swap');

:root {
    --primary: #1b75bc;
    --primary-rgb: 27, 117, 188;
    --secondary: #f58220;
    --secondary-rgb: 245, 130, 32;
    --dark-slate: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --light-bg: #f8fafc;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --font-cairo: 'Cairo', sans-serif;
    --font-tajawal: 'Tajawal', sans-serif;
    --radius-lg: 20px;
    --radius-md: 12px;
}

/* التنسيق العام */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--light-bg);
    color: var(--dark-slate);
    font-family: var(--font-cairo);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* الخلفيات الفنية المتدرجة الدائرية لتوفير مظهر فخم للموقع */
body::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(27,117,188,0.15) 0%, rgba(255,255,255,0) 70%);
    z-index: -1;
}

body::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245,130,32,0.12) 0%, rgba(255,255,255,0) 70%);
    z-index: -1;
}

/* الحاوية الرئيسية */
.portal-container {
    width: 100%;
    max-width: 900px;
    margin: auto;
    padding: 30px 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.portal-wide-container {
    max-width: 1200px !important;
}

/* تصميم الزجاج البلوري Glassmorphism */
.glass-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    box-shadow: 0 15px 35px -5px rgba(15, 23, 42, 0.06), 
                0 10px 15px -8px rgba(15, 23, 42, 0.04);
    padding: 40px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* ترويسة الوزارة والإدارة في الصفحة الرئيسية */
.ministry-header {
    text-align: center;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ministry-header span {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    font-family: var(--font-tajawal);
}

/* سطر الوزارة/الإدارة في ترويسة الشهادة */
.ministry-line {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    font-family: var(--font-tajawal);
    margin-bottom: 2px;
}

/* الشعار الرئيسي للمجمع */
.logo-container {
    text-align: center;
    margin-bottom: 25px;
}

.logo-container img {
    max-width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.logo-container img:hover {
    transform: rotate(5deg) scale(1.05);
}

.portal-title {
    font-family: var(--font-tajawal);
    font-size: 24px;
    font-weight: 900;
    color: var(--primary);
    text-align: center;
    margin-bottom: 5px;
}

.portal-subtitle {
    font-size: 14px;
    color: var(--gray);
    text-align: center;
    margin-bottom: 35px;
    font-weight: 600;
}

/* فورم البحث التفاعلي */
.search-box {
    max-width: 480px;
    margin: 0 auto;
}

.form-group {
    position: relative;
    margin-bottom: 20px;
}

.input-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 18px;
    transition: all 0.3s ease;
}

.form-input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    font-size: 15px;
    font-weight: 600;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    outline: none;
    background-color: #ffffff;
    transition: all 0.3s ease;
    text-align: right;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(27, 117, 188, 0.15);
}

.form-input:focus + .input-icon {
    transform: translateY(-50%) scale(1.1);
    color: var(--secondary);
}

/* الأزرار الاحترافية والتفاعلية */
.btn-submit {
    width: 100%;
    padding: 15px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary) 0%, #125488 100%);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 20px -10px rgba(27, 117, 188, 0.5);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-submit:hover {
    background: linear-gradient(135deg, #1d7bbf 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -10px rgba(27, 117, 188, 0.6);
}

.btn-submit:active {
    transform: translateY(0);
}

/* بطاقة الشهادة التقديرية التفاعلية للنتيجة (The Certificate Card) */
.certificate-card {
    border: 3px double var(--border);
    border-radius: var(--radius-lg);
    background: #ffffff;
    padding: 40px;
    margin-top: 30px;
    position: relative;
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.1);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* تحديد البرواز الملون بحسب التقدير والمعدل */
.cert-rating-excellent { border-color: #ffd700; box-shadow: 0 0 25px rgba(255, 215, 0, 0.15); }
.cert-rating-verygood { border-color: #c0c0c0; box-shadow: 0 0 20px rgba(192, 192, 192, 0.15); }
.cert-rating-good { border-color: #cd7f32; box-shadow: 0 0 15px rgba(205, 127, 50, 0.15); }
.cert-rating-pass { border-color: var(--primary); }
.cert-rating-fail { border-color: var(--error); }

/* تهنئة النجاح المضيئة (Success Header) */
.success-banner {
    text-align: center;
    margin-bottom: 30px;
    animation: pulseGlow 2s infinite ease-in-out;
}

.success-title {
    font-family: var(--font-tajawal);
    font-size: 26px;
    font-weight: 900;
    color: var(--secondary);
    margin-bottom: 5px;
}

.success-subtitle {
    font-size: 14px;
    color: var(--success);
    font-weight: 700;
}

/* بيانات الطالب الأساسية */
.student-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px 30px;
    background-color: var(--light-bg);
    padding: 20px 25px;
    border-radius: var(--radius-md);
    margin-bottom: 30px;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 12px;
    color: var(--gray);
    font-weight: 700;
    margin-bottom: 3px;
}

.info-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark-slate);
}

/* دائرة النسبة المئوية الدائرية الفخمة */
.percentage-badge-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

.percentage-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff 60%, var(--light-bg) 100%);
    border: 8px solid var(--secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(245, 130, 32, 0.15);
    position: relative;
    animation: scaleIn 0.5s ease-out;
}

.percentage-val {
    font-size: 32px;
    font-weight: 900;
    color: var(--secondary);
    line-height: 1;
}

.percentage-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--primary);
    margin-top: 5px;
}

/* جدول المواد والتفاصيل */
.results-table-container {
    width: 100%;
    margin-bottom: 30px;
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    min-width: 500px;
}

.results-table th {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    padding: 12px 15px;
}

.results-table th:first-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.results-table th:last-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }

.results-table td {
    padding: 14px 15px;
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid #edf2f7;
    color: var(--slate-700);
}

.results-table tr:last-child td {
    border-bottom: none;
}

/* درجات وتنبيهات المواد */
.badge-status {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}

.badge-passed { background-color: #dcfce7; color: var(--success); }
.badge-failed { background-color: #fef2f2; color: var(--error); }
.badge-absent { background-color: #fef3c7; color: var(--warning); }
.badge-optional { background-color: #f1f5f9; color: var(--gray); }

/* شريط تقدم تفصيلي للمادة */
.sub-progress-bar {
    height: 6px;
    background-color: #e2e8f0;
    border-radius: 3px;
    margin-top: 5px;
    width: 100px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}

.sub-progress-fill {
    height: 100%;
    border-radius: 3px;
}

.fill-passed { background-color: var(--success); }
.fill-failed { background-color: var(--error); }

/* لوحة الأرقام والمجاميع الإجمالية */
.total-summary-card {
    background-color: var(--primary-light);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border: 1px solid rgba(27, 117, 188, 0.15);
}

.summary-block {
    text-align: center;
}

.summary-block-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.summary-block-lbl {
    font-size: 11px;
    color: var(--slate-700);
    font-weight: 700;
    margin-top: 3px;
}

/* طبقة الـ Confetti */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* تذييل الصفحة */
.portal-footer {
    text-align: center;
    padding: 20px;
    font-size: 11px;
    color: var(--gray);
    font-weight: 700;
    margin-top: 30px;
    border-top: 1px solid rgba(226, 232, 240, 0.5);
}

/* صفحة إغلاق الصيانة */
.maintenance-box {
    text-align: center;
    padding: 40px 20px;
}

.maintenance-icon {
    font-size: 50px;
    color: var(--secondary);
    margin-bottom: 20px;
    animation: rotateWrench 2.5s infinite ease-in-out;
}

/* أنيميشن */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.cert-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 350px;
    height: 350px;
    opacity: 0.02;
    pointer-events: none;
    z-index: 0;
}

/* الترويسة الاحترافية المنسقة للشهادة */
.cert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 12px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.header-logo {
    width: 100px;
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.header-center {
    text-align: center;
    flex-grow: 1;
}

.basmala {
    font-size: 11px;
    color: var(--slate-700);
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
}

.institution-name {
    font-size: 20px;
    font-weight: 900;
    color: var(--primary);
    font-family: var(--font-tajawal);
}

.header-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
}

.header-divider::before, .header-divider::after {
    content: '';
    height: 1.5px;
    width: 80px;
    background: linear-gradient(90deg, transparent, var(--secondary), transparent);
}

.diamond {
    width: 8px;
    height: 8px;
    background-color: var(--secondary);
    transform: rotate(45deg);
    margin: 0 10px;
}

/* وشاح عنوان الامتحان المنتصف */
.exam-ribbon-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    z-index: 1;
    position: relative;
}

.exam-ribbon {
    background-color: var(--primary);
    color: #ffffff;
    padding: 8px 45px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 15px;
    position: relative;
    border: 2px solid var(--secondary);
    box-shadow: 0 4px 6px rgba(27,117,188,0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* صندوق بيانات الطالب المطور */
.student-info-box {
    border: 1.5px solid var(--secondary);
    border-radius: 12px;
    padding: 18px 25px;
    margin-bottom: 25px;
    background: #fffcf9;
    z-index: 1;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.01);
}

.info-row-full {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px dashed rgba(245,130,32,0.3);
    margin-bottom: 12px;
    font-size: 15px;
}

.info-row-full i {
    color: var(--secondary);
    font-size: 18px;
}

.info-row-full .label {
    font-weight: 700;
    color: var(--slate-700);
}

.info-row-full .value-name {
    font-weight: 900;
    color: var(--primary);
    font-size: 17px;
}

.info-grid-three {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
}

.info-grid-four {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.2fr;
    gap: 15px;
}

.info-column {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.info-column i {
    color: var(--secondary);
    font-size: 16px;
}

.info-column .label {
    font-weight: 700;
    color: var(--slate-700);
}

.info-column .value {
    font-weight: 800;
    color: var(--primary);
}

/* جدول الدرجات الأفقي التفاعلي */
.horizontal-table-wrapper {
    margin-bottom: 25px;
    z-index: 1;
    position: relative;
    width: 100%;
    overflow-x: auto; /* السماح بالتمرير اللطيف على مقاسات الجوال لحماية سلامة النصوص */
}

.horizontal-table {
    width: 100%;
    table-layout: auto; /* ضبط العرض ديناميكياً حسب طول النص لمنع أي تداخل */
    border-collapse: collapse;
    border: 1.5px solid var(--secondary);
    border-radius: 10px;
    overflow: hidden;
}

.table-header-row th {
    background-color: var(--primary);
    color: #ffffff;
    padding: 12px 10px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    border: 1px solid var(--secondary);
    white-space: nowrap; /* إجبار اسم المادة على البقاء في سطر واحد لمنع التداخل */
}

.table-header-row th .subject-title {
    display: block;
    margin-bottom: 3px;
    line-height: 1.2;
}

.table-header-row th .max-grade-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    opacity: 0.9;
}

.table-grade-row td {
    padding: 14px 10px;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    border: 1px solid var(--secondary);
    background-color: #ffffff;
    white-space: nowrap; /* منع تداخل الأرقام والدرجات */
}

.header-label-cell, .grade-label-cell {
    background-color: #fcf6f0 !important;
    color: var(--primary) !important;
    font-weight: 800 !important;
    text-align: right !important;
    padding-right: 15px !important;
    font-size: 14px !important;
    white-space: nowrap;
}

.total-header-cell, .total-grade-cell {
    /* تترك العروض حرة ليتحكم بها المتصفح تلقائياً حسب النص */
}

.passed-grade {
    color: var(--success);
    font-weight: 900;
}

.failed-grade {
    color: var(--error);
    font-weight: 900;
}

.absent-badge {
    color: var(--error);
    font-size: 12px;
    font-weight: 800;
}

.optional-badge {
    color: var(--slate-700);
    font-size: 12px;
    font-weight: 500;
}

.total-header-cell {
    background-color: var(--secondary) !important;
    border-color: var(--secondary) !important;
}

.total-grade-cell {
    background-color: #fef6f0 !important;
    border-color: var(--secondary) !important;
}

/* صندوق تعليق رائد الصف المطور */
.teacher-comment-box {
    border: 1.5px solid var(--secondary);
    border-radius: 12px;
    padding: 12px 18px;
    margin-bottom: 25px;
    background: #ffffff;
    z-index: 1;
    position: relative;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 5px;
}

.comment-body {
    font-size: 12px;
    color: var(--slate-700);
    line-height: 1.6;
    font-weight: 600;
}

/* التواقيع السفلية والختم المدمج */
.signatures-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding: 0 10px;
    margin-bottom: 25px;
    z-index: 1;
    position: relative;
}

.signature-line {
    font-size: 12px;
    font-weight: 800;
    color: var(--slate-700);
    display: flex;
    align-items: center;
    gap: 8px;
    width: 260px;
}

.signature-line i {
    color: var(--primary);
}

.school-seal {
    width: 75px;
    height: 75px;
    border: 2px dashed var(--secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-8deg);
    background-color: #fffcf9;
}

.seal-inner {
    font-size: 9px;
    font-weight: 900;
    color: var(--slate-400);
    text-align: center;
    line-height: 1.3;
}

/* الزخرفة والتمويج السفلي */
.bottom-decorative-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25px;
    background: linear-gradient(135deg, var(--primary) 0%, #125488 100%);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border-top: 3px solid var(--secondary);
    z-index: 0;
}

.bottom-medal-seal {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    background-color: var(--secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    z-index: 1;
}

.bottom-medal-seal i {
    color: #ffffff;
    font-size: 12px;
}

/* تحسينات الطباعة للـ A4 */
@media print {
    body {
        background-color: #ffffff !important;
        background-image: none !important;
        color: #000000 !important;
        font-size: 11px;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    body::before, body::after {
        display: none !important;
    }
    .portal-container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    .certificate-card {
        border: 6px double var(--primary) !important;
        box-shadow: none !important;
        background: #ffffff !important;
        padding: 20px 25px 35px 25px !important;
        margin-top: 0 !important;
        border-radius: 12px !important;
        width: 100% !important;
        position: relative !important;
        page-break-inside: avoid !important;
    }
    .btn-submit, .search-box, .portal-subtitle, .logo-container img:not(.print-logo), #print-btn-group, .portal-footer, #balloons-container, .mobile-only {
        display: none !important;
    }
    .desktop-only {
        display: block !important;
    }
    
    /* تقليل المسافات العمودية في الطباعة لضمان ملاءمتها لصفحة A4 واحدة */
    .cert-header {
        margin-bottom: 12px !important;
        padding-bottom: 8px !important;
    }
    .exam-ribbon-wrapper {
        margin-bottom: 12px !important;
    }
    .exam-ribbon {
        padding: 6px 30px !important;
        font-size: 13px !important;
    }
    .student-info-box {
        margin-bottom: 15px !important;
        padding: 12px 20px !important;
    }
    .info-row-full {
        padding-bottom: 8px !important;
        margin-bottom: 8px !important;
        font-size: 13px !important;
    }
    .info-row-full .value-name {
        font-size: 15px !important;
    }
    .horizontal-table-wrapper {
        margin-bottom: 15px !important;
    }
    .table-grade-row td {
        padding: 8px !important;
        font-size: 12px !important;
    }
    .teacher-comment-box {
        margin-bottom: 15px !important;
        padding: 8px 15px !important;
    }
    
    .table-header-row th {
        background-color: var(--primary) !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .total-header-cell {
        background-color: var(--secondary) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .header-label-cell, .grade-label-cell {
        background-color: #fcf6f0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .total-grade-cell {
        background-color: #fef6f0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .student-info-box {
        background-color: #fffcf9 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .bottom-decorative-wave {
        background: var(--primary) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .bottom-medal-seal {
        background-color: var(--secondary) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* بالونات احتفالية عائمة */
.balloon {
    position: fixed;
    bottom: -100px;
    width: 42px;
    height: 54px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    z-index: 999;
    opacity: 0.8;
    animation: floatUp 7s linear infinite;
    pointer-events: none;
}

.balloon::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 20px;
    width: 2px;
    height: 12px;
    background-color: #94a3b8;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-115vh) rotate(20deg);
        opacity: 0;
    }
}

/* الفئات التبادلية للأجهزة ومتجاوبة الشاشات */
.mobile-only {
    display: none !important;
}

.desktop-only {
    display: block !important;
}


/* Ø§Ù„ÙØ¦Ø§Øª Ø§Ù„ØªØ¨Ø§Ø¯Ù„ÙŠØ© Ù„Ù„Ø£Ø¬Ù‡Ø²Ø© ÙˆÙ…ØªØ¬Ø§ÙˆØ¨Ø© Ø§Ù„Ø´Ø§Ø´Ø§Øª */
.mobile-only {
    display: none !important;
}

.desktop-only {
    display: block !important;
}

/* ØªÙ†Ø³ÙŠÙ‚ ØªØ°ÙŠÙŠÙ„ Ø§Ù„Ø¨ÙˆØ§Ø¨Ø© */
.portal-footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
}

@media screen and (max-width: 992px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }

    /* === Ø¥Ø²Ø§Ù„Ø© Ø§Ù„Ø²Ø®Ø§Ø±Ù Ø§Ù„Ø¯Ø§Ø¦Ø±ÙŠØ© Ø¹Ù„Ù‰ Ø§Ù„Ø¬ÙˆØ§Ù„ === */
    body::before,
    body::after {
        display: none !important;
    }

    /* === Ø§Ù„Ø­Ø§ÙˆÙŠØ© Ø§Ù„Ø±Ø¦ÙŠØ³ÙŠØ©: Ù…Ù„Ø¡ Ø§Ù„Ø´Ø§Ø´Ø© ÙƒØªØ·Ø¨ÙŠÙ‚ === */
    body {
        background-color: #ffffff !important;
    }

    .portal-container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        justify-content: flex-start !important;
    }

    .portal-wide-container {
        padding: 0 !important;
        max-width: 100% !important;
    }

    /* === Ø§Ù„ÙƒØ§Ø±Øª Ø§Ù„Ø²Ø¬Ø§Ø¬ÙŠ: Ø¨Ø¯ÙˆÙ† Ø­Ø¯ÙˆØ¯ = Ø¬Ø²Ø¡ Ù…Ù† Ø§Ù„Ø®Ù„ÙÙŠØ© === */
    .glass-card {
        padding: 24px 16px !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: #ffffff !important;
    }

    /* === ÙØ§ØµÙ„ Ø¨ØµØ±ÙŠ Ø¨ÙŠÙ† Ø§Ù„ÙƒØ±ÙˆØª === */
    .glass-card.mt-4 {
        margin-top: 8px !important;
        border-top: 6px solid #f1f5f9 !important;
        padding-top: 20px !important;
    }

    /* === Ø§Ù„Ø´Ø¹Ø§Ø± === */
    .logo-container {
        margin-bottom: 10px !important;
    }

    .logo-container img {
        max-height: 75px !important;
        height: auto !important;
    }

    /* === Ø§Ù„Ø¹Ù†ÙˆØ§Ù† ÙˆØ§Ù„ÙˆØµÙ === */
    .portal-title {
        font-size: 19px !important;
        margin-bottom: 4px !important;
    }

    .portal-subtitle {
        margin-bottom: 20px !important;
        font-size: 12px !important;
        color: #94a3b8 !important;
    }

    /* === ÙÙˆØ±Ù… Ø§Ù„Ø¨Ø­Ø«: Ø¹Ø±Ø¶ ÙƒØ§Ù…Ù„ === */
    .search-box {
        max-width: 100% !important;
    }

    .form-input {
        padding: 14px 45px 14px 16px !important;
        font-size: 14px !important;
        border-radius: 10px !important;
    }

    .btn-submit {
        padding: 13px !important;
        font-size: 15px !important;
        border-radius: 10px !important;
    }

    /* === ØµÙ†Ø¯ÙˆÙ‚ Ø§Ù„ØµÙŠØ§Ù†Ø© === */
    .maintenance-box {
        padding: 20px 10px !important;
    }

    /* === Ø¨Ø·Ø§Ù‚Ø© Ø§Ù„Ø´Ù‡Ø§Ø¯Ø© === */
    .certificate-card {
        padding: 18px 12px !important;
        border-width: 3px !important;
        border-radius: 14px !important;
        margin-top: 0 !important;
        margin-left: 8px !important;
        margin-right: 8px !important;
    }
    
    .cert-header {
        flex-direction: column !important;
        gap: 12px !important;
        text-align: center !important;
    }
    
    .cert-header .header-logo {
        order: 2;
    }
    
    .cert-header .header-center {
        order: 1;
        width: 100%;
    }
    
    .cert-header .header-logo:last-child {
        display: none !important;
    }

    .institution-name {
        font-size: 15px !important;
        line-height: 1.4 !important;
    }

    .success-title {
        font-size: 20px !important;
    }

    .success-subtitle {
        font-size: 12px !important;
    }

    /* === ØµÙ†Ø¯ÙˆÙ‚ Ù…Ø¹Ù„ÙˆÙ…Ø§Øª Ø§Ù„Ø·Ø§Ù„Ø¨ === */
    .student-info-box {
        padding: 12px !important;
        border-radius: 10px !important;
    }

    .info-row-full {
        flex-wrap: wrap !important;
        gap: 6px !important;
        font-size: 13px !important;
    }

    .info-row-full .value-name {
        font-size: 14px !important;
        width: 100% !important;
    }

    .info-grid-three, .info-grid-four {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    
    .info-column {
        border-bottom: 1px dashed rgba(0,0,0,0.05) !important;
        padding-bottom: 8px !important;
        display: flex;
        flex-wrap: wrap !important;
        justify-content: space-between;
        align-items: center;
        gap: 4px !important;
        font-size: 12px !important;
    }
    
    .info-column:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }

    /* === Ø§Ù„Ø¹Ø¯Ø§Ø¯ Ø§Ù„ØªÙ†Ø§Ø²Ù„ÙŠ === */
    .countdown-container {
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center !important;
    }

    /* === Ø§Ø®ØªÙŠØ§Ø± Ø§Ù„Ø§Ù…ØªØ­Ø§Ù† === */
    .exam-selector-container {
        padding: 8px !important;
    }

    /* === ØªØ°ÙŠÙŠÙ„ Ø§Ù„ØµÙØ­Ø© === */
    .portal-footer {
        text-align: center !important;
        padding: 14px 16px !important;
        font-size: 11px !important;
        color: #94a3b8 !important;
        background: #ffffff !important;
        border-top: 6px solid #f1f5f9 !important;
    }

    /* === Ø£Ø²Ø±Ø§Ø± Ø§Ù„Ø·Ø¨Ø§Ø¹Ø© ÙˆØ§Ù„ØªØ­Ù…ÙŠÙ„ === */
    #print-btn-group {
        padding: 0 12px !important;
        margin-bottom: 16px !important;
    }

    #print-btn-group .btn-submit {
        font-size: 13px !important;
        padding: 10px 14px !important;
    }

    /* === Ø§Ù„ØªØ¹Ù„ÙŠÙ‚Ø§Øª ÙˆØ§Ù„ØªÙ‚Ø¯ÙŠØ± === */
    .teacher-comment-box {
        padding: 12px !important;
        border-radius: 10px !important;
        font-size: 13px !important;
    }

    /* === Ø§Ù„ØªØ¹Ø§Ù…ÙŠÙ… Ø¹Ù„Ù‰ Ø§Ù„Ø¬ÙˆØ§Ù„ === */
    .announcements-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .announcement-card {
        border-radius: 10px !important;
    }

    .card-content-wrapper {
        padding: 12px !important;
    }

    /* === Ø§Ù„Ù…ÙˆØ¯Ø§Ù„ === */
    .custom-modal {
        padding: 0 !important;
        align-items: flex-end !important;
    }

    .modal-content-card {
        border-radius: 16px 16px 0 0 !important;
        max-height: 85vh !important;
        animation: slideUpMobile 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .modal-body-content {
        padding: 20px 16px !important;
    }

    .modal-body-content h3 {
        font-size: 16px !important;
    }

    /* ØªØµÙ…ÙŠÙ… Ù‚Ø§Ø¦Ù…Ø© Ø¯Ø±Ø¬Ø§Øª Ø§Ù„Ø¬ÙˆØ§Ù„ Ø§Ù„Ø¬Ø°Ø§Ø¨Ø© */
    .mobile-grades-wrapper {
        margin-top: 8px;
        margin-bottom: 16px;
        z-index: 1;
        position: relative;
    }
    
    .mobile-section-title {
        font-size: 13px;
        font-weight: 800;
        color: var(--primary);
        margin-bottom: 10px;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .mobile-grades-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .mobile-grade-card {
        background: #ffffff;
        border: 1px solid rgba(226, 232, 240, 0.8);
        border-radius: 10px;
        padding: 12px 14px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: 0 1px 3px rgba(0,0,0,0.02);
        transition: transform 0.2s;
    }
    
    .mobile-grade-card:hover {
        transform: translateY(-1px);
    }
    
    .mobile-grade-card.total-card {
        background: #fffcf9;
        border: 1.5px solid var(--secondary);
    }
    
    .card-subject-info {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 1;
        min-width: 0;
    }
    
    .subject-icon {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background-color: rgba(27, 117, 188, 0.08);
        color: var(--primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        flex-shrink: 0;
    }
    
    .total-card .subject-icon {
        background-color: #fef6f0;
        color: var(--secondary);
        flex-shrink: 0;
    }
    
    .subject-name {
        font-size: 12px;
        font-weight: 800;
        color: var(--slate-700);
        word-break: break-word;
        white-space: normal;
    }
    
    .card-grade-info {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .grade-numbers {
        display: flex;
        align-items: center;
        gap: 3px;
        font-size: 12px;
    }
    
    .grade-numbers .student-score {
        font-weight: 900;
        font-size: 13px;
    }
    
    .grade-numbers .divider {
        color: #94a3b8;
    }
    
    .grade-numbers .max-score {
        color: #64748b;
        font-weight: 600;
    }
    
    .passed-text {
        color: var(--success);
    }
    
    .failed-text {
        color: var(--error);
    }
    
    .grade-status-badge {
        font-size: 10px;
        font-weight: 800;
        padding: 2px 7px;
        border-radius: 20px;
    }
    
    .status-passed {
        background-color: #dcfce7;
        color: var(--success);
    }
    
    .status-failed {
        background-color: #fef2f2;
        color: var(--error);
    }
    
    .badge-absent {
        background-color: #fef3c7;
        color: var(--warning);
        font-size: 10px;
        font-weight: 800;
        padding: 2px 7px;
        border-radius: 20px;
    }
    
    .badge-optional {
        background-color: #f1f5f9;
        color: var(--gray);
        font-size: 10px;
        font-weight: 800;
        padding: 2px 7px;
        border-radius: 20px;
    }
}

/* ØªØµÙ…ÙŠÙ… Ø¥Ø¹Ù„Ø§Ù†Ø§Øª ÙˆØªØ¹Ø§Ù…ÙŠÙ… Ø§Ù„Ù…Ø¬Ù…Ø¹ Ø§Ù„Ù…Ø·ÙˆØ± */
.announcements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.announcement-card {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.01);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
    cursor: pointer;
}

.announcement-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -8px rgba(15, 23, 42, 0.08);
    border-color: rgba(27, 117, 188, 0.2);
}

.card-img-wrapper {
    width: 100%;
    height: 140px;
    overflow: hidden;
    background-color: #f1f5f9;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.announcement-card:hover .card-img-wrapper img {
    transform: scale(1.05);
}

.card-content-wrapper {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 11px;
}

.category-badge {
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
}

.meta-date {
    color: #64748b;
    font-weight: 700;
}

.card-news-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--dark-slate);
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-news-desc {
    font-size: 12px;
    color: var(--slate-700);
    line-height: 1.6;
    margin-bottom: 15px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more-link {
    font-size: 12px;
    font-weight: 800;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: gap 0.2s ease;
    margin-top: auto;
}

.announcement-card:hover .read-more-link {
    gap: 8px;
    color: var(--secondary);
}

/* ØªØµÙ…ÙŠÙ… Ø§Ù„Ù…ÙˆØ¯Ø§Ù„ Ø§Ù„Ù…Ù†Ø¨Ø«Ù‚ Ø§Ù„ÙØ§Ø®Ø± Ù„Ù„ØªØ¹Ø§Ù…ÙŠÙ… */
.custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.25s ease-out;
}

.modal-content-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    position: relative;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.close-modal-btn:hover {
    background: #e2e8f0;
    color: var(--dark-slate);
    transform: rotate(90deg);
}

.modal-body-content {
    padding: 30px;
}

.modal-body-content .badge-status {
    margin-bottom: 12px;
}

.modal-body-content h3 {
    font-size: 18px;
    font-weight: 900;
    color: var(--dark-slate);
    line-height: 1.4;
    margin-bottom: 8px;
    font-family: var(--font-tajawal);
}

.modal-date-text {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 700;
    display: block;
    margin-bottom: 20px;
}

.modal-image-wrapper {
    width: 100%;
    max-height: 280px;
    overflow: hidden;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.modal-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-text-desc {
    font-size: 14px;
    color: var(--slate-700);
    line-height: 1.8;
    font-weight: 500;
    white-space: pre-line;
    text-align: justify;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
