/* ==========================================================================
   THEME.CSS - ط§ظ„ط£ظ†ظ…ط§ط· ط§ظ„ط£ط³ط§ط³ظٹط© ط§ظ„ط¹ط§ظ„ظ…ظٹط© (Core Styles)
   ط§ظ„ظ‚ط§ط¹ط¯ط© 28: ظٹط­طھظˆظٹ ظپظ‚ط· ط¹ظ„ظ‰: tokens, reset, typography, grid, core components, layout, utilities
   ========================================================================== */

/* =========================================
   ط§ظ„ط®ط·ظˆط· ط§ظ„ظ…ط­ظ„ظٹط© (Local Fonts)
   ========================================= */
@font-face {
  font-family: 'KFGQPC Uthmanic Script';
  src: url('../fonts/uthman_v2-0.ttf') format('opentype'),
       url('../fonts/uthman_v2-0.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Amiri';
  src: url('../fonts/Amiri-Regular.ttf') format('opentype'),
       url('../fonts/Amiri-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Cairo';
  src: url('../fonts/Cairo-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cairo';
  src: url('../fonts/Cairo-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Fustat';
  src: url('../fonts/Fustat-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fustat';
  src: url('../fonts/Fustat-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Hacen';
  src: url('../fonts/HacenLinerScreen.eot');
  src: url('../fonts/HacenLinerScreen.eot?#iefix') format('embedded-opentype'),
       url('../fonts/HacenLinerScreen.woff2') format('woff2'),
       url('../fonts/HacenLinerScreen.woff') format('woff'),
       url('../fonts/HacenLinerScreen.ttf') format('truetype'),
       url('../fonts/HacenLinerScreen.svg#Hacen') format('svg');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Samra';
  src: url('../fonts/Hacen_Samra_Lt.eot');
  src: url('../fonts/Hacen_Samra_Lt.eot?#iefix') format('embedded-opentype'),
       url('../fonts/Hacen_Samra_Lt.woff') format('woff'),
       url('../fonts/Hacen_Samra_Lt.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Kufam';
  src: url('../fonts/Kufam-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Kufam';
  src: url('../fonts/Kufam-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Markazi Text';
  src: url('../fonts/MarkaziText-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Markazi Text';
  src: url('../fonts/MarkaziText-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Noto Naskh Arabic';
  src: url('../fonts/NotoNaskhArabic-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Naskh Arabic';
  src: url('../fonts/NotoNaskhArabic-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Readex Pro';
  src: url('../fonts/ReadexPro-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Readex Pro';
  src: url('../fonts/ReadexPro-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Tajawal';
  src: url('../fonts/Tajawal-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('../fonts/Tajawal-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* =========================================
   1. ظ…طھط؛ظٹط±ط§طھ ط§ظ„طھطµظ…ظٹظ… (Design Tokens)
   ========================================= */
:root {
  /* ط§ظ„ط£ظ„ظˆط§ظ† ط§ظ„ط£ط³ط§ط³ظٹط© ط¨طھط¯ط±ط¬ط§طھ ط§ظ„ط±طµط§طµظٹ ظپظ‚ط· */
  --primary: #4b5563;          /* ط±ظ…ط§ط¯ظٹ ط±طµط§طµظٹ ط§ط­طھط±ط§ظپظٹ ط¯ط§ظپط¦ */
  --primary-hover: #374151;
  --primary-light: #f3f4f6;
  
  /* ط£ظ„ظˆط§ظ† ط§ظ„ط­ط§ظ„ط© ط¨طھط¯ط±ط¬ط§طھ ط§ظ„ط±طµط§طµظٹ (ظ…ط¹ طھط®طµظٹطµ ط§ظ„ظ†ط¬ط§ط­ ظˆط§ظ„ط®ط·ط£ ط¨ط£ظ„ظˆط§ظ† ظ…ط¹ط¨ط±ط©) */
  --success: #16a34a; --success-light: #dcfce7; --success-dark: #166534;
  --danger: #dc2626;  --danger-light: #fee2e2;  --danger-dark: #991b1b;
  --warning: #4b5563; --warning-light: #f9fafb; --warning-dark: #1f2937;
  --info: #0284c7;    --info-light: #e0f2fe;    --info-dark: #0369a1;
  --pink-light: #fce7f3; --pink-dark: #9d174d;

  /* ط§ظ„ط®ظ„ظپظٹط§طھ ظˆط§ظ„ظ†طµظˆطµ */
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-overlay: rgba(24, 24, 27, 0.6);
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;

  /* ط§ظ„ط£ط¨ط¹ط§ط¯ ظˆط§ظ„ط­ط±ظƒط© */
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  /* ط§ظ„ط®ط·ظˆط· (ظٹط¯ط¹ظ… ط§ظ„ط¹ط±ط¨ظٹط© طھظ„ظ‚ط§ط¦ظٹط§ظ‹) */
  --font: 'Hacen', 'Tajawal', 'Cairo', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-title: 'Hacen', 'Tajawal', 'Cairo', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-menu: 'Hacen', 'Tajawal', 'Cairo', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --container: 1200px;
  
  /* ط§ظ„طھط¸ظ„ظٹظ„ ظˆط§ظ„طھط­ط¯ظٹط¯ (Selection) */
  --selection-bg: #cbd5e1;
  --selection-text: #0f172a;
}

/* ط§ظ„ظˆط¶ط¹ ط§ظ„ظ„ظٹظ„ظٹ ط§ظ„طھظ„ظ‚ط§ط¦ظٹ (Dark Mode) */
@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) {
    --bg: #32383e; --bg-alt: #1e2429; --bg-overlay: rgba(30, 36, 41, 0.75);
    --text: #ffffff; --text-muted: #a1a1aa; --border: #424a54;
    --primary: #ffffff; --primary-hover: #cbd5e1; --primary-light: #3a4149;
    --success-light: #1e2429; --success-dark: #ffffff; --success: #424a54;
    --danger-light: #1e2429; --danger-dark: #ffffff; --danger: #424a54;
    --warning-light: #1e2429; --warning-dark: #ffffff; --warning: #424a54;
    --info-light: #1e2429; --info-dark: #ffffff; --info: #424a54;
    --pink-light: #1e2429; --pink-dark: #ffffff;
    --selection-bg: #4b5563; --selection-text: #ffffff;
  }
}

/* ط§ظ„طھظپط¹ظٹظ„ ط§ظ„ظٹط¯ظˆظٹ ظ„ظ„ظˆط¶ط¹ ط§ظ„ط¯ط§ظƒظ† */
:root.theme-dark {
  --bg: #32383e; --bg-alt: #1e2429; --bg-overlay: rgba(30, 36, 41, 0.75);
  --text: #ffffff; --text-muted: #a1a1aa; --border: #424a54;
  --primary: #ffffff; --primary-hover: #cbd5e1; --primary-light: #3a4149;
  --success-light: #1e2429; --success-dark: #ffffff; --success: #424a54;
  --danger-light: #1e2429; --danger-dark: #ffffff; --danger: #424a54;
  --warning-light: #1e2429; --warning-dark: #ffffff; --warning: #424a54;
  --info-light: #1e2429; --info-dark: #ffffff; --info: #424a54;
  --pink-light: #1e2429; --pink-dark: #ffffff;
  --selection-bg: #4b5563; --selection-text: #ffffff;
}

/* طھط®طµظٹطµ ظ„ظˆظ† طھط¸ظ„ظٹظ„ ظˆطھط­ط¯ظٹط¯ ط§ظ„ظ†طµظˆطµ (Selection styling) */
::selection {
  background-color: var(--selection-bg);
  color: var(--selection-text);
}
::-moz-selection {
  background-color: var(--selection-bg);
  color: var(--selection-text);
}

/* ط²ط± طھط¨ط¯ظٹظ„ ط§ظ„ظ…ط¸ظ‡ط± */
.theme-toggle-btn {
  color: var(--text-muted);
}
.theme-toggle-btn:hover {
  background: var(--bg-alt) !important;
  color: var(--text) !important;
}

/* =========================================
   2. ط¥ط¹ط§ط¯ط© ط§ظ„ط¶ط¨ط· ط§ظ„ط­ط¯ظٹط«ط© (Modern Reset)
   ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ─── تخصيص شريط التمرير الأيمن (Modern Ultra-Thin Scrollbar) ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.25);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #1b4d3e;
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.25) transparent;
}

body { 
  font-family: var(--font); 
  background: var(--bg); 
  color: var(--text); 
  line-height: 1.6; 
  -webkit-font-smoothing: antialiased; 
  display: flex; 
  flex-direction: column; 
  min-height: 100vh; 
}
img, svg, video { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: #dc2626; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* =========================================
   3. ط§ظ„ط·ط¨ط§ط¹ط© (Typography)
   ========================================= */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-title); line-height: 1.25; margin-bottom: 1rem; font-weight: 700; color: var(--text); }
h1 { font-size: clamp(2rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: 1.25rem; }
p { margin-bottom: 1rem; color: var(--text-muted); }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.8rem; }
.font-bold { font-weight: 700; }

/* ظپط¦ط§طھ ط¹ط§ط¦ظ„ط§طھ ط§ظ„ط®ط·ظˆط· (Font Family Utilities) */
.font-uthmanic {
  font-family: 'KFGQPC Uthmanic Script', serif;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ccmp" 1, "locl" 1, "calt" 1, "liga" 1, "clig" 1, "rlig" 1, "mark" 1, "mkmk" 1;
}
.font-amiri { font-family: 'Amiri', serif; }
.font-cairo { font-family: 'Cairo', sans-serif; }
.font-fustat { font-family: 'Fustat', sans-serif; }
.font-hacen { font-family: 'Hacen', sans-serif; }
.font-samra { font-family: 'Samra', sans-serif; }
.font-kufam { font-family: 'Kufam', sans-serif; }
.font-markazi { font-family: 'Markazi Text', serif; }
.font-naskh { font-family: 'Noto Naskh Arabic', serif; }
.font-readex { font-family: 'Readex Pro', sans-serif; }
.font-tajawal { font-family: 'Tajawal', sans-serif; }

/* =========================================
   4. ظ†ط¸ط§ظ… ط§ظ„طھط®ط·ظٹط· (Layout System)
   ========================================= */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 1.5rem; }
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.flex { display: flex; gap: 1rem; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { justify-content: space-between; }
.flex-center { justify-content: center; align-items: center; }
.flex-col { flex-direction: column; align-items: flex-start; }

/* =========================================
   5. ط§ظ„ظ…ظƒظˆظ†ط§طھ ط§ظ„ط£ط³ط§ط³ظٹط© (Core Components)
   ========================================= */
/* --- ط§ظ„ط£ط²ط±ط§ط± (Buttons) --- */
.btn { 
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; 
  padding: 0.65rem 1.25rem; border-radius: var(--radius); font-weight: 600; 
  cursor: pointer; border: 1px solid transparent; transition: var(--transition); 
  font-size: 0.95rem; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary { background: #e2e8f0; color: #0f172a; border: 1px solid #cbd5e1; }
.btn-primary:hover { 
  background: #e2e8f0 !important; 
  color: #dc2626 !important; 
  border-color: #cbd5e1 !important; 
  transform: none !important; 
  box-shadow: none !important; 
}
/* ط²ط± btn-primary ظپظٹ ط§ظ„ظˆط¶ط¹ ط§ظ„ط¯ط§ظƒظ† */
:root.theme-dark .btn-primary,
:root:not(.theme-light) .btn-primary {
  background: var(--primary-light) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
:root.theme-dark .btn-primary:hover,
:root:not(.theme-light) .btn-primary:hover {
  background: var(--border) !important;
  color: #dc2626 !important;
  border-color: var(--primary-hover) !important;
}
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--bg-alt); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-alt); color: var(--text); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* --- ط²ط± ط§ظ„ط¥ط؛ظ„ط§ظ‚ (Close Button) --- */
.close-btn { 
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; width: 32px; height: 32px;
  cursor: pointer; color: var(--text-muted); border-radius: 50%; 
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.close-btn:hover { 
  background: var(--danger-light); color: var(--danger); 
  transform: rotate(90deg) scale(1.1);
}
.close-btn:active { transform: scale(0.95); }

/* --- ط§ظ„ط¨ط·ط§ظ‚ط§طھ (Cards) --- */
.card { 
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); 
  box-shadow: var(--shadow-sm); transition: var(--transition); overflow: hidden; 
}
.card:hover { box-shadow: var(--shadow); }
.card-header, .card-footer { padding: 1rem 1.5rem; background: var(--bg-alt); border-bottom: 1px solid var(--border); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.card-header { font-family: var(--font-title); }
.card-footer { border-top: 1px solid var(--border); border-bottom: none; }
.card-body { padding: 1.5rem; }

/* --- ط§ظ„ظ†ظ…ط§ط°ط¬ (Forms) --- */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; color: var(--text); }
.form-control { 
  box-sizing: border-box;
  width: 100%; padding: 0.65rem 1rem; border: 1px solid var(--border); 
  border-radius: var(--radius); background: var(--bg); color: var(--text); 
  transition: var(--transition); font-size: 0.95rem;
  unicode-bidi: plaintext;
  text-align: start;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-control::placeholder { color: var(--text-muted); opacity: 0.7; }
select.form-control { cursor: pointer; appearance: none; -webkit-appearance: none; -moz-appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); background-position: left 0.5rem center; background-repeat: no-repeat; background-size: 1.5em 1.5em; padding-left: 2.5rem; }

/* --- طھط®طµظٹطµ ط§ظ„ظ‚ظˆط§ط¦ظ… ط§ظ„ظ…ظ†ط³ط¯ظ„ط© ط§ظ„ط¬ظ…ط§ظ„ظٹط© (Custom Select) --- */
.custom-select-wrapper, .custom-select-container { position: relative; width: 100%; }
.custom-select, .custom-select-container { position: relative; width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; user-select: none; transition: var(--transition); }
.custom-select.open, .custom-select-container.open { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.custom-select-trigger { display: flex; align-items: center; justify-content: space-between; padding: 0.65rem 1rem; font-size: 0.95rem; color: var(--text); font-weight: 500; }
.custom-arrow, .accordion-arrow { display: inline-block; font-size: 0.8rem; color: var(--text-muted); transition: var(--transition); }
.custom-select.open .custom-arrow, .custom-select-container.open .custom-arrow { transform: rotate(180deg); }
.custom-options, .custom-select-options { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 4px; box-shadow: var(--shadow-lg); z-index: 999; max-height: 220px; overflow-y: auto; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: var(--transition); }
.custom-select.open .custom-options, .custom-select-container.open .custom-select-options { opacity: 1; visibility: visible; transform: translateY(0); }
.custom-option { padding: 0.65rem 1rem; font-size: 0.95rem; color: var(--text); transition: var(--transition); text-align: right; }
.custom-option:hover { background: var(--bg-alt); color: var(--text); }
.custom-option.selected { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.custom-select-wrapper select.form-control, .custom-select-container select.native-select { display: none !important; }

/* Custom Select Search styles */
.custom-select-search-wrapper {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  z-index: 10;
  box-sizing: border-box;
}
.custom-select-search-input {
  width: 100%;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
  unicode-bidi: plaintext;
  text-align: right;
  transition: var(--transition);
}
.custom-select-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* --- ظ…ظپطھط§ط­ ط§ظ„طھط¨ط¯ظٹظ„ (Toggle Switch) --- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: var(--border); transition: var(--transition); border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: #fff; transition: var(--transition); border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

/* --- ط§ظ„ط¬ط¯ط§ظˆظ„ (Tables) --- */
.table-responsive { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); width: 100%; }
.table, .data-table { width: 100%; border-collapse: collapse; }
.table th, .table td, .data-table th, .data-table td { padding: 0.45rem 1rem; text-align: start; unicode-bidi: plaintext; border-bottom: 1px solid var(--border); }
.table th, .data-table th { background: var(--bg-alt); font-weight: 600; color: var(--text); white-space: nowrap; font-size: 16px; }
.table td, .data-table td { font-size: 16px; font-weight: normal; }
.table tbody tr:last-child td, .data-table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover, .data-table tbody tr:hover { background: var(--bg-alt) !important; transition: var(--transition); cursor: pointer; }
.data-table-empty { padding: 1.5rem; text-align: center; color: var(--text-muted); }
.data-table .col-actions { text-align: center; width: 15%; }
.action-btn { display: inline-flex; text-decoration: none; font-size: 1rem; margin: 0 0.25rem; color: var(--text-muted); transition: var(--transition); }
.action-btn:hover { color: var(--primary); text-decoration: none; transform: scale(1.15); }
.action-btn-delete:hover { color: var(--danger); }
.action-btn-activate:hover { color: var(--success); }
.card-body-flush { padding: 0; }
/* --- ط§ظ„طھظ†ط¨ظٹظ‡ط§طھ ظˆط§ظ„ط´ط§ط±ط§طھ (Alerts & Badges) --- */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.75rem; font-size: 0.95rem; }
.alert-primary { background: var(--primary-light); color: var(--text); border: 1px solid var(--border); }
.alert-success { background: var(--success-light); color: var(--success-dark); border: 1px solid var(--success); }
.alert-danger { background: var(--danger-light); color: var(--danger-dark); border: 1px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning-dark); border: 1px solid var(--warning); }
.alert-info { background: var(--info-light); color: var(--info-dark); border: 1px solid var(--info); }
.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.65rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success-dark); }
.badge-danger { background: var(--danger-light); color: var(--danger-dark); }
.badge-info { background: var(--info-light); color: var(--info-dark); }
.badge-pink { background: var(--pink-light); color: var(--pink-dark); }

.status-active { color: var(--success-dark); font-weight: 700; font-size: 0.88rem; }
.status-inactive { color: var(--danger-dark); font-weight: 700; font-size: 0.88rem; }

/* =========================================
   6. ظ‚ظˆط§ظ„ط¨ ط§ظ„طھط®ط·ظٹط· ط§ظ„ط¹ط§ظ„ظ…ظٹط© (Global Layout)
   ========================================= */
/* --- ط´ط±ظٹط· ط§ظ„طھظ†ظ‚ظ„ (Navbar) --- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar { 
  font-family: var(--font-menu);
  background: rgba(255, 255, 255, 0.85); border-bottom: 1px solid var(--border); 
  padding: 0.75rem 0; backdrop-filter: blur(12px); 
}
@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) .navbar { background: rgba(30, 36, 41, 0.85); }
}
:root.theme-dark .navbar { background: rgba(30, 36, 41, 0.85); }
.navbar .container { display: flex; align-items: center; justify-content: space-between; }
.nav-brand-container { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.nav-brand { font-size: 1.25rem; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 0.5rem; line-height: 1.2; }
.nav-date { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; line-height: 1.2; }
.nav-date:empty { display: none; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; }
.nav-link:hover, .nav-link.active { color: var(--primary); text-decoration: none; }

/* --- ظ„ظˆط­ط© ط§ظ„طھط­ظƒظ… (Dashboard Layout) --- */
.dashboard-layout { display: block; min-height: calc(100vh - 65px); }
.sidebar { font-family: var(--font-menu); background: var(--bg-alt); border-inline-end: 1px solid var(--border); padding: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.sidebar-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: var(--radius); color: var(--text-muted); font-weight: 500; transition: var(--transition); }
.sidebar-link:hover, .sidebar-link.active { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.main-content { padding: 0.75rem 2rem 2rem 2rem; }

/* --- ظ‚ط³ظ… ط§ظ„ظ‡ظٹط±ظˆ (Hero Section) --- */
.hero { padding: 5rem 1.5rem; text-align: center; background: linear-gradient(to bottom, var(--bg-alt), var(--bg)); border-bottom: 1px solid var(--border); }
.hero p { font-size: 1.15rem; max-width: 600px; margin-inline: auto; margin-bottom: 2rem; }
.hero-emoji { font-size: 70px; margin-bottom: 20px; }
.welcome-box { max-width: 480px; margin: 0 auto; padding: 20px; text-align: right; }
.welcome-hint { display: block; margin-bottom: 10px; }

/* --- ط§ظ„طھط°ظٹظٹظ„ (Footer) --- */
.footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 3rem 0 1.5rem; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-brand { font-weight: 800; font-size: 1.2rem; margin-bottom: 1rem; display: block; color: var(--text); }
.footer-desc { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.footer-title { font-weight: 700; margin-bottom: 1rem; font-size: 0.95rem; }
.footer-links { display: flex; flex-direction: column; gap: 0.75rem; }
.footer-link { color: var(--text-muted); font-size: 0.9rem; }
.footer-link:hover { color: var(--primary); text-decoration: none; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr; text-align: center; } }

/* =========================================
   7. ط£ط¯ظˆط§طھ ظ…ط³ط§ط¹ط¯ط© ظˆط­ط±ظƒط§طھ (Utilities & Animations)
   ========================================= */
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.pb-1 { padding-bottom: 0.5rem; }
.card-body-sm { padding: 1rem; }
.w-full { width: 100%; }
.w-70 { width: 70px; }
.lh-lg { line-height: 1.8; }
.hidden { display: none !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* --- ط¯ط§ط¦ط±ط© ط§ظ„طھط­ظ…ظٹظ„ (Loading Spinner) --- */
.ajax-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; gap: 0.75rem; }
.ajax-spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
.ajax-loader-text { font-size: 0.9rem; color: var(--text-muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- ط²ط± ط§ظ„ط¹ظˆط¯ط© ظ„ظ„ط£ط¹ظ„ظ‰ (Scroll to Top) --- */
.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 9999;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s, background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-top-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* طھط­ط³ظٹظ† ط§ط³طھط¬ط§ط¨ط© ط§ظ„طھظ†ط¨ظٹظ‡ط§طھ (Toast) ط¹ظ„ظ‰ ط´ط§ط´ط§طھ ط§ظ„ط¬ظˆط§ظ„ */
@media (max-width: 768px) {
  .dom-toast {
    right: 10px !important;
    left: 10px !important;
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
  }
}

/* --- ط£ط±ظ‚ط§ظ… ط§ظ„طµظپط­ط§طھ (Pagination) --- */
.pagination {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: var(--transition);
  cursor: pointer;
  min-width: 32px;
}
.pagination a:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.pagination .current {
  background: #cbd5e1;
  color: #0f172a;
  border-color: #cbd5e1;
}
/* ط§ظ„ظˆط¶ط¹ ط§ظ„ط¯ط§ظƒظ† ظ„ط²ط± ط§ظ„طھط±ظ‚ظٹظ… ط§ظ„ط­ط§ظ„ظٹ */
:root.theme-dark .pagination .current,
:root:not(.theme-light) .pagination .current {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
}
.pagination .prev, .pagination .next {
  padding-inline: 0.85rem;
}
.pagination .disabled {
  background: var(--bg-alt);
  color: var(--text-muted);
  border-color: var(--border);
  opacity: 0.5;
  cursor: not-allowed;
}
.pagination .dots {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: default;
  min-width: auto;
}

/* ==========================================================================
   8. طھظ†ط³ظٹظ‚ط§طھ ط§ظ„ط·ط¨ط§ط¹ط© ط§ظ„ط¹ط§ظ…ط© (Global Print Styles)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* ط¥ط®ظپط§ط، ط§ظ„ط¹ظ†ط§طµط± ط؛ظٹط± ط§ظ„ظ…ط·ظ„ظˆط¨ط© ظ„ظ„ط·ط¨ط§ط¹ط© */
  .no-print, 
  #topbar, 
  .navbar, 
  .sidebar, 
  .footer, 
  .theme-toggle-btn, 
  .scroll-top-btn, 
  button, 
  input, 
  select, 
  .pagination,
  .tabs-container {
    display: none !important;
  }
  
  /* ط¥ط¸ظ‡ط§ط± ط§ظ„ط¹ظ†ط§طµط± ط§ظ„ظ…ط®طµطµط© ظ„ظ„ط·ط¨ط§ط¹ط© ظپظ‚ط· */
  .print-only {
    display: block !important;
  }
  
  /* ظƒظ„ط§ط³ طھظ†ط¸ظٹظ… ط·ط¨ط§ط¹ط© ط§ظ„ظ…ط³طھظ†ط¯ط§طھ ط§ظ„ط¨ط³ظٹط·ط© */
  .print-document-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #000000;
    padding-bottom: 8px;
    margin-bottom: 20px;
    font-size: 10pt;
    color: #333333;
    font-weight: bold;
    direction: rtl;
  }
  
  .print-document-header span {
    display: inline-block;
  }

  /* طھظ†ط³ظٹظ‚ ط§ظ„ط¬ط¯ط§ظˆظ„ ط£ط«ظ†ط§ط، ط§ظ„ط·ط¨ط§ط¹ط© */
  table, .table, .data-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 15px !important;
  }
  table th, table td, .table th, .table td, .data-table th, .data-table td {
    border: 1px solid #000000 !important;
    padding: 6px 10px !important;
    color: #000000 !important;
    font-size: 10pt !important;
  }
  table th, .table th, .data-table th {
    background: #f3f4f6 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  /* ط¥ط®ظپط§ط، ط§ظ„ط¹ظ…ظˆط¯ ط§ظ„ط£ط®ظٹط± (ط¹ظ…ظˆط¯ ط§ظ„ط¥ط¬ط±ط§ط،ط§طھ/ط§ظ„ط¹ظ…ظ„ظٹط§طھ) طھظ„ظ‚ط§ط¦ظٹط§ظ‹ ط¹ظ†ط¯ ط§ظ„ط·ط¨ط§ط¹ط© */
  .table-print-no-actions th:last-child,
  .table-print-no-actions td:last-child {
    display: none !important;
  }
}

/* ط¥ط®ظپط§ط، ط¹ظ†ط§طµط± ط§ظ„ط·ط¨ط§ط¹ط© ط§ظ„ط§ظپطھط±ط§ط¶ظٹط© ط¹ظ„ظ‰ ط§ظ„ط´ط§ط´ط© */
.print-only {
  display: none !important;
}

/* --- ط´ط±ظٹط· ط§ظ„طھطµظپظٹط© ظˆط§ظ„ط¨ط­ط« (Table Filters & Search Bar) --- */
.table-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
  background: var(--bg, #ffffff);
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.tabs-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 2px 2px 0 0;
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  top: 1px;
  margin-bottom: 0;
  cursor: pointer;
}
.tab-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-color: var(--border);
  text-decoration: none;
}
.tab-btn.active {
  color: var(--primary) !important;
  background: var(--bg) !important;
  border-left: 1px solid var(--border) !important;
  border-right: 1px solid var(--border) !important;
  border-top: 4px solid #374151 !important;
  border-bottom: 1px solid var(--bg) !important;
  box-shadow: none !important;
  font-weight: 600;
  z-index: 2;
}
.search-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.search-input {
  width: 200px;
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 6px 12px;
  background: var(--bg);
  color: var(--text);
}
.search-form button {
  border-radius: 20px;
  padding: 6px 16px;
}

/* â”€â”€ ظپط§طµظ„ ط£ظ‚ط³ط§ظ… ط§ظ„ظ†ظ…ظˆط°ط¬ â”€â”€ */
.section-divider {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-top: 1.6rem;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

/* â”€â”€ ظ…ط¬ظ…ظˆط¹ط© ط¥ط¯ط®ط§ظ„ ط§ظ„طھط§ط±ظٹط® ط§ظ„ظ‡ط¬ط±ظٹ (ط³ظ†ط© + ط´ظ‡ط± + ظٹظˆظ…) â”€â”€ */
.hijri-date-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  align-items: center;
  max-width: 380px;
}
.hijri-date-group .form-control {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
/* ط¥ط¬ط¨ط§ط± ط§ظ„ط£ط±ظ‚ط§ظ… ط¹ظ„ظ‰ ط§ظ„ظ„ط§طھظٹظ†ظٹط© (Western) ظپظٹ ط¬ظ…ظٹط¹ ط§ظ„ظ…طھطµظپط­ط§طھ */
.hijri-date-group input[type="number"].form-control {
  direction: ltr;
  text-align: center;
}

/* â”€â”€ ظ…ط¹ط§ظٹظ†ط© طµظˆط±ط© ط§ظ„ظ…ط¹ظ„ظ… ظپظٹ ظ†ظ…ظˆط°ط¬ ط§ظ„طھط¹ط¯ظٹظ„ â”€â”€ */
.teacher-pic-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-alt, #f8f9fa);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.teacher-pic-preview img {
  height: 180px;
  width: auto;
  border-radius: 4px;
  border: 2px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.teacher-pic-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  text-align: center;
}

/* ========== ظ…ظˆط¯ط§ظ„ ط§ظ„طھط¹ط§ظ…ظٹظ… ط§ظ„ط¥ط¯ط§ط±ظٹط© ========== */
.msg-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    direction: rtl;
}
.msg-modal-content {
    background: var(--bg);
    color: var(--text);
    width: 90%;
    max-width: 950px;
    height: 85%;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-slide-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border);
}
@keyframes modal-slide-in {
    from { transform: translateY(30px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
.msg-modal-header {
    background: var(--bg-alt);
    color: var(--text);
    padding: 1.15rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.msg-modal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}
.msg-sidebar {
    width: 250px;
    background: var(--bg-alt);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
}
.msg-tab-btn {
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    text-align: right;
    font-weight: bold;
    color: var(--text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-menu);
}
.msg-tab-btn.active {
    background: var(--primary-light);
    color: var(--text);
}
.msg-tab-btn:hover:not(.active) {
    background: var(--primary-light);
    color: var(--text);
}
.msg-content-area {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.msg-tab-panel {
    display: none;
    flex-direction: column;
    gap: 1.25rem;
    height: 100%;
}
.msg-tab-panel.active { display: flex; }
.msg-item-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: var(--transition);
}
.msg-item-card:hover {
    border-color: var(--primary);
}
.msg-badge-sender {
    background: var(--info-light);
    color: var(--info-dark);
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: bold;
}
@media (max-width: 768px) {
    .msg-modal-body { flex-direction: column; }
    .msg-sidebar {
        width: 100%;
        border-left: none;
        border-bottom: 1px solid var(--border);
        flex-direction: row;
        overflow-x: auto;
        padding: 0.75rem;
    }
    .msg-tab-btn { white-space: nowrap; }
}

/* ========== ظ‚ظˆط§ط¦ظ… ط§ظ„ط¨ظٹط§ظ†ط§طھ ط§ظ„ظ…ط´طھط±ظƒط© (supervisors / teachers / visors) ========== */
.data-table th,
.data-table td {
    text-align: right !important;
}
.destroy-btn {
    color: var(--danger);
    font-weight: 900;
    font-size: 1.35rem;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s ease, color 0.2s ease;
}
.destroy-btn:hover {
    color: var(--danger-dark);
    transform: scale(1.25);
    text-decoration: none;
}

/* ========== ط´ط±ظٹط· ط§ظ„ظپظ„ط§طھط± ظˆط§ظ„ط¨ط­ط« ط§ظ„ظ…ط´طھط±ظƒ ========== */
.table-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    padding: 12px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    margin-bottom: 20px;
}
.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.search-input {
    width: 200px;
    border-radius: 20px;
    border: 1px solid var(--border);
    padding: 6px 12px;
}
.search-form button {
    border-radius: 20px;
    padding: 6px 16px;
}
.grid-badge {
    text-decoration: none;
    font-size: 11px;
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: bold;
}

/* ========== ط¬ط¯ظˆظ„ ظ‚ط§ط¦ظ…ط© ط§ظ„ظ…ط±ط§ظƒط² ========== */
.data-table-container .data-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 13px !important;
}
.data-table-container .data-table th,
.data-table-container .data-table td {
    border: 1px solid var(--border) !important;
    padding: 6px 8px !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
    text-align: right;
}
.data-table-container .data-table th {
    background-color: var(--bg-alt) !important;
    color: var(--text-muted) !important;
    font-weight: 600 !important;
    text-align: center !important;
}
.data-table-container .data-table td.text-center,
.data-table-container .data-table th[width="50"],
.data-table-container .data-table th.col-actions,
.data-table-container .data-table td[data-label="ط§ظ„ط³ط¬ظ„"],
.data-table-container .data-table td[data-label="ط§ظ„ط­ط§ظ„ط©"],
.data-table-container .data-table td[data-label="GPS"],
.data-table-container .data-table td[data-label="ط§ظ„ظ…ط¹ظ„ظ…ظٹظ†"],
.data-table-container .data-table td[data-label="ط§ظ„ظ…ط¹ظ„ظ…ط§طھ"],
.data-table-container .data-table td[data-label="ط§ظ„طھظ‚ط§ط±ظٹط±"],
.data-table-container .data-table td[data-label="ط²ظٹط§ط±ط©"],
.data-table-container .data-table td[data-label="طھط¹ط¯ظٹظ„"],
.data-table-container .data-table td[data-label="ط­ط°ظپ"] {
    text-align: center !important;
}
.data-table-container .data-table tbody tr:nth-child(even) {
    background-color: var(--bg-alt) !important;
}
.data-table-container .data-table tbody tr:hover {
    background-color: var(--primary-light) !important;
}

/* طھظ‚طµظٹط± ط§ظ„ط£ط³ظ…ط§ط، ظˆط§ظ„ظ†طµظˆطµ ط§ظ„ط·ظˆظٹظ„ط© ظپظٹ ط§ظ„ط¬ط¯ط§ظˆظ„ ط¨طµط±ظٹط§ظ‹ */
.td-truncate {
    display: inline-block;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* ========== ط§ظ„طµظپط­ط© ط§ظ„ط±ط¦ظٹط³ظٹط© (home) ========== */
.home-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
    padding: 3rem 1.5rem;
    background: linear-gradient(135deg, var(--bg-alt) 0%, var(--bg) 100%);
    position: relative;
    overflow-x: hidden;
    overflow-y: visible;
    direction: rtl;
}
.home-wrapper::before,
.home-wrapper::after {
    content: '';
    position: absolute;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    opacity: 0.12;
    pointer-events: none;
    transition: all 0.5s ease;
}
.home-wrapper::before { background: #4a6fa5; top: -50px; left: -50px; }
.home-wrapper::after  { background: #16a34a; bottom: -50px; right: -50px; }

.glass-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 40px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.02);
    border-radius: 1.25rem;
    width: 100%;
    max-width: 680px;
    padding: 3.5rem 3rem;
    position: relative;
    z-index: 1;
    text-align: center;
    animation: homeFadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes homeFadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
.doc-rendered-body {
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.8;
}
.doc-rendered-body h2 { margin-bottom: 1.5rem; }
.doc-rendered-body img {
    max-width: 140px;
    margin: 0 auto 1.5rem auto;
    filter: drop-shadow(0 8px 16px rgba(74,111,165,0.15));
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.doc-rendered-body img:hover { transform: scale(1.06) rotate(1deg); }
.doc-rendered-body strong   { color: #4a6fa5; }

:root.theme-dark .home-wrapper::before,
:root:not(.theme-light) .home-wrapper::before { background: #8faed9; opacity: 0.08; }
:root.theme-dark .home-wrapper::after,
:root:not(.theme-light) .home-wrapper::after  { background: #4ade80; opacity: 0.08; }
:root.theme-dark .glass-card,
:root:not(.theme-light) .glass-card {
    background: rgba(30,36,41,0.75);
    border-color: rgba(255,255,255,0.06);
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}
:root.theme-dark .doc-rendered-body strong,
:root:not(.theme-light) .doc-rendered-body strong { color: #8faed9; }
:root.theme-dark .glass-card .doc-rendered-body b,
:root.theme-dark .glass-card .doc-rendered-body span,
:root.theme-dark .glass-card .doc-rendered-body div,
:root.theme-dark .glass-card .doc-rendered-body font,
:root:not(.theme-light) .glass-card .doc-rendered-body b,
:root:not(.theme-light) .glass-card .doc-rendered-body span,
:root:not(.theme-light) .glass-card .doc-rendered-body div,
:root:not(.theme-light) .glass-card .doc-rendered-body font { color: var(--text) !important; }

@media (max-width: 768px) {
    .home-wrapper { align-items: flex-start; padding: 1.5rem 1rem; }
    .glass-card   { padding: 2.5rem 1.5rem; border-radius: 1rem; }
}

/* ========== ظ…ط­ط±ط± ط§ظ„طµظپط­ط© ط§ظ„ط±ط¦ظٹط³ظٹط© (WYSIWYG â€” ظ„ظˆط­ط© ط§ظ„ظ…ط·ظˆط±) ========== */
#homepage-preview-container {
    text-align: center;
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.8;
    direction: rtl;
    outline: none;
}
#homepage-preview-container h2  { margin-bottom: 1.5rem; }
#homepage-preview-container img {
    max-width: 140px;
    display: inline-block !important;
    margin: 0 auto 1.5rem auto !important;
    filter: drop-shadow(0 8px 16px rgba(74,111,165,0.15));
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#homepage-preview-container img:hover { transform: scale(1.06) rotate(1deg); }
#homepage-preview-container strong    { color: #4a6fa5; }
.wysiwyg-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s, border-color 0.2s;
}
.wysiwyg-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.wysiwyg-select {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    height: auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
}

/* ========== ظ…ظˆط¯ط§ظ„ طھط؛ظٹظٹط± ظƒظ„ظ…ط© ط§ظ„ظ…ط±ظˆط± ========== */
.chpass-modal {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    direction: rtl;
    padding: 1rem;
}
.chpass-modal.open {
    display: flex;
}
.chpass-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    animation: modal-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.chpass-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.5rem;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-title);
    font-weight: bold;
    color: var(--text);
}
.chpass-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}
.chpass-field label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.chpass-field input[type="password"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.chpass-field input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
}
.chpass-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
}
.chpass-close-btn {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0.1rem 0.3rem;
    border-radius: var(--radius);
    transition: color 0.2s;
}
.chpass-close-btn:hover { color: var(--danger); }

/* ========== ط´ط§ط´ط© ط¥ط¬ط¨ط§ط± طھط؛ظٹظٹط± ظƒظ„ظ…ط© ط§ظ„ظ…ط±ظˆط± ط§ظ„ط§ظپطھط±ط§ط¶ظٹط© ========== */
.force-chpass-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    padding: 1rem;
}
.force-chpass-box {
    background: var(--bg);
    border: 2px solid var(--danger);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(220,38,38,0.2), var(--shadow-lg);
    width: 100%;
    max-width: 460px;
    animation: modal-slide-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.force-chpass-header {
    background: var(--danger);
    color: #fff;
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-title);
    font-weight: bold;
    font-size: 1.05rem;
}
.force-chpass-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}
.force-chpass-warning {
    background: var(--danger-light);
    color: var(--danger-dark);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.6;
}
.force-chpass-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
    display: flex;
    justify-content: flex-end;
}

/* ========== ط³ط·ط± ط§ظ„طھط±ط­ظٹط¨ ظ…ط¹ ط²ط± طھط؛ظٹظٹط± ظƒظ„ظ…ط© ط§ظ„ظ…ط±ظˆط± ========== */
.welcome-bar {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.welcome-chpass-btn {
    font-size: 0.85rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
@media (max-width: 767px) {
    .welcome-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .welcome-chpass-btn {
        width: 100%;
        justify-content: center;
        order: 2;
    }
    .welcome-bar .alert {
        order: 1;
    }
}
/* ========== لوحة تقارير زيارات المشرف الميداني ========== */

/* زر عمود التقارير في الجدول */
.creport-col-btn {
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}
.creport-badge {
    display: inline-block;
    background: var(--primary);
    color: var(--bg);
    font-weight: bold;
    font-size: 13px;
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 999px;
    text-align: center;
    transition: opacity 0.2s;
}
.creport-col-btn:hover .creport-badge {
    opacity: 0.8;
}
.creport-badge-empty {
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    font-weight: normal;
}

/* اللوحة الرئيسية */
.creport-panel {
    position: fixed;
    top: calc(50% - 220px);
    left: calc(50% - 185px);
    width: 370px;
    max-height: 540px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    direction: rtl;
    text-align: right;
    font-family: inherit;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.25s ease, transform 0.25s ease;
    overflow: hidden;
    z-index: 99999;
}

/* شريط العنوان */
.creport-panel-header {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}
.creport-panel-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--text);
}
.creport-panel-close {
    font-size: 22px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}
.creport-panel-close:hover { color: var(--danger); }

/* جسم المحتوى */
.creport-panel-body {
    padding: 14px;
    overflow-y: auto;
    flex: 1;
}

/* تحميل */
.creport-loading {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

/* فارغ */
.creport-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* نموذج الإضافة */
.creport-add-form {
    background: rgba(16,185,129,0.06);
    border: 1px solid #10b981;
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 14px;
}
.creport-add-label {
    font-size: 13px;
    font-weight: bold;
    color: #059669;
    margin: 0 0 8px;
}
.creport-textarea {
    width: 100%;
    min-height: 90px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    direction: rtl;
    resize: vertical;
    background: var(--bg);
    color: var(--text);
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.creport-textarea:focus {
    border-color: #10b981;
    outline: none;
    box-shadow: 0 0 0 2px rgba(16,185,129,0.12);
}
.creport-submit-btn {
    margin-top: 8px;
    padding: 6px 18px;
    font-size: 13px;
}

/* بطاقة التقرير الواحد */
.creport-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--bg-alt);
    transition: opacity 0.3s, max-height 0.3s;
}
.creport-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.creport-date {
    font-size: 11px;
    color: var(--text-muted);
}
.creport-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}
.creport-delete-btn:hover { color: var(--danger); }
.creport-content {
    font-size: 13px;
    line-height: 1.9;
    color: var(--text);
}

/* تنسيقات متجاوبة لتوسيع الهيدر وإعطاء مساحة تنفس لاسم المنصة على الهواتف */
@media (max-width: 767px) {
    .navbar {
        padding: 1.2rem 0 !important;
    }
    .nav-brand {
        font-size: 1.15rem !important;
        margin-top: 0.15rem !important;
    }
    .nav-date {
        margin-top: 0.3rem !important;
        font-size: 0.75rem !important;
    }
}

/* ==========================================================================
   8. فقاعة المحادثة والتوست الذكي للمساعد (AI Smart Assistant Toast)
   ========================================================================== */
@keyframes ai-pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.75);
    transform: translateY(0) scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    transform: translateY(-2px) scale(1.05);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    transform: translateY(0) scale(1);
  }
}
@keyframes ai-pulse-glow-red {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.75);
    transform: translateY(0) scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    transform: translateY(-2px) scale(1.05);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    transform: translateY(0) scale(1);
  }
}

.ai-toast-bubble {
  --ai-toast-bg: var(--bg);
  --ai-toast-border: var(--border);

  position: fixed;
  top: 65px;
  left: 16px;
  z-index: 9999999;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--ai-toast-bg);
  border: 1px solid var(--ai-toast-border);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  border-radius: 12px;
  width: 320px;
  color: var(--text);
  direction: rtl;
  text-align: right;
  font-family: system-ui, -apple-system, sans-serif;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  pointer-events: none;
}
.ai-toast-bubble.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* نمط التنبيهات والأخطاء باللون الأحمر الخفيف */
.ai-toast-error {
  --ai-toast-bg: #fef2f2;
  --ai-toast-border: #fca5a5;
}

/* الأنماط الخاصة بالوضع الداكن */
:root.theme-dark .ai-toast-error {
  --ai-toast-bg: #2d1e1e;
  --ai-toast-border: #5c2c2c;
}
@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) .ai-toast-error {
    --ai-toast-bg: #2d1e1e;
    --ai-toast-border: #5c2c2c;
  }
}

/* السهم الخاص بفقاعة المحادثة يشير للأعلى نحو الأفاتار */
.ai-toast-bubble::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 45px;
  border-width: 0 8px 8px 8px;
  border-style: solid;
  border-color: transparent transparent var(--ai-toast-border) transparent;
}
.ai-toast-bubble::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 45px;
  border-width: 0 8px 8px 8px;
  border-style: solid;
  border-color: transparent transparent var(--ai-toast-bg) transparent;
}

@media (max-width: 480px) {
  .ai-toast-bubble {
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
    top: 60px !important;
  }
  .ai-toast-bubble::before, .ai-toast-bubble::after {
    left: 18px !important;
  }
}



