/* توحيد المظهر العام مع الصفحة الرئيسية دون تغيير وظائف الصفحات */
:root {
  --unified-primary: #4361ee;
  --unified-primary-dark: #3a56d4;
  --unified-secondary: #7209b7;
  --unified-success: #4cc9f0;
  --unified-danger: #e63946;
  --unified-text: #212529;
  --unified-muted: #6c757d;
  --unified-border: #dee2e6;
  --unified-card: #ffffff;
  --unified-bg: #f5f7fa;
  --unified-surface: rgba(255, 255, 255, .94);
  --unified-surface-soft: rgba(248, 250, 252, .92);
  --unified-line-soft: rgba(148, 163, 184, .20);
  --unified-shadow: 0 18px 48px rgba(15, 23, 42, .14);
  --unified-shadow-soft: 0 10px 28px rgba(15, 23, 42, .09);
  --unified-gradient: linear-gradient(135deg, #4361ee 0%, #3f37c9 48%, #3a0ca3 100%);
  --unified-radius: 24px;
  --unified-radius-small: 16px;
  --unified-container: 1400px;
}

html[data-theme="dark"] {
  --unified-primary: #8b5cf6;
  --unified-primary-dark: #7c3aed;
  --unified-secondary: #a855f7;
  --unified-success: #38bdf8;
  --unified-danger: #fb7185;
  --unified-text: #f8fafc;
  --unified-muted: #cbd5e1;
  --unified-border: #334155;
  --unified-card: #0f172a;
  --unified-bg: #020617;
  --unified-surface: rgba(15, 23, 42, .96);
  --unified-surface-soft: rgba(30, 41, 59, .78);
  --unified-line-soft: rgba(148, 163, 184, .20);
  --unified-shadow: 0 18px 48px rgba(0, 0, 0, .34);
  --unified-shadow-soft: 0 10px 28px rgba(0, 0, 0, .26);
  --unified-gradient: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #581c87 100%);
}

html,
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100dvh !important;
  display: flex !important;
  flex-direction: column !important;
  margin: 0;
  font-family: 'Cairo', Arial, sans-serif !important;
  color: var(--unified-text) !important;
  background:
    radial-gradient(circle at top right, rgba(67, 97, 238, .12), transparent 34%),
    linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%) !important;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at top right, rgba(139, 92, 246, .20), transparent 34%),
    radial-gradient(circle at bottom left, rgba(56, 189, 248, .08), transparent 28%),
    linear-gradient(135deg, #020617 0%, #0b1120 100%) !important;
}

.header {
  position: sticky !important;
  top: 0;
  z-index: 1000 !important;
  width: 100%;
  padding: 0 !important;
  color: #ffffff !important;
  background:
    radial-gradient(circle at top right, rgba(76, 201, 240, .20), transparent 30%),
    var(--unified-gradient) !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, .20) !important;
  border-radius: 0 !important;
  box-shadow: 0 14px 34px rgba(67, 97, 238, .16) !important;
}

html[data-theme="dark"] .header {
  box-shadow: 0 18px 46px rgba(0, 0, 0, .34) !important;
}

.header .header-content {
  width: 100% !important;
  max-width: var(--unified-container) !important;
  min-height: 0 !important;
  margin: 0 auto !important;
  padding: 14px clamp(14px, 3vw, 24px) 18px !important;
  color: #ffffff !important;
}

.header .header-top,
.header .header-content.no-header-top {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 14px !important;
  flex-wrap: wrap !important;
  width: 100% !important;
  padding: 12px 14px !important;
  border-radius: 22px !important;
  background: rgba(255, 255, 255, .10) !important;
  border: 1px solid rgba(255, 255, 255, .18) !important;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .14) !important;
}

.header .header-content.no-header-top > .logo-section,
.header .header-content.no-header-top > .logo-area,
.header .header-content.no-header-top > .logo-wrap {
  order: 1;
}

.header .header-content.no-header-top > .nav-links {
  order: 2;
}

.header .header-content.no-header-top > #topStatus {
  order: 3;
}

.header .header-content.no-header-top > .control-section {
  order: 4;
  flex: 1 0 100%;
  width: 100%;
  margin: 0 !important;
  padding: 12px 0 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.header .header-content.no-header-top > .control-section .control-row {
  width: 100%;
}

.header .logo-section,
.header .logo-area,
.header .logo-wrap,
.header .logo-wrap .logo-section {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.header .logo {
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  flex: 0 0 56px !important;
  padding: 7px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  border-radius: 16px !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, .18) !important;
  border: 1px solid rgba(255, 255, 255, .24) !important;
  box-shadow: none !important;
}

.header .logo img,
.header .logo-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block;
  filter: none !important;
}

.header .title-section,
.header .title {
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
  text-align: right !important;
}

.header .title-section h1,
.header .title h1 {
  margin: 0 !important;
  color: #ffffff !important;
  font-size: clamp(17px, 2vw, 22px) !important;
  font-weight: 900 !important;
  line-height: 1.35 !important;
  letter-spacing: -.02em;
}

.header .title-section .subtitle,
.header .title-section p,
.header .title .sub,
.header .title p {
  margin: 3px 0 0 !important;
  color: rgba(255, 255, 255, .88) !important;
  font-size: clamp(12px, 1.3vw, 14px) !important;
  font-weight: 700 !important;
  line-height: 1.5 !important;
}

.header .nav-links,
.header .portal-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  min-width: 0;
  margin-inline-start: auto !important;
}

.header .nav-link,
.header .theme-toggle,
.header .portal-install-btn,
.header #topStatus,
.header .current-user {
  min-height: 46px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 15px !important;
  border-radius: 14px !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, .12) !important;
  border: 1px solid rgba(255, 255, 255, .18) !important;
  box-shadow: none !important;
  text-decoration: none !important;
  font: inherit !important;
  font-size: .9rem !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
}

.header .nav-link:hover,
.header .theme-toggle:hover,
.header .portal-install-btn:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, .24) !important;
  border-color: rgba(255, 255, 255, .28) !important;
  transform: translateY(-1px);
}

.header .nav-link i,
.header .theme-toggle i,
.header .portal-install-btn i,
.header #topStatus i {
  color: #ffffff !important;
}

.header .control-section .trainees-count,
.header .control-section .count-pill {
  color: #ffffff !important;
  background: rgba(255, 255, 255, .14) !important;
  border-color: rgba(255, 255, 255, .20) !important;
}

body > main.container,
body > div.container,
#appView > main.container,
#appView > div.container,
main.page,
main.container {
  width: 100% !important;
  max-width: var(--unified-container) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

:where(
  .top-panel,
  .status-card,
  .system-status-card,
  .evaluation-form-card,
  .card,
  .hero,
  .entry-card,
  .system-card,
  .group-card,
  .section-card,
  .session-card,
  .install-box,
  .user-info-card,
  .sales-tests-card,
  .summary-box,
  .workspace-box,
  .group-block,
  .panel,
  .plan-page-head,
  .admin-key-bar
) {
  background: var(--unified-surface) !important;
  border: 1px solid var(--unified-line-soft) !important;
  box-shadow: var(--unified-shadow) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

:where(
  .top-panel,
  .status-card,
  .system-status-card,
  .evaluation-form-card,
  .card,
  .hero,
  .entry-card,
  .system-card,
  .group-card,
  .section-card,
  .session-card,
  .install-box,
  .user-info-card,
  .sales-tests-card,
  .summary-box,
  .workspace-box,
  .group-block,
  .panel,
  .plan-page-head,
  .admin-key-bar
) {
  border-radius: var(--unified-radius) !important;
}

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea, .admin-key-input, .pw-input, .search-input) {
  color: var(--unified-text) !important;
  background: var(--unified-surface-soft) !important;
  border-color: var(--unified-line-soft) !important;
}

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea, .admin-key-input, .pw-input, .search-input):focus {
  outline: none !important;
  border-color: rgba(67, 97, 238, .48) !important;
  box-shadow: 0 0 0 4px rgba(67, 97, 238, .12) !important;
}

:where(button, .btn, .submit-btn, #submitBtn, #applyBtn, #saveAdminKeyBtn) {
  font-family: inherit !important;
  border-radius: 16px !important;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease !important;
}

:where(button, .btn, .submit-btn, #submitBtn, #applyBtn, #saveAdminKeyBtn):hover {
  transform: translateY(-1px);
}

.page-footer {
  width: 100% !important;
  margin-top: auto !important;
  padding: 22px 16px !important;
  color: #ffffff !important;
  background:
    radial-gradient(circle at top right, rgba(76, 201, 240, .16), transparent 30%),
    linear-gradient(135deg, #4361ee 0%, #3f37c9 48%, #3a0ca3 100%) !important;
  border: 0 !important;
  border-top: 1px solid rgba(255, 255, 255, .12) !important;
  box-shadow: 0 -12px 34px rgba(67, 97, 238, .16) !important;
}

html[data-theme="dark"] .page-footer {
  background:
    radial-gradient(circle at top right, rgba(139, 92, 246, .18), transparent 30%),
    radial-gradient(circle at bottom left, rgba(56, 189, 248, .10), transparent 26%),
    linear-gradient(135deg, #020617 0%, #0f172a 52%, #1e1b4b 100%) !important;
  border-top-color: rgba(148, 163, 184, .18) !important;
  box-shadow: 0 -16px 42px rgba(0, 0, 0, .34) !important;
}

.page-footer .taqeem-footer-shell {
  width: min(100%, 720px) !important;
  max-width: 720px !important;
  margin: 0 auto !important;
  padding: 15px 18px !important;
  border-radius: 22px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 9px !important;
  text-align: center !important;
  background: rgba(255, 255, 255, .10) !important;
  border: 1px solid rgba(255, 255, 255, .18) !important;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .14) !important;
}

.page-footer .taqeem-footer-top,
.page-footer .taqeem-footer-rights {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  color: rgba(255, 255, 255, .90) !important;
  font-weight: 850 !important;
}

.page-footer .taqeem-footer-top {
  direction: ltr;
}

.page-footer .taqeem-footer-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 34px !important;
  min-width: 0 !important;
  padding: 6px 14px !important;
  border-radius: 999px !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, .18) !important;
  border: 1px solid rgba(255, 255, 255, .24) !important;
  font-weight: 1000 !important;
}

.page-footer .taqeem-footer-note {
  color: rgba(255, 255, 255, .90) !important;
}

.page-footer .taqeem-footer-top i,
.page-footer .taqeem-footer-rights i {
  color: #67e8f9 !important;
}

@media (max-width: 760px) {
  .header .header-content {
    padding: 12px !important;
  }

  .header .header-top,
  .header .header-content.no-header-top {
    flex-direction: column !important;
    align-items: stretch !important;
    text-align: center !important;
  }

  .header .logo-section,
  .header .logo-area,
  .header .logo-wrap,
  .header .logo-wrap .logo-section {
    justify-content: center !important;
    width: 100% !important;
  }

  .header .title-section,
  .header .title {
    text-align: center !important;
  }

  .header .nav-links,
  .header .portal-actions {
    width: 100% !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    margin-inline-start: 0 !important;
    padding: 2px 1px 5px !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .header .nav-links::-webkit-scrollbar,
  .header .portal-actions::-webkit-scrollbar {
    display: none;
  }

  .header .nav-link,
  .header .theme-toggle,
  .header .portal-install-btn,
  .header #topStatus,
  .header .current-user {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: max-content !important;
    min-height: 46px !important;
    padding: 0 15px !important;
  }

  .page-footer .taqeem-footer-shell {
    width: 100% !important;
    padding: 13px 12px !important;
    border-radius: 18px !important;
  }
}

@media (max-width: 480px) {
  .header .logo {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    flex-basis: 52px !important;
  }

  .header .title-section h1,
  .header .title h1 {
    font-size: 17px !important;
  }

  .header .title-section .subtitle,
  .header .title-section p,
  .header .title .sub,
  .header .title p {
    font-size: 12px !important;
  }

  .header .nav-link,
  .header .theme-toggle,
  .header .portal-install-btn,
  .header #topStatus,
  .header .current-user {
    min-height: 44px !important;
    padding: 0 13px !important;
    font-size: .84rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

body > .box {
  width: min(100% - 28px, 560px);
  margin: auto !important;
  padding: 28px !important;
  border-radius: var(--unified-radius) !important;
  color: var(--unified-text) !important;
  background: var(--unified-surface) !important;
  border: 1px solid var(--unified-line-soft) !important;
  box-shadow: var(--unified-shadow) !important;
  text-align: center;
}

body > .box a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
  text-decoration: none;
  font-weight: 800;
}

.header .header-content.has-header-top > .control-section {
  width: 100%;
  margin: 12px 0 0 !important;
  padding: 12px 14px !important;
  border-radius: 18px !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, .10) !important;
  border: 1px solid rgba(255, 255, 255, .18) !important;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .10) !important;
}

.header .header-content.has-header-top > .control-section :where(label, .control-label, .person-meta-title, .person-meta-value) {
  color: #ffffff !important;
}

.header .header-content.has-header-top > .control-section :where(select, input) {
  color: var(--unified-text) !important;
  background: rgba(255, 255, 255, .94) !important;
}

html[data-theme="dark"] .header .header-content.has-header-top > .control-section :where(select, input) {
  color: #f8fafc !important;
  background: rgba(15, 23, 42, .88) !important;
}

#appView:not(.hidden) {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

@media (max-width: 760px) {
  .header .header-top > .theme-toggle {
    align-self: center !important;
  }

  .header .header-content.has-header-top > .control-section {
    padding: 11px !important;
  }
}
