/* جداول الامتحانات + أبحاث الدراسات العليا */
.erh-page { padding: 24px 0 60px; min-height: 60vh; }
.erh-page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.erh-page-header h2 { font-size: 1.6rem; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 10px; }
.erh-back-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: 1px solid rgba(108,76,241,0.25); background: #fff; color: var(--primary, #6c4cf1); font-weight: 700; cursor: pointer; text-decoration: none; }
.erh-back-btn:hover { background: rgba(108,76,241,0.06); }

.erh-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.erh-hub-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 22px; cursor: pointer; transition: box-shadow .25s, border-color .25s; text-align: right; }
.erh-hub-card:hover { border-color: var(--primary, #6c4cf1); box-shadow: 0 12px 32px rgba(108,76,241,0.12); transform: translateY(-2px); }
.erh-hub-card-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; color: #fff; }
.erh-hub-card h3 { font-size: 1.05rem; font-weight: 800; margin: 0 0 6px; color: #0f172a; }
.erh-hub-card p { font-size: 0.85rem; color: #64748b; margin: 0; }

.erh-step-hint { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: #64748b; margin-bottom: 18px; padding: 10px 14px; background: #f8fafc; border-radius: 10px; border: 1px solid #e2e8f0; }
.erh-step-hint i { width: 16px; height: 16px; color: var(--primary, #6c4cf1); flex-shrink: 0; }
.erh-hub-card-meta { display: inline-block; margin-top: 10px; font-size: 0.78rem; font-weight: 700; color: var(--primary, #6c4cf1); background: rgba(108,76,241,0.08); padding: 3px 10px; border-radius: 999px; }

.erh-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 18px; font-size: 0.85rem; color: #64748b; }
.erh-breadcrumb-link { background: none; border: none; color: var(--primary, #6c4cf1); font-weight: 700; cursor: pointer; padding: 4px 8px; border-radius: 8px; display: inline-flex; align-items: center; gap: 4px; }
.erh-breadcrumb-link:hover { background: rgba(108,76,241,0.08); }
.erh-breadcrumb-sep { color: #cbd5e1; }

.erh-program-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.erh-program-card { display: flex; align-items: center; gap: 14px; padding: 18px; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; cursor: pointer; transition: box-shadow .2s, border-color .2s, transform .2s; text-align: right; }
.erh-program-card:hover { border-color: var(--primary, #6c4cf1); box-shadow: 0 8px 24px rgba(108,76,241,0.1); transform: translateY(-1px); }
.erh-program-card-icon { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, rgba(108,76,241,0.12), rgba(108,76,241,0.06)); display: flex; align-items: center; justify-content: center; color: var(--primary, #6c4cf1); flex-shrink: 0; }
.erh-program-card-body { flex: 1; min-width: 0; }
.erh-program-card h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 800; color: #0f172a; }
.erh-program-badge { font-size: 0.75rem; font-weight: 700; color: #64748b; background: #f1f5f9; padding: 2px 8px; border-radius: 999px; }
.erh-program-chevron { width: 18px; height: 18px; color: #94a3b8; flex-shrink: 0; }

.erh-program-detail-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 20px; margin-bottom: 24px; }
.erh-content-block { width: 100%; }
.erh-content-title { margin: 0 0 14px; font-size: 1.1rem; font-weight: 800; color: #0f172a; }
.erh-download-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.erh-section-title { font-size: 1rem; font-weight: 800; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; color: #334155; }

.erh-schedule-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid #e2e8f0; -webkit-overflow-scrolling: touch; margin-top: 8px; }
.erh-schedule-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 560px; }
.erh-schedule-table thead { background: linear-gradient(135deg, #f8fafc, #f1f5f9); }
.erh-schedule-table th { padding: 12px 14px; text-align: right; font-weight: 800; color: #334155; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
.erh-schedule-table td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; color: #475569; }
.erh-schedule-table tr:hover td { background: rgba(108,76,241,0.03); }

.erh-table-editor { margin-top: 8px; }
.erh-table-editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 0.85rem; font-weight: 700; color: #475569; }
.erh-table-row-editor { display: grid; grid-template-columns: 1fr 1.2fr 0.8fr 0.8fr 1fr auto; gap: 6px; margin-bottom: 8px; align-items: center; }
.erh-upload-row { display: flex; flex-direction: column; gap: 8px; }
.erh-subjects-admin { border-top: 1px dashed #e2e8f0; padding-top: 8px; margin-top: 8px; }

.erh-program-block { margin-bottom: 32px; }
.erh-program-title { font-size: 1.15rem; font-weight: 800; color: #1e293b; padding: 12px 18px; background: linear-gradient(135deg, #f8fafc, #f1f5f9); border-radius: 12px; border-right: 4px solid var(--primary, #6c4cf1); margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.erh-subject-list { display: flex; flex-direction: column; gap: 12px; }
.erh-subject-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.erh-subject-card h4 { margin: 0; font-size: 1rem; font-weight: 700; color: #0f172a; flex: 1; min-width: 180px; }
.erh-subject-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.erh-btn-sm { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; font-size: 0.82rem; font-weight: 700; border: none; cursor: pointer; text-decoration: none; }
.erh-btn-primary { background: var(--primary, #6c4cf1); color: #fff; }
.erh-btn-outline { background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }
.erh-text-preview { background: #f8fafc; border-radius: 12px; padding: 16px; margin-top: 12px; font-size: 0.9rem; line-height: 1.7; color: #334155; white-space: pre-wrap; border: 1px solid #e2e8f0; }

.erh-research-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.erh-research-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 22px; transition: box-shadow .25s; }
.erh-research-card:hover { box-shadow: 0 10px 28px rgba(15,23,42,0.08); }
.erh-research-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; margin-bottom: 10px; }
.erh-badge-published { background: #dcfce7; color: #166534; }
.erh-badge-proposal { background: #dbeafe; color: #1d4ed8; }
.erh-research-card h3 { font-size: 1.05rem; font-weight: 800; margin: 0 0 14px; line-height: 1.5; color: #0f172a; }
.erh-meta-row { display: flex; align-items: flex-start; gap: 8px; font-size: 0.85rem; color: #475569; margin-bottom: 8px; }
.erh-meta-row i { width: 16px; height: 16px; margin-top: 2px; color: var(--primary, #6c4cf1); flex-shrink: 0; }

.erh-admin-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.erh-admin-tab { padding: 10px 18px; border-radius: 10px; border: 1px solid #e2e8f0; background: #fff; font-weight: 700; cursor: pointer; font-size: 0.9rem; }
.erh-admin-tab.active { background: var(--primary, #6c4cf1); color: #fff; border-color: var(--primary, #6c4cf1); }
.erh-nested-box { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.erh-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.erh-publish-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}
.erh-publish-btn i { width: 15px; height: 15px; }
.erh-publish-btn--on {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}
.erh-publish-btn--on:hover { background: #bbf7d0; }
.erh-publish-btn--off {
    background: #f1f5f9;
    color: #64748b;
    border-color: #cbd5e1;
}
.erh-publish-btn--off:hover { background: #e2e8f0; color: #475569; }
.erh-publish-field { margin-top: 12px; padding: 12px 14px; background: #f8fafc; border-radius: 12px; border: 1px solid #e2e8f0; }
.badge-warning { background: #fef3c7; color: #92400e; padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }

/* أيقونات الهيرو — جداول الامتحانات + الأبحاث */
.erh-hero-hub-btn {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(108, 76, 241, 0.22) !important;
    background: linear-gradient(145deg, rgba(255,255,255,0.98), rgba(248,250,252,0.95)) !important;
    box-shadow: 0 4px 18px rgba(108, 76, 241, 0.1);
    transition: transform .2s, box-shadow .25s, border-color .25s;
}
.erh-hero-hub-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(108, 76, 241, 0.16);
    border-color: rgba(108, 76, 241, 0.4) !important;
}
.erh-hero-hub-btn__ring {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 30% 20%, rgba(37, 99, 235, 0.08), transparent 55%);
    pointer-events: none;
}
.erh-hero-hub-btn__ring--research {
    background: radial-gradient(circle at 30% 20%, rgba(124, 58, 237, 0.1), transparent 55%);
}
.erh-hero-hub-btn__ring--exam {
    background: radial-gradient(circle at 25% 15%, rgba(37, 99, 235, 0.16), transparent 58%);
}
.erh-hero-hub-btn__icon { width: 18px; height: 18px; flex-shrink: 0; }
.erh-hero-research-btn .erh-hero-hub-btn__icon { color: #7c3aed !important; }
.erh-hero-exam-btn .erh-hero-hub-btn__icon { color: #2563eb !important; }

/* أيقونة الامتحانات النهائية — تصميم مميز */
.erh-hero-finals-btn {
    background: linear-gradient(145deg, #eff6ff 0%, #dbeafe 45%, #f0f9ff 100%) !important;
    border: 1px solid rgba(37, 99, 235, 0.32) !important;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.14), inset 0 1px 0 rgba(255,255,255,0.9) !important;
}
.erh-hero-finals-btn:hover {
    border-color: rgba(37, 99, 235, 0.55) !important;
    box-shadow: 0 10px 32px rgba(37, 99, 235, 0.22), inset 0 1px 0 rgba(255,255,255,0.95) !important;
}
.erh-hero-finals-btn__glow {
    position: absolute;
    top: -40%;
    left: -20%;
    width: 60%;
    height: 120%;
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.18), transparent 70%);
    pointer-events: none;
    animation: erh-finals-glow 4s ease-in-out infinite;
}
.erh-hero-finals-btn__icon {
    color: #1d4ed8 !important;
    filter: drop-shadow(0 1px 2px rgba(37, 99, 235, 0.25));
}
@keyframes erh-finals-glow {
    0%, 100% { opacity: 0.6; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(8px); }
}

/* معاينة النشر — الإدارة */
.erh-preview-publish-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}
.erh-preview-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
}
.erh-preview-status--warn { background: #fef3c7; color: #92400e; }
.erh-preview-status--ok { background: #dcfce7; color: #166534; }
.erh-preview-modal-content { max-width: 720px; max-height: 90vh; display: flex; flex-direction: column; }
.erh-preview-modal-body { overflow-y: auto; flex: 1; padding: 16px 0; }
.erh-preview-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}
.erh-preview-confirm-btn { background: linear-gradient(135deg, #2563eb, #1d4ed8) !important; }
.erh-preview-wrap { padding: 4px 0; }
.erh-preview-hero-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
    margin: 0 0 10px;
}
.erh-preview-hero-mock {
    display: flex;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(180deg, #f8fafc, #fff);
    border-radius: 14px;
    border: 1px dashed #cbd5e1;
}
.erh-preview-hero-btn { cursor: default !important; pointer-events: none; }
.erh-preview-public-mock { padding: 20px; border-radius: 14px; margin-top: 8px; }
.erh-preview-hub-title { margin: 0 0 6px; font-size: 1.15rem; font-weight: 800; color: #0f172a; }
.erh-preview-college { margin: 0 0 16px; font-size: 0.88rem; color: #64748b; }
.erh-preview-program-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.erh-preview-program-grid .erh-program-card { cursor: default; pointer-events: none; }
.erh-preview-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0 0;
    font-size: 0.85rem;
    color: #64748b;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.erh-pdf-embed {
    display: block;
    width: 100%;
    min-height: 70vh;
    max-height: 85vh;
    margin-top: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.erh-page-subtitle { margin: 4px 0 0; font-size: 0.82rem; color: #64748b; font-weight: 500; }
.erh-research-page-header { margin-bottom: 12px; }
.erh-research-public-body {
    padding: 14px 16px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
}

.erh-research-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}
.erh-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.erh-filter-chip:hover { border-color: #c4b5fd; color: #6c4cf1; }
.erh-filter-chip.active {
    background: linear-gradient(135deg, #5b21b6, #7c3aed);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(91, 33, 182, 0.22);
}
.erh-filter-count {
    background: rgba(255,255,255,0.22);
    padding: 0 6px;
    border-radius: 999px;
    font-size: 0.68rem;
    line-height: 1.4;
}
.erh-filter-chip:not(.active) .erh-filter-count { background: #f1f5f9; color: #64748b; }

.erh-research-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    -webkit-overflow-scrolling: touch;
}
.erh-research-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-family: 'Cairo', 'Tajawal', system-ui, sans-serif;
    font-size: 0.72rem;
    line-height: 1.35;
    min-width: 860px;
}
.erh-col-idx { width: 2.2rem; }
.erh-col-title { width: 34%; }
.erh-col-name { width: 11%; }
.erh-col-type { width: 6.5rem; }
.erh-col-date { width: 7.5rem; }
.erh-col-prog { width: 12%; }
.erh-col-link { width: 2.8rem; }

.erh-research-table thead {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    position: sticky;
    top: 0;
    z-index: 2;
}
.erh-research-table th {
    padding: 7px 8px;
    text-align: right;
    font-weight: 800;
    font-size: 0.68rem;
    letter-spacing: 0.01em;
    color: #475569;
    border-bottom: 1px solid #cbd5e1;
    white-space: nowrap;
}
.erh-research-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: top;
    font-size: 0.72rem;
}
.erh-research-table tbody tr:nth-child(even) td { background: #fafbfc; }
.erh-research-row:hover td { background: rgba(108, 76, 241, 0.04) !important; }
.erh-research-row:last-child td { border-bottom: none; }

.erh-th-num, .erh-td-num {
    text-align: center;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.68rem;
}
.erh-td-title { font-weight: 600; color: #0f172a; }
.erh-title-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    word-break: break-word;
}
.erh-td-name, .erh-td-prog {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #475569;
}
.erh-td-date {
    font-size: 0.68rem;
    color: #64748b;
    white-space: nowrap;
}
.erh-td-type { white-space: nowrap; }
.erh-td-link { text-align: center; padding-left: 4px; padding-right: 4px; }
.erh-cell-muted { color: #cbd5e1; font-size: 0.75rem; }

.erh-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.3;
}
.erh-type-pill i { width: 11px; height: 11px; flex-shrink: 0; }
.erh-type-pub { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.erh-type-prop { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.erh-table-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: rgba(108, 76, 241, 0.08);
    color: #6c4cf1;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.erh-table-link i { width: 13px; height: 13px; }
.erh-table-link:hover { background: #6c4cf1; color: #fff; }

.erh-research-empty {
    text-align: center;
    padding: 32px 16px;
    color: #94a3b8;
    font-size: 0.82rem;
}
.erh-research-empty i { width: 32px; height: 32px; margin-bottom: 8px; opacity: 0.45; }

@media (max-width: 768px) {
    .erh-page-header h2 { font-size: 1.25rem; }
    .erh-hub-grid, .erh-research-grid, .erh-program-grid { grid-template-columns: 1fr; }
    .erh-program-card { padding: 14px; }
    .erh-table-row-editor { grid-template-columns: 1fr 1fr; }
    .erh-table-row-editor .btn-text { grid-column: span 2; justify-self: end; }
    .erh-schedule-table { min-width: 0; }
    .erh-schedule-table thead { display: none; }
    .erh-schedule-table tbody tr { display: block; margin-bottom: 12px; border: 1px solid #e2e8f0; border-radius: 10px; padding: 4px 0; background: #fff; }
    .erh-schedule-table tbody td { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border: none; border-bottom: 1px solid #f8fafc; }
    .erh-schedule-table tbody td:last-child { border-bottom: none; }
    .erh-schedule-table tbody td::before { content: attr(data-label); font-weight: 800; color: #64748b; font-size: 0.76rem; flex-shrink: 0; }
    .erh-breadcrumb { font-size: 0.78rem; }
    .erh-research-public-body { padding: 10px 10px 14px; }
    .erh-research-table { min-width: 0; table-layout: auto; }
    .erh-research-table thead { display: none; }
    .erh-research-table tr.erh-research-row {
        display: block;
        margin-bottom: 8px;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 0;
        background: #fff;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    }
    .erh-research-table tr.erh-research-row td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        padding: 6px 10px;
        border: none;
        border-bottom: 1px solid #f8fafc;
        font-size: 0.72rem;
    }
    .erh-research-table tr.erh-research-row td:last-child { border-bottom: none; }
    .erh-research-table tr.erh-research-row td::before {
        content: attr(data-label);
        font-weight: 800;
        color: #64748b;
        font-size: 0.66rem;
        flex-shrink: 0;
    }
    .erh-td-title { max-width: none; text-align: left; }
    .erh-title-text { -webkit-line-clamp: unset; display: block; }
    .erh-td-name, .erh-td-prog { white-space: normal; }
}
