/* ===================================================================
   print.css — قواعد الطباعة لصفحة الطالب (A4)
   ===================================================================
   - يُحمَّل بـ media="print"
   - يخفي عناصر التنقل والأزرار
   - يطبع بطاقة النتيجة فقط مع ترويسة مدرسية
   =================================================================== */

@page {
    size: A4;
    margin: 1.5cm;
}

@media print {
    /* الأساسيات */
    html, body {
        background: white !important;
        color: black !important;
        font-size: 11pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    body { padding: 0 !important; }

    /* إخفاء كل العناصر التفاعلية */
    .no-print,
    .site-header,
    .site-footer,
    .search-card,
    .actions-row,
    button,
    .alert {
        display: none !important;
    }

    /* الترويسة المخصصة للطباعة (display:none في الشاشة، block في الطباعة) */
    .print-only { display: block !important; }
    .print-header {
        text-align: center;
        margin: 0 0 24pt;
        padding-bottom: 14pt;
        border-bottom: 2pt solid #2A6EBB;
    }
    .print-header h1 {
        font-size: 16pt;
        font-weight: 900;
        color: #2A6EBB;
        margin-bottom: 4pt;
    }
    .print-header p {
        font-size: 11pt;
        color: #4B5563;
        margin: 2pt 0;
    }
    .print-header .print-date {
        font-size: 9pt;
        color: #6B7280;
        margin-top: 8pt;
    }

    /* تخطيط الصفحة */
    .main-area { padding: 0 !important; }

    /* بطاقة النتيجة */
    .result-card {
        box-shadow: none !important;
        border: 1.5pt solid #D1D5DB;
        border-radius: 6pt;
        max-width: 100% !important;
        margin: 0 !important;
        page-break-inside: avoid;
        overflow: visible !important;
    }

    /* الـ Hero يبقى ملوّناً (مع print-color-adjust: exact) */
    .result-hero {
        padding: 18pt 16pt !important;
        box-shadow: none !important;
    }
    .hero-exam { font-size: 10pt; }
    .hero-name { font-size: 16pt; }
    .hero-meta { font-size: 11pt; }

    /* score */
    .score-section { padding: 20pt 16pt 12pt !important; }
    .score-circle {
        width: 110pt !important; height: 110pt !important;
        border-width: 5pt !important;
        box-shadow: none !important;
        margin-bottom: 10pt !important;
    }
    .score-num { font-size: 36pt !important; }
    .score-of  { font-size: 10pt !important; }

    .grade-label {
        font-size: 13pt !important;
        padding: 6pt 16pt !important;
        box-shadow: none !important;
    }
    .grade-label .grade-pct { font-size: 10pt !important; }

    .badges-row { margin-top: 14pt !important; gap: 6pt !important; }
    .top-badge {
        font-size: 10pt !important; padding: 6pt 12pt !important;
        box-shadow: none !important;
    }
    .top-badge .rank { padding: 1pt 7pt !important; font-size: 9pt !important; }
    .avg-compare { font-size: 10pt !important; padding: 5pt 12pt !important; }

    /* التفاصيل */
    .details-section { padding: 14pt 16pt !important; }
    .details-title { font-size: 11pt !important; margin-bottom: 10pt !important; }
    .details-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6pt !important;
    }
    .detail-item { padding: 8pt !important; gap: 6pt !important; }
    .detail-item .d-icon {
        width: 28pt !important; height: 28pt !important; font-size: 12pt !important;
    }
    .detail-item .d-num { font-size: 14pt !important; }
    .detail-item .d-lbl { font-size: 9pt !important; }

    /* الروابط لا نريد الـ URL يظهر بعدها */
    a[href]:after { content: none !important; }

    /* تجنب فصل العناصر بين الصفحات */
    .result-hero, .score-section, .details-section {
        page-break-inside: avoid;
    }
}
