/* Accessibility & UX polish — CLSU SecureID */

/* Skip link */
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 10000;
  padding: 10px 16px;
  background: var(--accent-600, #1d4ed8);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 12px;
  outline: 3px solid #fef08a;
  outline-offset: 2px;
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Visible focus for keyboard users */
:focus {
  outline: none;
}
:focus-visible {
  outline: 3px solid var(--accent-600, #16a34a);
  outline-offset: 2px;
}
.icon-btn:focus-visible,
.nav-item:focus-visible,
.auth-tab:focus-visible,
.admin-status-card:focus-visible {
  outline-offset: 3px;
}

/* Respect reduced motion */
@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;
  }
  .admin-live-indicator::before {
    animation: none;
  }
  .sidebar {
    transition: none;
  }
}

/* Inert background when modal open — lock page scroll behind modal */
body.modal-open {
  overflow: hidden;
}
body.modal-open .app,
body.modal-open #auth {
  pointer-events: none;
  user-select: none;
}
body.modal-open .modal {
  pointer-events: auto;
}
/* Notification Center remains usable above open modals when needed */
body.modal-open #notificationCenter,
body.modal-open #notificationPanel,
body.modal-open #notificationBackdrop {
  pointer-events: auto;
}

/* Toast live region */
#toast-container {
  pointer-events: none;
}
#toast-container .toast {
  pointer-events: auto;
}

/* Loading state */
body.app-loading .app {
  opacity: 0.6;
  pointer-events: none;
}
body.app-loading::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(255, 255, 255, 0.4);
  cursor: wait;
}

/* Empty / status messages */
.empty-state-banner {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 12px;
  margin: 12px 0;
}
.empty-state-banner strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  margin-bottom: 8px;
}

/* Auth tabs — tab pattern */
.auth-tabs [role="tab"][aria-selected="true"] {
  background: var(--highlight-light, #fef9c3);
  color: var(--highlight-dark, #854d0e);
  border-color: var(--highlight-border, #fde047);
}

/* View toggle pressed state */
.view-toggle .icon-btn[aria-pressed="true"] {
  background: var(--accent-light, #dcfce7);
  border-color: var(--accent-border, #86efac);
  color: var(--accent-600, #16a34a);
}

/* High-contrast mode support */
@media (forced-colors: active) {
  .icon-btn,
  .primary-btn,
  .nav-item.active {
    border: 2px solid ButtonText;
  }
}

/* Touch targets — nav & auth on mobile */
@media (max-width: 768px) {
  .nav-item {
    min-height: 44px;
    padding: 12px;
  }
  .auth-tab {
    min-height: 44px;
  }
  .admin-status-save {
    min-height: 44px;
  }
  .bottom-nav-item {
    min-height: 48px;
    min-width: 48px;
  }
  .topbar-search-toggle {
    min-width: 44px;
    min-height: 44px;
  }
}
