/* Unified panel theme: keeps functionality intact while aligning colors, spacing, and card styling across roles */
:root {
  --primary-gradient: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #3b82f6;
  --text-light: #94a3b8;
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --border-radius: 12px;
  --primary-color: #667eea;
  --primary-color: #5b67e8;
  --secondary-color: #764ba2;
  --bg-primary: #f5f7fb;
  --bg-secondary: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border-color: #e5e7eb;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.06);
  --shadow-card: 0 6px 18px rgba(15, 23, 42, 0.05);
  --sidebar-width: 260px;
  --header-height: 66px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --radius-sm: 10px;
  --surface-muted: #f8fafc;
  --surface-soft: #eef2ff;
  --border-strong: #cbd5e1;
  --shadow-xl: 0 22px 50px rgba(15, 23, 42, 0.16);
  --focus-ring: 0 0 0 4px rgba(91, 103, 232, 0.14);
  --motion-fast: 0.18s ease;
  --motion-normal: 0.24s ease;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family:
    "Inter",
    "Segoe UI",
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    sans-serif;
  line-height: 1.5;
}

.dashboard-container {
  background: var(--bg-primary);
}

.top-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 28px;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 80;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(6px);
}

.top-header .logo-shield,
.sidebar .logo-shield {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: #ffffff;
  border-radius: 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(102, 126, 234, 0.25);
}

.top-header .logo-shield {
  width: 44px;
  height: 40px;
}

.sidebar .logo-shield {
  width: 56px;
  height: 50px;
}

.header-logo-text,
.logo-text,
.page-title {
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-header .user-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
}

.top-header .notification-icon,
.top-header .user-action-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
  cursor: pointer;
}

.top-header .notification-icon:hover,
.top-header .user-action-btn:hover {
  background: rgba(102, 126, 234, 0.12);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.top-header .notification-icon i,
.top-header .user-action-btn i {
  font-size: 17px;
}

.top-header .notification-badge,
.top-header .notification-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  padding: 0;
  border-radius: 999px;
  background: #ef4444;
  border: 2px solid #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  line-height: 1;
}

.top-header .notification-badge {
  min-width: 18px;
  height: 18px;
  padding: 0;
  font-size: 9px;
}

.top-header .notification-dot {
  width: 10px;
  height: 10px;
}

.top-header .user-profile {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.top-header .user-profile i {
  color: var(--primary-color);
  font-size: 18px;
}

.top-header .user-profile:hover {
  border-color: #d8dee8;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.main-wrapper {
  margin-top: 0;
}

.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  box-shadow: 2px 0 16px rgba(15, 23, 42, 0.04);
}

.sidebar-nav {
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-secondary);
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--primary-color);
}

.nav-link.active {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(102, 126, 234, 0.28);
}

.nav-link.logout {
  color: #e11d48;
}

.nav-link.logout:hover {
  background: rgba(225, 29, 72, 0.1);
  color: #be123c;
}

.main-content {
  background: var(--bg-primary);
}

.content-view {
  animation: fadeIn 0.25s ease;
}

.overview-cards,
.summary-cards {
  gap: 18px;
}

.overview-card,
.summary-card,
.admin-section,
.section-card,
.status-section,
.panel-card,
.card-panel,
.table-card,
.form-card,
.questionnaire-form-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.overview-card,
.summary-card {
  padding: 22px;
}

.card-icon {
  width: 56px;
  height: 50px;
  border-radius: 12px;
  background: rgba(102, 126, 234, 0.14);
  color: var(--primary-color);
}

.card-number {
  color: var(--text-primary);
}

.badge,
.role-badge,
.status-label {
  border-radius: 999px;
  font-weight: 700;
}

.table thead th {
  background: #f8fafc;
  color: var(--text-secondary);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.35);
  border-radius: 999px;
  border: 2px solid #eef2ff;
}

::-webkit-scrollbar-track {
  background: #f8fafc;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Layout / Zoom Adjustments */
/* Fluid grids that automatically wrap based on available width, eliminating the need for exact media queries for grids */
.overview-cards,
.summary-cards {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
}

.quick-actions-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
}

.dashboard-grid,
.charts-section,
.charts-grid,
.profile-grid-wide {
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)) !important;
}

/* For extremely narrow containers, allow shrinking further */
@media screen and (max-width: 600px) {
  .dashboard-grid,
  .charts-section,
  .charts-grid,
  .profile-grid-wide {
    grid-template-columns: 1fr !important;
  }
}

@media screen and (max-width: 1000px) {
  /* Collapse Sidebar */
  :root {
    --sidebar-width: 80px;
  }
  .sidebar {
    width: var(--sidebar-width) !important;
  }
  .main-content {
    margin-left: var(--sidebar-width) !important;
  }
  .logo-text,
  .nav-link span {
    display: none !important;
  }
  .sidebar-header {
    padding: 24px 10px !important;
    justify-content: center;
  }
  .nav-link {
    justify-content: center;
    padding: 14px 0 !important;
  }
  .nav-link i {
    margin: 0 !important;
    font-size: 17px !important;
  }
  .top-header {
    padding: 12px 16px;
  }
  .welcome-banner {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 24px 20px !important;
  }
  .welcome-icon {
    display: none;
  }
  .user-filters,
  .um-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 15px;
  }
  .btn-add-user,
  .btn-user-search,
  .btn-add-professor {
    width: 100%;
    justify-content: center;
    margin-left: 0 !important;
  }
  .filter-group {
    flex-direction: column;
    align-items: stretch;
  }
  .stats-summary {
    flex-direction: column;
    gap: 12px;
  }
}

@media screen and (max-width: 600px) {
  .main-content {
    padding: 16px !important;
  }
  .overview-card,
  .admin-section,
  .form-card {
    padding: 16px !important;
  }
}

.app-loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    visibility 0.18s ease;
  z-index: 5000;
}

.app-loading-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.app-loading-overlay-card {
  min-width: min(90vw, 320px);
  max-width: min(90vw, 420px);
  background: #ffffff;
  border: 1px solid #dbe5ff;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.app-loading-overlay-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary-color, #5b67e8);
  animation: appLoadingOverlaySpin 0.9s linear infinite;
}

.app-loading-overlay-text {
  margin: 0;
  color: #0f172a;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.45;
}

@keyframes appLoadingOverlaySpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.ui-message {
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
}

.ui-message--error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.ui-message--success {
  background: #ecfdf5;
  color: #166534;
  border-color: #bbf7d0;
}

.ui-message--info {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.ui-message--muted {
  background: #f8fafc;
  color: #475569;
  border-color: #e2e8f0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

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

  .content-view,
  .dropdown-panel.active,
  .login-button::before,
  .app-loading-overlay,
  .app-loading-overlay-card,
  .app-loading-overlay-spinner {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}
