/* Explain: Styles for UI components, including print styles for the assignment agreement. */
.tech-glow {
    box-shadow: var(--neon-glow);
    transition: all 0.3s ease;
}

.tech-glow:hover {
    box-shadow: 0 6px 20px rgba(15, 40, 98, 0.15);
    border-color: var(--primary-color);
}

.tech-text-glow {
    text-shadow: none; /* إزالة التوهج في النسخة الفاتحة */
}

.nav-link {
    position: relative;
    transition: color 0.3s;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    right: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
    left: 0;
    right: auto;
}

.print-header {
    display: none !important;
}

@media print {
    @page {
        size: A4;
        margin: 1.5cm;
    }
    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background: white !important;
    }
    .print-header {
        display: flex !important;
        break-after: avoid;
        page-break-after: avoid;
        margin-bottom: 2rem !important;
    }
    /* إخفاء جميع محتويات الصفحة باستثناء النافذة المفتوحة لضمان تدفق الطباعة عبر عدة صفحات */
    body > header, body > footer, main > section:not(:has(dialog[open])) {
        display: none !important;
    }
    section:has(dialog[open]) > *:not(dialog) {
        display: none !important;
    }
    
    body, html, main, section {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    dialog[open] {
        position: relative !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        inset: auto !important;
    }
    dialog[open] .modal-box {
        position: relative !important;
        display: block !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
    }
    dialog[open] .modal-backdrop {
        display: none !important;
    }
    .no-print, .no-print * {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* منع تقطيع الجداول والنصوص عند الانتقال لصفحة جديدة */
    table, tr, .bg-\[var\(--surface-color\)\] {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        break-after: avoid;
    }
    
    /* إظهار الجداول بالكامل وإلغاء شريط التمرير الأفقي في الطباعة */
    .overflow-x-auto {
        overflow: visible !important;
    }
    
    /* إجبار ظهور جميع التبويبات (للشروط والوثائق) عند الطباعة للحصول على مستند كامل */
    dialog[open] [style*="display: none"],
    dialog[open] [x-show] {
        display: block !important;
    }
    dialog[open] .flex-col[style*="display: none"],
    dialog[open] .flex-col[x-show] {
        display: flex !important;
    }
    dialog[open] .grid[x-show] {
        display: grid !important;
    }
}

/* طباعة وثيقة شروط التعيين (A4) مباشرة من الصفحة */
@media print {
    body.printing-doc > header,
    body.printing-doc > footer,
    body.printing-doc main > section:not(.printable-section) {
        display: none !important;
    }

    body.printing-doc main > section.printable-section {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #ffffff !important;
        border: none !important;
    }

    body.printing-doc .printable-doc {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    body.printing-doc .no-print,
    body.printing-doc .no-print * {
        display: none !important;
        visibility: hidden !important;
    }
}

/* مستندات العقود والاتفاقيات (الشؤون القانونية) */
.legal-doc {
    background: #ffffff;
    color: var(--text-color);
}

.legal-doc:focus {
    outline: none;
}

.legal-doc .legal-sec {
    font-size: 1rem;
    font-weight: 700;
    color: var(--secondary-color);
    border-right: 4px solid var(--primary-color);
    padding-right: 0.75rem;
    margin: 1.5rem 0 0.6rem;
}

@media print {
    dialog[open] .legal-doc {
        padding: 0 !important;
        font-size: 11pt;
        line-height: 1.8;
        color: #0f2862 !important;
    }

    .legal-doc .legal-sec,
    .legal-doc li,
    .legal-doc tr {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .legal-doc .legal-sec {
        page-break-after: avoid;
        break-after: avoid;
    }
}

/* ===== اتفاقية التكليف الأكاديمي (وحدة الشؤون القانونية) ===== */
.laa-doc {
    background: #ffffff;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 12px 34px rgba(15, 40, 98, 0.10);
    padding: 2rem 2.25rem;
    font-size: 15px;
    line-height: 1.9;
}

.laa-doc-header,
.laa-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.laa-logo {
    height: 90px;
    width: auto;
    max-width: 110px;
    object-fit: contain;
}

.laa-head-text { flex: 1; }
.laa-uni-ar { font-weight: 800; color: var(--secondary-color); font-size: 1.05rem; line-height: 1.4; }
.laa-uni-en { color: var(--text-muted); font-size: 0.8rem; }
.laa-uni-loc { color: var(--text-muted); font-size: 0.8rem; }
.laa-head-ref { text-align: left; }
.laa-ref-label { font-weight: 700; color: var(--primary-color); font-size: 0.85rem; }
.laa-ref-sub { color: var(--text-muted); font-size: 0.72rem; }

.laa-title { text-align: center; margin-bottom: 1rem; }
.laa-title h3 { font-weight: 800; color: var(--secondary-color); font-size: 1.4rem; margin: 0; }
.laa-title p { color: var(--primary-color); font-weight: 600; font-size: 0.85rem; margin: 0.25rem 0 0; }

.laa-intro { text-align: center; margin-bottom: 1.25rem; }
.laa-intro p { margin: 0 0 0.25rem; font-size: 0.9rem; color: var(--text-color); }
.laa-intro-site { color: var(--text-muted); font-size: 0.78rem !important; }

.laa-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.laa-meta-item {
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    border-radius: 0.5rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
}
.laa-meta-k { font-weight: 700; color: var(--secondary-color); }
.laa-meta-v { color: var(--text-color); }

.laa-sec {
    font-size: 1rem;
    font-weight: 800;
    color: var(--secondary-color);
    border-right: 4px solid var(--primary-color);
    padding-right: 0.6rem;
    margin: 1.4rem 0 0.6rem;
}

.laa-p { font-size: 0.9rem; line-height: 1.95; text-align: justify; margin: 0 0 0.5rem; }

.laa-list, .laa-ol { font-size: 0.9rem; line-height: 1.95; margin: 0 0 0.6rem; padding-right: 1.25rem; }
.laa-list { list-style: disc; }
.laa-ol { list-style: decimal; }
.laa-list li, .laa-ol li { margin-bottom: 0.25rem; }
.laa-k { font-weight: 700; color: var(--secondary-color); }

.laa-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0 0.85rem;
    font-size: 0.88rem;
}
.laa-table th, .laa-table td {
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    text-align: right;
}
.laa-table th {
    background: var(--secondary-color);
    color: #ffffff;
    font-weight: 700;
}
.laa-table tbody tr:nth-child(even) { background: var(--surface-color); }

.laa-sig {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
    border-top: 1px dashed var(--border-color);
    padding-top: 1rem;
}
.laa-sig-col { font-size: 0.9rem; line-height: 2.2; }
.laa-sig-title { font-weight: 800; color: var(--secondary-color); margin-bottom: 0.4rem; }
.laa-sig-col p { margin: 0; }

@media (max-width: 640px) {
    .laa-doc { padding: 1.25rem 1rem; font-size: 14px; }
    .laa-head { flex-direction: column; align-items: center; text-align: center; }
    .laa-head-ref { text-align: center; }
    .laa-meta { grid-template-columns: 1fr; }
    .laa-sig { grid-template-columns: 1fr; gap: 1.25rem; }
}

@media print {
    body.printing-doc .laa-wrap {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    body.printing-doc .laa-doc {
        font-size: 11pt;
        line-height: 1.75;
        color: #0f2862;
    }
    body.printing-doc .laa-doc .laa-sec { font-size: 12pt; }
    body.printing-doc .laa-doc .laa-table { font-size: 10.5pt; }
    body.printing-doc .laa-table,
    body.printing-doc .laa-table tr,
    body.printing-doc .laa-sig,
    body.printing-doc .laa-sig-col,
    body.printing-doc .laa-meta-item,
    body.printing-doc .laa-meta,
    body.printing-doc .laa-party {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    body.printing-doc .laa-sec,
    body.printing-doc .laa-title {
        page-break-after: avoid;
        break-after: avoid;
    }
    body.printing-doc .laa-table th {
        background: #0f2862 !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}