/* ═══════════════════════════════════════════════════════════════════════════
   إصلاحات الوضع الداكن المشتركة (2026-11-14)
   تُحمَّل في كل صفحة تدعم الوضع الداكن، وكل القواعد مقيّدة بـ html[data-bs-theme="dark"]
   فلا تؤثر على الوضع النهاري إطلاقًا.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 1. التقويم (FullCalendar): رأس الأيام كان يأخذ خلفية بيضاء ثابتة ─── */
html[data-bs-theme="dark"] .fc {
    --dk-fc-surface: var(--tc-surface-solid, var(--st-surface-solid, var(--dv-surface, var(--eth-surface, #1E293B))));
    --dk-fc-text: var(--tc-text, var(--st-text, var(--dv-text, var(--eth-text, #F1F5F9))));
    --dk-fc-muted: var(--tc-text-2, var(--st-text-2, var(--dv-text-2, #94A3B8)));
    --fc-page-bg-color: var(--dk-fc-surface);
    --fc-neutral-bg-color: rgba(255, 255, 255, .06);
    --fc-neutral-text-color: var(--dk-fc-muted);
    --fc-border-color: rgba(255, 255, 255, .12);
    --fc-today-bg-color: rgba(140, 157, 255, .12);
    --fc-highlight-color: rgba(140, 157, 255, .18);
    --fc-non-business-color: rgba(0, 0, 0, .22);
    --fc-list-event-hover-bg-color: rgba(255, 255, 255, .06);
    --fc-button-text-color: #fff;
}
html[data-bs-theme="dark"] .fc .fc-col-header,
html[data-bs-theme="dark"] .fc .fc-col-header-cell,
html[data-bs-theme="dark"] .fc .fc-scrollgrid-section-sticky > *,
html[data-bs-theme="dark"] .fc .fc-timegrid-axis,
html[data-bs-theme="dark"] .fc .fc-popover,
html[data-bs-theme="dark"] .fc .fc-popover-header {
    background-color: var(--dk-fc-surface) !important;
}
html[data-bs-theme="dark"] .fc .fc-col-header-cell-cushion,
html[data-bs-theme="dark"] .fc .fc-daygrid-day-number,
html[data-bs-theme="dark"] .fc .fc-timegrid-slot-label-cushion,
html[data-bs-theme="dark"] .fc .fc-list-day-text,
html[data-bs-theme="dark"] .fc .fc-list-day-side-text,
html[data-bs-theme="dark"] .fc .fc-toolbar-title {
    color: var(--dk-fc-text) !important;
}
html[data-bs-theme="dark"] .fc .fc-day-other .fc-daygrid-day-number { color: var(--dk-fc-muted) !important; opacity: .7; }
html[data-bs-theme="dark"] .fc .fc-list-day-cushion,
html[data-bs-theme="dark"] .fc .fc-list-sticky .fc-list-day > * { background-color: rgba(255, 255, 255, .06) !important; }
html[data-bs-theme="dark"] .fc .fc-list-empty { background-color: transparent !important; color: var(--dk-fc-muted) !important; }
html[data-bs-theme="dark"] .fc-theme-standard td,
html[data-bs-theme="dark"] .fc-theme-standard th,
html[data-bs-theme="dark"] .fc-theme-standard .fc-scrollgrid { border-color: rgba(255, 255, 255, .12) !important; }

/* ─── 2. Bootstrap: .text-dark صار فاتحًا داخل الشارات والأزرار الفاتحة (أصفر/سماوي) ─── */
html[data-bs-theme="dark"] .bg-warning.text-dark,
html[data-bs-theme="dark"] .bg-info.text-dark,
html[data-bs-theme="dark"] .text-bg-warning,
html[data-bs-theme="dark"] .text-bg-info,
html[data-bs-theme="dark"] .bg-warning .text-dark,
html[data-bs-theme="dark"] .bg-info .text-dark,
html[data-bs-theme="dark"] .btn-warning,
html[data-bs-theme="dark"] .btn-warning.text-dark,
html[data-bs-theme="dark"] .btn-info,
html[data-bs-theme="dark"] .btn-info.text-white {
    color: #14171C !important;
}
html[data-bs-theme="dark"] .text-bg-light,
html[data-bs-theme="dark"] .badge.bg-light {
    background-color: rgba(255, 255, 255, .1) !important;
    color: var(--dv-text, var(--eth-text, #F1F5F9)) !important;
    border-color: rgba(255, 255, 255, .16) !important;
}

/* جداول ملوّنة (table-primary/success/...): الرأس كان فاتحًا بنص فاتح */
html[data-bs-theme="dark"] .table-primary,
html[data-bs-theme="dark"] .table-secondary,
html[data-bs-theme="dark"] .table-success,
html[data-bs-theme="dark"] .table-info,
html[data-bs-theme="dark"] .table-warning,
html[data-bs-theme="dark"] .table-danger,
html[data-bs-theme="dark"] .table-light {
    --bs-table-bg: rgba(255, 255, 255, .07) !important;
    --bs-table-color: var(--dv-text, var(--eth-text, #F1F5F9)) !important;
    --bs-table-border-color: rgba(255, 255, 255, .12) !important;
    --bs-table-striped-bg: rgba(255, 255, 255, .1) !important;
    --bs-table-hover-bg: rgba(255, 255, 255, .12) !important;
    color: var(--dv-text, var(--eth-text, #F1F5F9)) !important;
    border-color: rgba(255, 255, 255, .12) !important;
}

/* ─── 3. لوحة الإدارة: اللون الأساسي الفاتح (#8C9DFF) مع نص أبيض كان باهتًا ─── */
html[data-bs-theme="dark"] .admin-dashboard-page .btn-primary {
    --bs-btn-bg: #4353C8; --bs-btn-border-color: #4353C8; --bs-btn-color: #fff;
    --bs-btn-hover-bg: #5464D8; --bs-btn-hover-border-color: #5464D8; --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #3A49B5; --bs-btn-active-border-color: #3A49B5; --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: #4353C8; --bs-btn-disabled-border-color: #4353C8;
    background: #4353C8 !important; border-color: #4353C8 !important; color: #fff !important;
}
html[data-bs-theme="dark"] .admin-dashboard-page .btn-primary:hover,
html[data-bs-theme="dark"] .admin-dashboard-page .btn-primary:focus-visible { background: #5464D8 !important; border-color: #5464D8 !important; }
html[data-bs-theme="dark"] .admin-dashboard-page .btn-primary:active { background: #3A49B5 !important; border-color: #3A49B5 !important; }
html[data-bs-theme="dark"] .admin-dashboard-page .bg-primary { background-color: #4353C8 !important; }

/* بطاقات حالات طلبات المعلمين: النص الملوّن الداكن كان على خلفية داكنة */
html[data-bs-theme="dark"] #tab-applications .card[style*="gradient"] [style*="color"] {
    color: var(--dv-text, #E4E6F8) !important;
}

/* ─── 4. برنامج المعلمين (teacher-schedule.css) — لم تكن له أي ألوان داكنة ─── */
html[data-bs-theme="dark"] .ts-panel {
    --ts-ink: var(--dv-text, #E4E6F8);
    --ts-line: rgba(255, 255, 255, .12);
    color: var(--dv-text, #E4E6F8);
}
html[data-bs-theme="dark"] .ts-picker label { color: var(--dv-text, #E4E6F8); }
html[data-bs-theme="dark"] .ts-picker select,
html[data-bs-theme="dark"] .ts-block-form input,
html[data-bs-theme="dark"] .ts-week-nav a,
html[data-bs-theme="dark"] .ts-actions a,
html[data-bs-theme="dark"] .ts-day,
html[data-bs-theme="dark"] .ts-block-form {
    background: var(--dv-surface, #17183A);
    color: var(--dv-text, #E4E6F8);
    border-color: rgba(255, 255, 255, .12);
    box-shadow: none;
}
html[data-bs-theme="dark"] .ts-block-form input { color-scheme: dark; }
html[data-bs-theme="dark"] .ts-week-nav a:hover,
html[data-bs-theme="dark"] .ts-actions a:hover { background: rgba(255, 255, 255, .07); }
html[data-bs-theme="dark"] .ts-day-head time,
html[data-bs-theme="dark"] .ts-hours,
html[data-bs-theme="dark"] .ts-block-form > p { color: var(--dv-text-2, #A9ADD6); }
html[data-bs-theme="dark"] .ts-empty { background: rgba(255, 255, 255, .04); color: var(--dv-text-2, #A9ADD6); }
html[data-bs-theme="dark"] .ts-day-head > span { background: rgba(52, 211, 153, .14); color: #6EE7B7; }
html[data-bs-theme="dark"] .ts-free { background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .35); color: #86EFAC; }
html[data-bs-theme="dark"] .ts-lesson { background: rgba(96, 165, 250, .12); border-color: rgba(96, 165, 250, .35); color: #BFDBFE; }
html[data-bs-theme="dark"] .ts-block { background: rgba(251, 191, 36, .12); border-color: rgba(251, 191, 36, .35); color: #FDE68A; }
html[data-bs-theme="dark"] .ts-canceled { background: rgba(148, 163, 184, .1); border-color: rgba(148, 163, 184, .3); color: #CBD5E1; }
html[data-bs-theme="dark"] .ts-remove { color: #FCD34D; }
html[data-bs-theme="dark"] .ts-warning { color: #FCA5A5; }

/* ─── 5. صفحة رسائل واتساب (messaging.php): بطاقات بيضاء بنص فاتح ─── */
html[data-bs-theme="dark"] .wa-tabs a {
    background: var(--dv-surface, #17183A);
    border-color: rgba(255, 255, 255, .14);
    color: var(--dv-text, #E4E6F8);
}
html[data-bs-theme="dark"] .wa-tabs a.active { background: #0F766E; border-color: #0F766E; color: #fff; }
html[data-bs-theme="dark"] .wa-card { background: var(--dv-surface, #17183A); border-color: rgba(255, 255, 255, .12); color: var(--dv-text, #E4E6F8); }
html[data-bs-theme="dark"] .wa-muted,
html[data-bs-theme="dark"] .wa-bubble small { color: var(--dv-text-2, #A9ADD6); }
html[data-bs-theme="dark"] .wa-preview { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .3); }
html[data-bs-theme="dark"] .wa-in { background: rgba(255, 255, 255, .07); }
html[data-bs-theme="dark"] .wa-out { background: rgba(34, 197, 94, .16); }
html[data-bs-theme="dark"] .wa-conv:hover,
html[data-bs-theme="dark"] .wa-conv.active { background: rgba(45, 212, 191, .1); border-color: rgba(45, 212, 191, .35); }
html[data-bs-theme="dark"] code.wa-code { background: rgba(255, 255, 255, .08); color: var(--dv-text, #E4E6F8); }
