* {
  box-sizing: border-box;
}

:root {
  --transition-fast: 0.18s ease;
  --transition-medium: 0.32s ease;
  --transition-slow: 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
  --shadow-soft: 0 14px 32px rgba(15, 23, 42, 0.12);
  --shadow-strong: 0 22px 48px rgba(20, 33, 80, 0.22);
  --stagger-step: 0.12s;
  color-scheme: only light;
}

#scroll-indicator {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b5cff 0%, #a855f7 100%);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.2s ease-out;
  z-index: 1100;
  pointer-events: none;
}

body {
  margin: 0;
  font-family: "Tajawal", "Cairo", sans-serif;
  background-color: #f1f5f9;
  /* Islamic-inspired mesh gradient */
  background-image: 
    radial-gradient(at 0% 0%, rgba(20, 184, 166, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(217, 119, 6, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.1) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(99, 102, 241, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: #1e293b;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle geometric pattern overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.4;
  z-index: -1;
  pointer-events: none;
}

body[data-theme="dark"] {
  background: linear-gradient(180deg, #0b1120 0%, #111c34 45%, #050910 100%);
  color: #e2e8f0;
}

body[data-theme="dark"] a {
  color: #93c5fd;
}

.page-loader {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease;
}

.page-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: #fff;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: #60a5fa;
  -webkit-animation: spin 1s linear infinite;
          animation: spin 1s linear infinite;
}

.loader-text {
  font-weight: 600;
  letter-spacing: 0.04em;
}

body::before {
  content: "";
  position: fixed;
  inset: -20vh -10vw auto;
  height: 60vh;
  background: radial-gradient(
    circle at top left,
    rgba(59, 92, 255, 0.22),
    transparent 55%
  );
  transform: translateY(-20px);
  z-index: -2;
  -webkit-animation: floatGlow 12s ease-in-out infinite alternate;
  animation: floatGlow 12s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  bottom: -25vh;
  right: -10vw;
  width: 55vw;
  height: 55vw;
  background: radial-gradient(
    circle at center,
    rgba(111, 76, 255, 0.18),
    transparent 60%
  );
  z-index: -2;
  animation: floatGlow 18s ease-in-out infinite alternate-reverse;
}

body[data-theme="dark"]::before {
  background: radial-gradient(
    circle at top left,
    rgba(59, 92, 255, 0.38),
    transparent 55%
  );
}

body[data-theme="dark"]::after {
  background: radial-gradient(
    circle at center,
    rgba(168, 85, 247, 0.28),
    transparent 60%
  );
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 280px 1fr;
  position: relative;
  z-index: 0;
}

.sidebar {
  background: #fff;
  color: #1e293b;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-inline-end: 1px solid rgba(0,0,0,0.05);
  box-shadow: 4px 0 24px rgba(0,0,0,0.02);
  z-index: 100;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.96);
  z-index: -1;
}

/* Ensure content is above the overlay */
.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar-branding {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  -o-object-fit: cover;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(59, 92, 255, 0.15);
  background: #fff;
  padding: 0.25rem;
  border: 1px solid rgba(0,0,0,0.05);
}

.brand-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #1e293b;
}

.brand-department {
  font-weight: 600;
  color: #334155;
}

.brand-location {
  font-size: 0.85rem;
  color: #64748b;
}

.sidebar .user-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(21, 128, 61, 0.08);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(21, 128, 61, 0.1);
}

.sidebar .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #15803d;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.nav-group-title {
  font-size: 0.8rem;
  color: #64748b;
  letter-spacing: 0.6px;
  font-weight: 600;
  text-transform: uppercase;
}

.sidebar-nav a {
  position: relative;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  transition: background var(--transition-medium),
    transform var(--transition-medium), box-shadow var(--transition-medium);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
}

.sidebar-nav a::before {
  content: "";
  position: absolute;
  inset-inline-start: 0.85rem;
  inset-inline-end: 0.85rem;
  inset-block-end: 0.45rem;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa 0%, #a855f7 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-fast);
  opacity: 0.8;
}

@media (hover: hover) and (pointer: fine) {
  .sidebar-nav a:hover {
    background: rgba(21, 128, 61, 0.08);
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
    color: #15803d;
  }

  .sidebar-nav a:hover::before {
    transform: scaleX(1);
  }
}

.sidebar-nav a:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 4px;
}

.sidebar-nav a.is-active {
  background: rgba(21, 128, 61, 0.12);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
  color: #15803d;
  font-weight: 600;
}

.sidebar-nav a.is-active::before {
  transform: scaleX(1);
}

.sidebar-nav .logout {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: inherit;
  opacity: 0.7;
}

.nav-icon {
  width: 1.4rem;
  text-align: center;
  font-size: 1.05rem;
}

.nav-label {
  flex: 1;
  font-weight: 500;
}

.content {
  padding: 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.topbar h1 {
  margin: 0;
  font-size: 2rem;
}

.department-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.95rem;
  color: rgba(15, 23, 42, 0.65);
  font-weight: 600;
}

.department-name::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b5cff, #60a5fa);
  -webkit-margin-end: 0.4rem;
          margin-inline-end: 0.4rem;
}

.department-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  -webkit-margin-end: 1rem;
          margin-inline-end: 1rem;
}

.department-switcher label {
  font-size: 0.85rem;
  color: rgba(15, 23, 42, 0.58);
  font-weight: 600;
}

.department-switcher select {
  min-width: 180px;
  border-radius: 10px;
  border: 1px solid rgba(59, 92, 255, 0.4);
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
  font-weight: 600;
  transition: border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.department-switcher select:focus {
  outline: none;
  border-color: rgba(59, 92, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

.insights-summary {
  margin-top: 1.5rem;
  gap: 1.2rem;
}

.metric-card {
  padding: 1.4rem 1.2rem;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    rgba(59, 92, 255, 0.12),
    rgba(96, 165, 250, 0.08)
  );
  border: 1px solid rgba(59, 92, 255, 0.15);
  box-shadow: 0 18px 38px rgba(59, 92, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform var(--transition-medium),
    box-shadow var(--transition-medium);
}

.metric-card--accent {
  background: linear-gradient(
    135deg,
    rgba(59, 92, 255, 0.18),
    rgba(14, 116, 144, 0.16)
  );
  border-color: rgba(14, 116, 144, 0.28);
  box-shadow: 0 22px 45px rgba(14, 116, 144, 0.18);
}

.metric-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 26px 60px rgba(59, 92, 255, 0.18);
}

.metric-label {
  font-size: 0.95rem;
  color: rgba(15, 23, 42, 0.7);
  font-weight: 600;
}

.metric-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: #1c1f4a;
  letter-spacing: 0.5px;
}

.metric-trend {
  font-size: 0.85rem;
  color: rgba(15, 23, 42, 0.62);
  font-weight: 600;
}

.metric-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.85rem;
  color: rgba(15, 23, 42, 0.7);
  font-weight: 600;
}

.chart-container {
  margin-top: 2rem;
  height: 320px;
  position: relative;
}

.chart-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 320px;
}

.chart-card-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.insights-chart-grid {
  margin-top: 1.8rem;
  gap: 1.5rem;
}

.chart-card canvas {
  flex: 1;
}

.insights-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.list-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 100%;
}

.data-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.data-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
}

.data-item-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.data-primary {
  font-weight: 700;
  color: #1c1f4a;
}

.data-secondary {
  font-size: 0.85rem;
  color: rgba(15, 23, 42, 0.62);
  font-weight: 600;
}

.data-tertiary {
  font-size: 0.78rem;
  color: rgba(15, 23, 42, 0.5);
}

.data-empty {
  margin: 0;
  padding: 1rem 0 0;
  text-align: center;
  color: rgba(15, 23, 42, 0.55);
  font-weight: 600;
}

.list-footer {
  margin-top: auto;
  padding-top: 0.5rem;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: #3b5cff;
  transition: color var(--transition-fast);
}

.btn-link::after {
  content: "\f061";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.85rem;
}

.btn-link:hover {
  color: #1d4ed8;
}

.badge--warning {
  background: rgba(251, 191, 36, 0.18);
  color: #92400e;
}

.badge--danger {
  background: rgba(248, 113, 113, 0.22);
  color: #991b1b;
}

/* Enhanced UI Components */

/* Grid System Extensions */
.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Glassmorphism Card */
.glass-card {
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
  border-radius: 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(31, 38, 135, 0.12);
  border-color: rgba(255, 255, 255, 0.8);
}

/* Stat Card */
.stat-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon {
  transform: scale(1.1) rotate(5deg);
}

.stat-card .label {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 600;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.2;
}

.stat-card .value.success { color: #10b981; }
.stat-card .value.warning { color: #f59e0b; }
.stat-card .value.alert { color: #ef4444; }
.stat-card .value.info { color: #3b82f6; }

/* Panel */
.panel {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.panel header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #1e293b;
}

.panel .link {
  font-size: 0.9rem;
  color: #4f46e5;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.panel .link:hover {
  color: #4338ca;
  text-decoration: underline;
}

/* List */
.list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  transition: background 0.2s;
}

.list-item:hover {
  background: rgba(255, 255, 255, 0.8);
}

.list-item .meta {
  display: block;
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.2rem;
}

.list-item.empty {
  justify-content: center;
  color: #94a3b8;
  font-style: italic;
  background: transparent;
  border: 1px dashed #cbd5e1;
}

/* Status Badges */
.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-pending { background: #fef3c7; color: #b45309; }
.status-approved { background: #dcfce7; color: #15803d; }
.status-rejected { background: #fee2e2; color: #b91c1c; }

/* Report Snippet */
.report-snippet {
  background: linear-gradient(to right, #f8fafc, #fff);
  padding: 1rem;
  border-radius: 12px;
  border-right: 4px solid #4f46e5;
}

.report-snippet .meta {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.report-snippet p {
  margin: 0;
  color: #334155;
  line-height: 1.6;
}

/* Dark Mode Overrides for New Components */
body[data-theme="dark"] .glass-card {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .glass-card:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}

body[data-theme="dark"] .stat-card .stat-icon {
  background: rgba(255, 255, 255, 0.1);
  color: #a5b4fc;
}

body[data-theme="dark"] .stat-card .label { color: #94a3b8; }
body[data-theme="dark"] .stat-card .value { color: #f1f5f9; }

body[data-theme="dark"] .panel header h2 { color: #f1f5f9; }
body[data-theme="dark"] .panel .link { color: #818cf8; }

body[data-theme="dark"] .list-item {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .list-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .list-item .meta { color: #94a3b8; }
body[data-theme="dark"] .list-item.empty { border-color: #475569; color: #64748b; }

body[data-theme="dark"] .report-snippet {
  background: linear-gradient(to right, #1e293b, #0f172a);
  border-right-color: #6366f1;
}

body[data-theme="dark"] .report-snippet p { color: #cbd5e1; }

.actions {
  display: flex;
  gap: 0.75rem;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.2rem;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast), background var(--transition-fast),
    color var(--transition-fast);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-primary {
  background: linear-gradient(135deg, #3b5cff 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 92, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 6px 16px rgba(59, 92, 255, 0.4);
}

.btn-secondary {
  background: #e8edff;
  color: #2236b6;
}

.btn-outline {
  background: transparent;
  color: #3b5cff;
  border: 1px solid #3b5cff;
}

.btn-danger {
  background: #ff4f6d;
  color: #fff;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:focus-visible {
  outline: 3px solid rgba(96, 165, 250, 0.35);
  outline-offset: 4px;
}

.btn .btn-ripple {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  -webkit-animation: rippleExpand 0.6s ease-out;
          animation: rippleExpand 0.6s ease-out;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  width: 12px;
  height: 12px;
  opacity: 0;
  will-change: transform, opacity;
}

.btn.btn-outline .btn-ripple,
.btn.btn-secondary .btn-ripple {
  background: rgba(59, 92, 255, 0.35);
}

.hero-card {
  background: linear-gradient(
    135deg,
    rgba(59, 92, 255, 0.12),
    rgba(111, 76, 255, 0.08)
  );
  border: 1px solid rgba(59, 92, 255, 0.12);
  border-radius: 22px;
  padding: 2rem;
  box-shadow: 0 18px 40px rgba(59, 92, 255, 0.18);
  transition: transform var(--transition-medium),
    box-shadow var(--transition-medium);
}

@media (hover: hover) and (pointer: fine) {
  .hero-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 28px 60px rgba(59, 92, 255, 0.25);
  }
}

.hero-card h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.hero-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.about-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hero-highlights {
  margin-top: 1rem;
}

.highlight-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(59, 92, 255, 0.08);
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transition: transform var(--transition-medium),
    box-shadow var(--transition-medium);
}

@media (hover: hover) and (pointer: fine) {
  .highlight-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  }
}

.highlight-card h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.flash-messages .alert {
  padding: 1rem 1.2rem;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.alert-success {
  background: #e8fff4;
  color: #1c8756;
}

.alert-danger {
  background: #ffe8ec;
  color: #c12c3e;
}

.alert-warning {
  background: #fff4e0;
  color: #b06a00;
}

.alert-info {
  background: #e8f4ff;
  color: #265d9b;
}

.page-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.site-footer {
  margin-top: 2rem;
  padding: 2rem 0 1rem;
  border-top: 1px solid rgba(59, 92, 255, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.5rem;
  color: #5d6894;
  font-size: 0.9rem;
}

.footer-branding {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.footer-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  -o-object-fit: cover;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.site-footer strong {
  display: block;
  font-size: 1rem;
  color: #1c1f4a;
}

.site-footer .footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.5rem;
}

.brand-logo-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(59, 92, 255, 0.06);
  padding: 1rem;
  border-radius: 14px;
  border: 1px dashed rgba(59, 92, 255, 0.28);
}

.brand-logo-image {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  -o-object-fit: contain;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  padding: 0.45rem;
}

.branding-overview {
  display: grid;
  gap: 0.85rem;
}

.branding-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1rem;
  align-items: center;
}

.branding-row dt {
  font-weight: 600;
  color: #3b5cff;
}

body[data-theme="dark"] .content,
body[data-theme="dark"] .topbar h1 {
  color: #e2e8f0;
}

body[data-theme="dark"] .department-meta {
  color: rgba(226, 232, 240, 0.74);
}

body[data-theme="dark"] .department-switcher label {
  color: rgba(226, 232, 240, 0.72);
}

body[data-theme="dark"] .department-switcher select {
  background: rgba(15, 23, 42, 0.65);
  color: #f8fafc;
  border-color: rgba(96, 165, 250, 0.35);
}

body[data-theme="dark"] .department-switcher select:focus {
  border-color: rgba(96, 165, 250, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .panel,
body[data-theme="dark"] .stats .stat-card,
body[data-theme="dark"] .list li,
body[data-theme="dark"] .list .list-item,
body[data-theme="dark"] .auth-card,
body[data-theme="dark"] .news-grid article,
body[data-theme="dark"] .highlight-card,
body[data-theme="dark"] .hero-card,
body[data-theme="dark"] .brand-logo-preview {
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
  border-color: rgba(148, 163, 255, 0.18);
  box-shadow: 0 20px 42px rgba(2, 6, 23, 0.55);
}

body[data-theme="dark"] .stats .stat-card::after {
  background: linear-gradient(
    135deg,
    rgba(96, 165, 250, 0.22),
    rgba(168, 85, 247, 0.22)
  );
}

body[data-theme="dark"] .stat-card .stat-icon {
  background: rgba(59, 92, 255, 0.32);
  color: #c7d2fe;
}

body[data-theme="dark"] .list .meta,
body[data-theme="dark"] .list .list-item .meta,
body[data-theme="dark"] .site-footer,
body[data-theme="dark"] .site-footer .footer-meta span {
  color: #c7d2fe;
}

body[data-theme="dark"] .branding-row dt {
  color: #a5b4fc;
}

body[data-theme="dark"] .branding-row dd {
  color: #e2e8f0;
}

body[data-theme="dark"] .footer-branding strong {
  color: #f4f7ff;
}

body[data-theme="dark"] .site-footer {
  border-top: 1px solid rgba(148, 163, 255, 0.25);
}

body[data-theme="dark"] .nav-group-title {
  color: rgba(255, 255, 255, 0.65);
}

body[data-theme="dark"] .sidebar-nav a::before {
  background: linear-gradient(90deg, #a855f7 0%, #60a5fa 100%);
}

body[data-theme="dark"] .sidebar-nav a.is-active {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 38px rgba(2, 6, 23, 0.6);
}

body[data-theme="dark"] .flash-messages .alert {
  background: rgba(30, 41, 82, 0.65);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 255, 0.28);
}

body[data-theme="dark"] .flash-messages .alert-success {
  background: rgba(34, 197, 94, 0.18);
  color: #bef264;
}

body[data-theme="dark"] .flash-messages .alert-danger {
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
}

body[data-theme="dark"] .flash-messages .alert-warning {
  background: rgba(251, 191, 36, 0.22);
  color: #fde68a;
}

body[data-theme="dark"] .flash-messages .alert-info {
  background: rgba(56, 189, 248, 0.2);
  color: #bae6fd;
}

body[data-theme="dark"] .btn-secondary {
  background: rgba(148, 163, 255, 0.18);
  color: #c7d2fe;
}

body[data-theme="dark"] .btn-outline {
  color: #c7d2fe;
  border-color: rgba(148, 163, 255, 0.4);
}

body[data-theme="dark"] .table tbody tr:hover {
  background: rgba(59, 92, 255, 0.22);
}

body[data-theme="dark"] .table tbody tr {
  border-bottom-color: rgba(148, 163, 255, 0.25);
}

body[data-theme="dark"] .site-footer .footer-meta {
  color: #dbeafe;
}

/* Danger Zone */
.danger-zone {
  border-color: #ef4444 !important;
  margin-top: 2rem;
  border-width: 1px;
  border-style: solid;
}

.danger-zone h2 {
  color: #ef4444;
}

.danger-actions {
  padding: 1rem;
}

.danger-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.danger-info h3 {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.danger-info p {
  color: var(--color-text-muted, #64748b);
}

body[data-theme="dark"] .danger-info p {
  color: #94a3b8;
}


.theme-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.theme-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--primary-color);
}

body[data-theme="dark"] .theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  margin-top: 0.25rem;
  font-weight: 500;
}

.status-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.available .dot {
  background-color: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.status-indicator.busy .dot {
  background-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.status-indicator.available {
  color: #86efac;
}

.status-indicator.busy {
  color: #fca5a5;
}

.status-switcher {
  display: inline-block;
  -webkit-margin-end: 1rem;
          margin-inline-end: 1rem;
}

.status-select {
  padding: 0.4rem 2rem 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 1rem center;
  background-size: 1rem;
  padding-left: 2.5rem;
}

/* --- Islamic Identity & UI Enhancements --- */

/* Sidebar Arabesque Pattern */
.sidebar {
  background-color: #fff;
  background-image: 
    radial-gradient(rgba(21, 128, 61, 0.15) 1.5px, transparent 1.5px),
    radial-gradient(rgba(21, 128, 61, 0.15) 1.5px, #fff 1.5px);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  position: relative;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.95) 100%);
  z-index: -1;
}
/* Ensure content is above the overlay */
.sidebar > * {
  position: relative;
  z-index: 1;
}

/* Dark mode adjustment for sidebar */
body[data-theme="dark"] .sidebar {
  background-color: #0f172a;
  background-image: 
    radial-gradient(#22c55e 0.5px, transparent 0.5px),
    radial-gradient(#22c55e 0.5px, #0f172a 0.5px);
}
body[data-theme="dark"] .sidebar::before {
  background: rgba(15, 23, 42, 0.96);
}

/* Hijri Date Badge */
.hijri-date-badge {
  display: inline-block;
  font-family: "Tajawal", sans-serif;
  font-size: 0.9rem;
  color: #15803d;
  background: rgba(21, 128, 61, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
}

/* Danger Zone */

/* Missing Utility Classes */
.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));
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 1.5rem;
}

body[data-theme="dark"] .card {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255,255,255,0.1);
  color: #e2e8f0;
}

/* --- Tables & Data --- */
.table-container {
  overflow-x: auto;
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  background: #fff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  text-align: right;
}

.table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 1rem;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background-color: #f8fafc;
}

/* --- Forms & Inputs --- */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #334155;
  font-size: 0.95rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background-color: #fff;
  color: #1e293b;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: #3b5cff;
  box-shadow: 0 0 0 3px rgba(59, 92, 255, 0.15);
}

.form-control::placeholder {
  color: #94a3b8;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 1rem center;
  background-size: 1rem;
  padding-left: 2.5rem;
}

/* --- Dark Mode for Tables & Forms --- */
body[data-theme="dark"] .table-container {
  background: rgba(30, 41, 59, 0.6);
}

body[data-theme="dark"] .table th {
  background: rgba(15, 23, 42, 0.5);
  color: #94a3b8;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .table td {
  border-bottom-color: rgba(255, 255, 255, 0.05);
  color: #e2e8f9;
}

body[data-theme="dark"] .table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

body[data-theme="dark"] .form-label {
  color: #cbd5e1;
}

body[data-theme="dark"] .form-control {
  background-color: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
}

body[data-theme="dark"] .form-control:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

body[data-theme="dark"] .form-control::placeholder {
  color: #64748b;
}

/* --- Settings & Forms --- */
.card-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-toolbar h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  color: #1e293b;
}

.card-meta {
  margin: 0;
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.5;
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 0;
}

.fieldset legend {
  font-weight: 700;
  color: #334155;
  padding: 0 0.5rem;
  font-size: 0.95rem;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.form-check:last-child {
  margin-bottom: 0;
}

.form-check input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.15rem;
  accent-color: #3b5cff;
  cursor: pointer;
}

.form-check-label {
  font-weight: 500;
  color: #1e293b;
  cursor: pointer;
  line-height: 1.5;
}

.hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #64748b;
}

.dataset-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dataset-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.branding-overview {
  display: grid;
  gap: 1rem;
}

.branding-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.branding-row:last-child {
  border-bottom: none;
}

.branding-row dt {
  font-weight: 600;
  color: #64748b;
}

.branding-row dd {
  margin: 0;
  color: #1e293b;
  font-weight: 500;
}

.brand-logo-preview {
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
  text-align: center;
  margin-top: 1rem;
}

.brand-logo-image {
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
  margin-bottom: 1rem;
}

/* Dark Mode for Settings */
body[data-theme="dark"] .card-toolbar h2 { color: #f1f5f9; }
body[data-theme="dark"] .card-meta { color: #94a3b8; }
body[data-theme="dark"] .fieldset { border-color: rgba(255,255,255,0.1); }
body[data-theme="dark"] .fieldset legend { color: #cbd5e1; }
body[data-theme="dark"] .form-check-label { color: #e2e8f0; }
body[data-theme="dark"] .hint { color: #94a3b8; }
body[data-theme="dark"] .dataset-item {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}
body[data-theme="dark"] .branding-row { border-bottom-color: rgba(255,255,255,0.1); }
body[data-theme="dark"] .branding-row dt { color: #94a3b8; }
body[data-theme="dark"] .branding-row dd { color: #f1f5f9; }
body[data-theme="dark"] .brand-logo-preview {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.15);
}

/* --- Skeleton Loading --- */
.skeleton {
  background: #e2e8f0;
  background: linear-gradient(
    90deg,
    #e2e8f0 25%,
    #f1f5f9 37%,
    #e2e8f0 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: 6px;
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

body[data-theme="dark"] .skeleton {
  background: #1e293b;
  background: linear-gradient(
    90deg,
    #1e293b 25%,
    #334155 37%,
    #1e293b 63%
  );
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.breadcrumbs a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumbs a:hover {
  color: #3b5cff;
}

.breadcrumbs .separator {
  color: #cbd5e1;
  font-size: 0.7rem;
}

.breadcrumbs .current {
  color: #1e293b;
  font-weight: 500;
}

body[data-theme="dark"] .breadcrumbs { color: #94a3b8; }
body[data-theme="dark"] .breadcrumbs .separator { color: #475569; }
body[data-theme="dark"] .breadcrumbs .current { color: #e2e8f0; }

/* --- Global Search --- */
.global-search-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin-inline-start: auto; /* Push to left in RTL */
}

.global-search-input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.global-search-input:focus {
  background: #fff;
  border-color: #3b5cff;
  box-shadow: 0 0 0 3px rgba(59, 92, 255, 0.1);
  outline: none;
}

.global-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  display: none; /* Hidden by default */
}

.search-results.active {
  display: block;
  animation: slideDown 0.2s ease-out;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: #1e293b;
  transition: background 0.15s;
  border-bottom: 1px solid #f1f5f9;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f8fafc;
}

.search-result-item i {
  color: #64748b;
  font-size: 0.9rem;
}

body[data-theme="dark"] .global-search-input {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

body[data-theme="dark"] .global-search-input:focus {
  background: #1e293b;
  border-color: #6366f1;
}

body[data-theme="dark"] .search-results {
  background: #1e293b;
  border-color: #334155;
}

body[data-theme="dark"] .search-result-item {
  color: #e2e8f0;
  border-bottom-color: #334155;
}

body[data-theme="dark"] .search-result-item:hover {
  background: #334155;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.qr-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
