/*================================================================================
 * @file: assets/css/01-base.css
 * @description: الأساسيات — Design Tokens + Atoms + Layout Primitives
 * @version: 16.1 "الإمبراطوري الموحّد"
 * @date: 2026-10-09
 *
 * ⚠️ مهم: هذا الملف يُحمّل AFTER 00-theme.css
 * 🎯 الألوان موجودة في 00-theme.css
 *================================================================================*/

/* ══════════════════════════════════════════════════════════════════════════════
   PART 1: DESIGN TOKENS (Fallbacks + Non-Color Tokens)
   ══════════════════════════════════════════════════════════════════════════════ */

   :root {
    /* ═══ الألوان — Fallbacks (لو لم يُحمّل 00-theme.css) ═══ */
    --primary: #1e3c72;
    --primary-light: #2a5298;
    --primary-dark: #152a52;
    --accent: #00c9b7;
    --accent-light: #33d4c4;
    --accent-dark: #009e90;

    --success: #28a745;
    --success-light: rgba(40, 167, 69, 0.12);
    --warning: #fd7e14;
    --warning-light: rgba(253, 126, 20, 0.12);
    --danger: #dc3545;
    --danger-light: rgba(220, 53, 69, 0.12);
    --info: #17a2b8;
    --info-light: rgba(23, 162, 184, 0.12);

    --bg-body: #f5f7fa;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-subtle: #f0f4f8;
    --bg-hover: #e8f0f5;
    --bg-input: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.5);

    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-inverse: #ffffff;
    --text-link: var(--primary);

    --border: #e2e8f0;
    --border-strong: #cbd5e0;
    --border-light: #f1f5f9;
    --border-focus: var(--accent);

    /* ═══ الظلال (لا تُعدّل من الثيم) ═══ */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15);

    /* ═══ الحواف ═══ */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* ═══ المسافات ═══ */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;

    /* متغيرات متوافقة (Legacy) */
    --space-1: var(--sp-1);
    --space-2: var(--sp-2);
    --space-3: var(--sp-3);
    --space-4: var(--sp-4);
    --space-5: var(--sp-5);
    --space-6: var(--sp-6);
    --space-8: var(--sp-8);
    --space-10: var(--sp-10);

    /* ═══ الانتقالات ═══ */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* ═══ الخطوط ═══ */
    --font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Courier New', Consolas, monospace;

    --font-xs: 0.75rem;
    --font-sm: 0.875rem;
    --font-base: 1rem;
    --font-lg: 1.125rem;
    --font-xl: 1.25rem;
    --font-2xl: 1.5rem;
    --font-3xl: 1.875rem;

    /* ═══ Z-Index ═══ */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-toast: 1080;
}

/* ═══ Dark Mode Fallbacks ═══ */
[data-theme="dark"] {
    --primary: #4a90e2;
    --primary-light: #6ba8f0;
    --primary-dark: #2d6cb5;
    --accent: #00e5d0;
    --accent-light: #33ebd9;
    --accent-dark: #00b8a6;

    --success: #34d058;
    --success-light: rgba(52, 208, 88, 0.15);
    --warning: #ff9500;
    --warning-light: rgba(255, 149, 0, 0.15);
    --danger: #ff4757;
    --danger-light: rgba(255, 71, 87, 0.15);
    --info: #17c0eb;
    --info-light: rgba(23, 192, 235, 0.15);

    --bg-body: #0f1419;
    --bg-surface: #1a2028;
    --bg-elevated: #232a35;
    --bg-subtle: #161b22;
    --bg-hover: #2a3340;
    --bg-input: #1a2028;
    --bg-overlay: rgba(0, 0, 0, 0.75);

    --text-primary: #e8eaed;
    --text-secondary: #b0b8c1;
    --text-muted: #7a8491;
    --text-inverse: #0f1419;
    --text-link: var(--accent);

    --border: #2d3748;
    --border-strong: #4a5568;
    --border-light: #1a2028;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.6);
}

/* ══════════════════════════════════════════════════════════════════════════════
   PART 2: RESET + TYPOGRAPHY
   ══════════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-base);
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-body);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    transition: background var(--transition-base), color var(--transition-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--accent); }

::selection { background: var(--accent); color: var(--text-inverse); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-subtle); }
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 3: LAYOUT PRIMITIVES
   ══════════════════════════════════════════════════════════════════════════════ */

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--sp-5);
}

.container-fluid { width: 100%; padding: 0 var(--sp-5); }

.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }

.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 4: BUTTONS
   ══════════════════════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-5);
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: var(--font-sm);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
    user-select: none;
}

.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn i { font-size: 0.95em; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--text-inverse);
}
.btn-accent:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 201, 183, 0.3);
}

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #1e7e34; transform: translateY(-1px); }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover:not(:disabled) { background: #e8590c; transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #bd2130; transform: translateY(-1px); }

.btn-info { background: var(--info); color: white; }
.btn-info:hover:not(:disabled) { background: #117a8b; transform: translateY(-1px); }

.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover:not(:disabled) { background: #4e555b; transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.btn-outline:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: var(--font-xs); }
.btn-lg { padding: var(--sp-4) var(--sp-6); font-size: var(--font-lg); }
.btn-block { width: 100%; }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}
.btn-icon:hover { background: var(--bg-subtle); color: var(--primary); }
.btn-icon.btn-icon-danger:hover { background: var(--danger-light); color: var(--danger); }
.btn-icon.btn-icon-success:hover { background: var(--success-light); color: var(--success); }
.btn-icon.btn-icon-warning:hover { background: var(--warning-light); color: var(--warning); }
.btn-icon.btn-icon-info:hover { background: var(--info-light); color: var(--info); }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 5: BADGES
   ══════════════════════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 3px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}
.badge-accent { background: var(--accent); color: var(--text-inverse); }
.badge-secondary {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.badge-lg { padding: 6px 14px; font-size: 0.82rem; }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 6: ALERTS
   ══════════════════════════════════════════════════════════════════════════════ */

.alert {
    padding: var(--sp-4) var(--sp-5);
    border-radius: var(--radius-md);
    border-right: 4px solid;
    margin-bottom: var(--sp-4);
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    font-size: var(--font-sm);
}
.alert i { font-size: 1.1em; margin-top: 2px; flex-shrink: 0; }

.alert-success { background: var(--success-light); border-color: var(--success); color: var(--success); }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);  color: var(--danger); }
.alert-info    { background: var(--info-light);    border-color: var(--info);    color: var(--info); }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 7: FORMS
   ══════════════════════════════════════════════════════════════════════════════ */

.form-group { margin-bottom: var(--sp-5); }

.form-label {
    display: block;
    margin-bottom: var(--sp-2);
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-secondary);
}
.form-label .required { color: var(--danger); margin-right: 4px; }

.form-control {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    font-family: inherit;
    font-size: var(--font-base);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 201, 183, 0.12);
}

.form-control::placeholder { color: var(--text-muted); opacity: 0.7; }

.form-control:disabled, .form-control[readonly] {
    background: var(--bg-subtle);
    cursor: not-allowed;
    opacity: 0.7;
}

textarea.form-control { min-height: 120px; resize: vertical; }

select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234a5568' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 14px;
    padding-left: 40px;
}

.form-hint { font-size: var(--font-xs); color: var(--text-muted); margin-top: var(--sp-1); }
.form-error { font-size: var(--font-xs); color: var(--danger); margin-top: var(--sp-1); }

.form-check {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    cursor: pointer;
    user-select: none;
}
.form-check input[type="checkbox"], .form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════════════════════
   PART 8: TABLES
   ══════════════════════════════════════════════════════════════════════════════ */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-sm);
}

.table thead {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
}

.table th {
    padding: var(--sp-4) var(--sp-5);
    text-align: right;
    font-weight: 700;
    font-size: var(--font-sm);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.table td {
    padding: var(--sp-3) var(--sp-5);
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }

.table-striped tbody tr:nth-child(even) { background: var(--bg-subtle); }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 9: CARDS
   ══════════════════════════════════════════════════════════════════════════════ */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.card-title {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}
.card-title i { color: var(--accent); }

.card-body { padding: var(--sp-6); }
.card-footer {
    padding: var(--sp-4) var(--sp-6);
    background: var(--bg-subtle);
    border-top: 1px solid var(--border);
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
    transition: all var(--transition-fast);
}
.card-link:hover { gap: 10px; color: var(--accent-dark); }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 10: MODALS
   ══════════════════════════════════════════════════════════════════════════════ */

.modal-overlay,
.modal {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--sp-5);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active,
.modal.active,
.modal-overlay.show {
    display: flex;
}

.modal-box,
.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal-lg { max-width: 780px; }
.modal-xl { max-width: 1000px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--border);
    background: var(--bg-subtle);
    position: sticky;
    top: 0;
    z-index: 10;
}
.modal-header h3 {
    margin: 0;
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.modal-close:hover { background: var(--danger); color: #fff; }

.modal-body { padding: var(--sp-6); }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
    position: sticky;
    bottom: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   PART 11: TOASTS
   ══════════════════════════════════════════════════════════════════════════════ */

.toast-container,
.up-toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    pointer-events: none;
}

.toast,
.up-toast {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    border-right: 4px solid var(--info);
    max-width: 340px;
    pointer-events: auto;
}

.toast.show,
.toast.toast-show,
.up-toast.show { opacity: 1; transform: translateY(0); }

.toast-success, .up-toast-success { border-color: var(--success); }
.toast-success i, .up-toast-success i { color: var(--success); }
.toast-danger, .up-toast-danger { border-color: var(--danger); }
.toast-danger i, .up-toast-danger i { color: var(--danger); }
.toast-warning, .up-toast-warning { border-color: var(--warning); }
.toast-warning i, .up-toast-warning i { color: var(--warning); }
.toast-info, .up-toast-info { border-color: var(--info); }
.toast-info i, .up-toast-info i { color: var(--info); }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 12: TABS
   ══════════════════════════════════════════════════════════════════════════════ */

.tabs,
.up-tabs {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-5);
    overflow-x: auto;
}

.tab,
.up-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab:hover,
.up-tab:hover { background: var(--bg-subtle); color: var(--text-primary); }

.tab.active,
.up-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    box-shadow: 0 2px 8px rgba(30, 60, 114, 0.2);
}

.tab.active i,
.up-tab.active i { color: #fff; }

.tab-content,
.up-tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active,
.up-tab-content.active { display: block; }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 13: STAT CARDS
   ══════════════════════════════════════════════════════════════════════════════ */

.stats-grid,
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-5);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon-primary   { background: linear-gradient(135deg, #1e3c72, #2a5298); }
.stat-icon-success   { background: linear-gradient(135deg, #20c997, #28a745); }
.stat-icon-warning   { background: linear-gradient(135deg, #ff9500, #fd7e14); }
.stat-icon-danger    { background: linear-gradient(135deg, #dc3545, #b02a37); }
.stat-icon-info      { background: linear-gradient(135deg, #17a2b8, #117a8b); }
.stat-icon-accent    { background: linear-gradient(135deg, #00c9b7, #009e90); }
.stat-icon-purple    { background: linear-gradient(135deg, #6f42c1, #a78bfa); }
.stat-icon-pink      { background: linear-gradient(135deg, #e83e8c, #ff6ec7); }
.stat-icon-secondary { background: linear-gradient(135deg, #6c757d, #495057); }
.stat-icon-blue      { background: linear-gradient(135deg, #1e3c72, #2a5298); }
.stat-icon-cyan      { background: linear-gradient(135deg, #00c9b7, #009e90); }
.stat-icon-green     { background: linear-gradient(135deg, #20c997, #28a745); }
.stat-icon-orange    { background: linear-gradient(135deg, #ff9500, #fd7e14); }

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.stat-sub { font-size: 0.75rem; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 14: ANIMATIONS
   ══════════════════════════════════════════════════════════════════════════════ */

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.animate-fade { animation: fadeIn var(--transition-base); }
.animate-slide { animation: slideUp var(--transition-base); }
.animate-spin { animation: spin 1s linear infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 15: UTILITIES
   ══════════════════════════════════════════════════════════════════════════════ */

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.text-primary   { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }
.text-warning   { color: var(--warning); }
.text-info      { color: var(--info); }
.text-accent    { color: var(--accent); }

.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }

.text-xs { font-size: var(--font-xs); }
.text-sm { font-size: var(--font-sm); }
.text-lg { font-size: var(--font-lg); }
.text-xl { font-size: var(--font-xl); }

.text-mono {
    font-family: var(--font-mono);
    direction: ltr;
    display: inline-block;
}

.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); }

.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-6 { margin-bottom: var(--sp-6); }

.p-0 { padding: 0; } .p-2 { padding: var(--sp-2); }
.p-4 { padding: var(--sp-4); } .p-6 { padding: var(--sp-6); }

.hidden  { display: none !important; }
.visible { display: block !important; }
.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded    { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.cursor-pointer { cursor: pointer; }
.select-none    { user-select: none; }

/* ══════════════════════════════════════════════════════════════════════════════
   PART 16: RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    :root {
        --font-base: 0.95rem;
        --sp-5: 16px;
        --sp-6: 20px;
        --sp-8: 24px;
    }

    .container { padding: 0 var(--sp-4); }
    .card-header { padding: var(--sp-4); }
    .card-body   { padding: var(--sp-4); }
    .card-footer { padding: var(--sp-3) var(--sp-4); }

    .table th, .table td { padding: var(--sp-2) var(--sp-3); font-size: var(--font-xs); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .btn { padding: var(--sp-3) var(--sp-4); }

    .stats-grid,
    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: var(--sp-3);
    }
    .stat-card { padding: var(--sp-4); gap: var(--sp-3); }
    .stat-icon { width: 44px; height: 44px; font-size: 1.15rem; }
    .stat-value { font-size: 1.4rem; }
}

@media (max-width: 480px) {
    .card-title { font-size: var(--font-base); }
    .modal-box, .modal-content { max-width: 100%; }
}

/*================================================================================
 * نهاية assets/css/01-base.css — v16.1
 *================================================================================*/

/* Theme compatibility overrides: dark-mode neutral colors found across page styles. */
@media screen {
  html[data-theme="dark"] :is(.nav-icon-btn.active-imp) { color: var(--warning) !important; }
  html[data-theme="dark"] :is(.imp-bar-btn:hover) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.imp-active-badge) { color: var(--warning) !important; }
  html[data-theme="dark"] :is(.imp-alert-time) { color: var(--text-muted) !important; }
  html[data-theme="dark"] :is(.imp-type-content i) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.toggle-track::after) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.app-navbar .nav-menu) { background: transparent !important; border: none !important; }
  html[data-theme="dark"] :is(.app-navbar .nav-dropdown) { background: var(--bg-surface) !important; border: 1px solid var(--border) !important; border-radius: 12px !important; }
  html[data-theme="dark"] :is(.students-stats-bar .stat-icon-primary) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.sv-back-btn:hover) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.sv-action-btn:hover) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.sv-stat-primary .sv-stat-icon) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.sv-att-secondary) { color: var(--text-secondary) !important; }
  html[data-theme="dark"] :is(.staff-stats-bar .stat-icon-primary) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.subjects-stats-bar .stat-icon-primary) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.prep-toggle-track) { background: var(--border) !important; }
  html[data-theme="dark"] :is(.prep-toggle-track::after) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.week-nav-header) { background: linear-gradient(135deg,
        color-mix(in srgb, var(--page-color) 8%, var(--bg-surface)),
        var(--bg-surface)) !important; }
  html[data-theme="dark"] :is(.week-today-btn) { color: var(--warning) !important; }
  html[data-theme="dark"] :is(.prep-week-nav .week-day-btn.active) { background: linear-gradient(135deg,
        color-mix(in srgb, var(--page-color) 15%, var(--bg-surface)),
        color-mix(in srgb, var(--page-color) 5%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.prep-level-tab.active) { background: linear-gradient(135deg,
        color-mix(in srgb, var(--page-color) 15%, var(--bg-surface)),
        color-mix(in srgb, var(--page-color) 5%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.prep-table .status-btn-excused:hover:not(.active)) { color: var(--warning) !important; }
  html[data-theme="dark"] :is(.prep-table .status-btn-excused.active) { color: var(--warning) !important; }
  html[data-theme="dark"] :is(.excuse-student-info) { background: linear-gradient(135deg,
        color-mix(in srgb, #6f42c1 10%, var(--bg-surface)),
        var(--bg-surface)) !important; }
  html[data-theme="dark"] :is(.reason-option input:checked + .reason-inner) { background: linear-gradient(135deg,
        color-mix(in srgb, #6f42c1 12%, var(--bg-surface)),
        color-mix(in srgb, #6f42c1 4%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.ta-day-badge.status-work) { color: var(--success) !important; }
  html[data-theme="dark"] :is(.ta-day-badge.status-remote) { color: var(--warning) !important; }
  html[data-theme="dark"] :is(.ta-day-badge.status-holiday) { background: color-mix(in srgb, var(--danger) 15%, var(--bg-surface)) !important; color: var(--danger) !important; }
  html[data-theme="dark"] :is(.ta-day-badge.status-weekend) { background: var(--bg-subtle) !important; color: var(--text-secondary) !important; border-color: var(--border) !important; }
  html[data-theme="dark"] :is(.ta-lock-track) { background: var(--border) !important; }
  html[data-theme="dark"] :is(.ta-lock-track::after) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.ta-policy-open) { color: var(--success) !important; }
  html[data-theme="dark"] :is(.ta-policy-locked) { background: color-mix(in srgb, var(--danger) 13%, var(--bg-surface)) !important; color: var(--danger) !important; }
  html[data-theme="dark"] :is(.ta-slot-now) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.ta-suggestion-btn) { border: 1px solid var(--border) !important; background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.ta-suggestion-btn:hover:not(:disabled)) { border-color: var(--border) !important; }
  html[data-theme="dark"] :is(.ta-suggestion-high) { color: var(--success) !important; }
  html[data-theme="dark"] :is(.ta-suggestion-medium) { color: var(--warning) !important; }
  html[data-theme="dark"] :is(.ta-suggestion-low,
.ta-suggestion-none) { background: var(--bg-subtle) !important; color: var(--text-secondary) !important; }
  html[data-theme="dark"] :is(.ta-source-hint) { color: var(--text-muted) !important; }
  html[data-theme="dark"] :is(.ta-status-btn) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.week-badge-num) { background: linear-gradient(135deg, var(--page-color, #17a2b8), color-mix(in srgb, var(--page-color, #17a2b8) 70%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.assign-stats-bar .stat-icon-primary) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.assign-bulk-bar span) { color: var(--warning) !important; }
  html[data-theme="dark"] :is(.level-item:hover) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.class-item:hover) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.teacher-item:hover) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.subject-item:hover) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.quick-setup) { background: linear-gradient(135deg, var(--bg-subtle) 0%, var(--bg-hover) 100%) !important; }
  html[data-theme="dark"] :is(.quick-setup-header h3) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.quick-item label) { color: var(--text-primary) !important; }
  html[data-theme="dark"] :is(.quick-item label i) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.quick-item select) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.quick-status) { background: color-mix(in srgb, var(--warning) 16%, var(--bg-surface)) !important; color: var(--warning) !important; }
  html[data-theme="dark"] :is(.quick-status.ready) { background: color-mix(in srgb, var(--success) 16%, var(--bg-surface)) !important; color: var(--success) !important; }
  html[data-theme="dark"] :is(.quick-classes-header h3) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.quick-classes-hint) { background: linear-gradient(90deg, color-mix(in srgb, var(--warning) 14%, var(--bg-surface)) 0%, color-mix(in srgb, var(--warning) 12%, var(--bg-surface)) 100%) !important; color: var(--warning) !important; }
  html[data-theme="dark"] :is(.quick-class-item) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.quick-class-item:hover) { background: var(--bg-subtle) !important; }
  html[data-theme="dark"] :is(.quick-class-item.selected) { background: linear-gradient(135deg, var(--bg-hover), #d7e3f0) !important; }
  html[data-theme="dark"] :is(.quick-class-item.assigned) { background: linear-gradient(135deg, color-mix(in srgb, var(--success) 16%, var(--bg-surface)), color-mix(in srgb, var(--success) 20%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.quick-class-item.selected .quick-class-checkbox) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.quick-class-info strong) { color: var(--text-primary) !important; }
  html[data-theme="dark"] :is(.quick-empty h3) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.warning-item strong) { color: var(--warning) !important; }
  html[data-theme="dark"] :is(.periods-levels-tabs .level-tab.active) { background: linear-gradient(135deg,
        color-mix(in srgb, var(--level-color) 12%, var(--bg-surface)),
        color-mix(in srgb, var(--level-color) 4%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.season-tab.active) { background: linear-gradient(135deg,
        color-mix(in srgb, var(--season-color) 15%, var(--bg-surface)),
        color-mix(in srgb, var(--season-color) 5%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.timeline-block-name) { color: var(--block-color, var(--primary)) !important; }
  html[data-theme="dark"] :is(.type-option input:checked + .type-option-inner) { background: linear-gradient(135deg,
        color-mix(in srgb, var(--page-color) 12%, var(--bg-surface)),
        color-mix(in srgb, var(--page-color) 4%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(#btnToggleBreak.active) { background: linear-gradient(135deg, var(--page-color, #6f42c1),
                                       color-mix(in srgb, var(--page-color, #6f42c1) 70%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.up-schedule-day-col) { background: color-mix(in srgb, var(--page-color, #1e3c72) 80%, #000) !important; }
  html[data-theme="dark"] :is(.up-schedule-col-break) { background: color-mix(in srgb, var(--page-color, #1e3c72) 60%, #6c757d) !important; }
  html[data-theme="dark"] :is(.up-schedule-day-cell) { background: var(--bg-subtle) !important; border-right: 3px solid var(--page-color, #1e3c72) !important; }
  html[data-theme="dark"] :is(.up-schedule-break-cell) { background: linear-gradient(135deg, rgba(108, 117, 125, 0.08), rgba(108, 117, 125, 0.03)) !important; }
  html[data-theme="dark"] :is(.up-schedule-slot strong) { color: var(--page-color, var(--primary)) !important; }
  html[data-theme="dark"] :is(.school-type-card.active .school-type-card-inner i,
.school-type-card.active .school-type-card-inner span) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-sidebar) { background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-subtle) 100%) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-sidebar::before) { color: var(--text-secondary) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-nav-item) { color: var(--text-secondary) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-nav-item > i) { color: var(--text-muted) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-nav-desc) { color: var(--text-muted) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-nav-item:hover .settings-nav-desc,
.settings-hub .settings-nav-item.active .settings-nav-desc) { color: color-mix(in srgb, var(--tab-color) 70%, var(--text-secondary)) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-tab-header) { background: linear-gradient(135deg,
        color-mix(in srgb, var(--tab-color) 10%, var(--bg-surface)) 0%,
        color-mix(in srgb, var(--tab-color) 4%, var(--bg-surface)) 50%,
        var(--bg-surface) 100%) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-tab-info p) { color: var(--text-secondary) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-tab-body) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-group-title) { color: var(--text-primary) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-info) { color: color-mix(in srgb, var(--tab-color) 60%, var(--text-primary)) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-row-label-title) { color: var(--text-primary) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-row-label-hint) { color: var(--text-muted) !important; }
  html[data-theme="dark"] :is(.settings-hub .form-control) { background: var(--bg-surface) !important; color: var(--text-primary) !important; }
  html[data-theme="dark"] :is(.settings-hub .form-control:hover:not(:focus):not(:disabled)) { border-color: var(--border) !important; }
  html[data-theme="dark"] :is(.settings-hub .form-control:focus) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.settings-hub .form-control:disabled,
.settings-hub .form-control[readonly]) { background: var(--bg-subtle) !important; color: var(--text-muted) !important; }
  html[data-theme="dark"] :is(.settings-hub .toggle-track) { background: var(--border) !important; }
  html[data-theme="dark"] :is(.settings-hub .toggle-track::after) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.settings-hub .toggle-label) { color: var(--text-secondary) !important; }
  html[data-theme="dark"] :is(.settings-hub .stage-card-inner) { background: var(--bg-subtle) !important; }
  html[data-theme="dark"] :is(.settings-hub .stage-card-inner.active) { background: linear-gradient(135deg,
        color-mix(in srgb, var(--tab-color) 12%, var(--bg-surface)) 0%,
        color-mix(in srgb, var(--tab-color) 4%, var(--bg-surface)) 100%) !important; }
  html[data-theme="dark"] :is(.settings-hub .stage-name) { color: var(--text-primary) !important; }
  html[data-theme="dark"] :is(.settings-hub .track-card-content) { background: var(--bg-subtle) !important; }
  html[data-theme="dark"] :is(.settings-hub .track-card:hover .track-card-content) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.settings-hub .track-card.active .track-card-content) { background: linear-gradient(135deg,
        color-mix(in srgb, var(--tab-color) 10%, var(--bg-surface)) 0%,
        color-mix(in srgb, var(--tab-color) 3%, var(--bg-surface)) 100%) !important; }
  html[data-theme="dark"] :is(.settings-hub .track-name) { color: var(--text-primary) !important; }
  html[data-theme="dark"] :is(.settings-hub .school-type-card-inner) { background: var(--bg-subtle) !important; }
  html[data-theme="dark"] :is(.settings-hub .school-type-card.active .school-type-card-inner) { background: linear-gradient(135deg,
        color-mix(in srgb, var(--tab-color) 12%, var(--bg-surface)) 0%,
        color-mix(in srgb, var(--tab-color) 4%, var(--bg-surface)) 100%) !important; }
  html[data-theme="dark"] :is(.settings-hub .school-type-card-inner i) { color: var(--text-muted) !important; }
  html[data-theme="dark"] :is(.settings-hub .school-type-card-inner span) { color: var(--text-secondary) !important; }
  html[data-theme="dark"] :is(.settings-hub .color-picker-wrapper) { background: var(--bg-subtle) !important; }
  html[data-theme="dark"] :is(.settings-hub .color-picker-value) { color: var(--text-secondary) !important; background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.settings-hub .logo-preview-large) { background: linear-gradient(135deg, var(--bg-subtle) 0%, var(--bg-surface) 100%) !important; border: 2px dashed var(--border) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-actions) { background: linear-gradient(90deg, var(--bg-surface) 0%, var(--bg-subtle) 100%) !important; }
  html[data-theme="dark"] :is(.settings-hub .settings-actions-info) { color: var(--text-secondary) !important; }
  html[data-theme="dark"] :is(.settings-hub .btn-outline) { background: var(--bg-surface) !important; color: var(--text-secondary) !important; }
  html[data-theme="dark"] :is(.settings-hub .btn-outline:hover) { background: color-mix(in srgb, var(--tab-color) 5%, var(--bg-surface)) !important; }
  html[data-theme="dark"] :is(.settings-hub .alert-success) { background: linear-gradient(90deg, color-mix(in srgb, var(--success) 13%, var(--bg-surface)), var(--bg-surface)) !important; }
  html[data-theme="dark"] :is(.settings-hub .alert-danger) { background: linear-gradient(90deg, color-mix(in srgb, var(--danger) 13%, var(--bg-surface)), var(--bg-surface)) !important; }
  html[data-theme="dark"] :is(.settings-hub .alert-warning) { background: linear-gradient(90deg, color-mix(in srgb, var(--warning) 14%, var(--bg-surface)), var(--bg-surface)) !important; }
  html[data-theme="dark"] :is(.settings-hub .alert-info) { background: linear-gradient(90deg, color-mix(in srgb, var(--info) 14%, var(--bg-surface)), var(--bg-surface)) !important; }
  html[data-theme="dark"] :is(.logs-header .btn-outline:hover) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.promote-class-item:hover) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.promote-hint) { color: var(--warning) !important; }
  html[data-theme="dark"] :is(.promote-student-chip:hover) { background: var(--bg-surface) !important; }
  html[data-theme="dark"] :is(.promote-checkbox span) { color: var(--warning) !important; }
  html[data-theme="dark"] :is(.up-page-icon) { background: linear-gradient(135deg, var(--page-color), 
                                       color-mix(in srgb, var(--page-color) 70%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.up-stat-icon-primary) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.up-card-title i) { background: linear-gradient(135deg, var(--page-color), 
                                       color-mix(in srgb, var(--page-color) 70%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.up-tab.active) { background: linear-gradient(135deg, var(--page-color), 
                                       color-mix(in srgb, var(--page-color) 70%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.up-badge-primary) { color: var(--primary) !important; }
  html[data-theme="dark"] :is(.up-badge-secondary) { color: var(--text-secondary) !important; }
  html[data-theme="dark"] :is(.up-calendar-status.weekend) { color: var(--text-secondary) !important; }
  html[data-theme="dark"] :is(.up-conversation-avatar) { background: linear-gradient(135deg, var(--page-color), 
                                       color-mix(in srgb, var(--page-color) 60%, var(--bg-surface))) !important; }
  html[data-theme="dark"] :is(.up-report-card-icon) { background: linear-gradient(135deg, var(--page-color), 
                                       color-mix(in srgb, var(--page-color) 60%, var(--bg-surface))) !important; }
}
