/* Page Enhancements - Modern UI/UX Design System */
/* Responsive, accessible, and touch-friendly across mobile, tablet, desktop */

/* ===== Page Hero / Header Cards ===== */
.page-hero {
  background: linear-gradient(135deg, var(--role-primary, #800020) 0%, var(--role-secondary, #A00030) 50%, var(--role-accent, #5C0014) 100%);
  border-radius: 1.25rem;
  box-shadow: 0 20px 40px -15px rgba(128, 0, 32, 0.35);
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

.page-hero-icon {
  width: 3rem;
  height: 3rem;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(12px);
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

@media (min-width: 640px) {
  .page-hero-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 1.25rem;
  }
}

/* ===== Modern Card Styles ===== */
.modern-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 1rem;
  box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .modern-card {
  background: rgba(31, 41, 55, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.3);
}

.modern-card:hover {
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.12);
  transform: none;
}

.dark .modern-card:hover {
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.35);
}

/* ===== Responsive Table Wrapper ===== */
.table-responsive-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -1rem;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .table-responsive-wrapper {
    margin: 0;
    padding: 0;
  }
}

.table-responsive-wrapper table {
  min-width: 600px;
}

@media (min-width: 768px) {
  .table-responsive-wrapper table {
    min-width: 100%;
  }
}

/* ===== Touch-friendly Buttons ===== */
.touch-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0.75rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Form Input Enhancements ===== */
.modern-input {
  border-radius: 0.75rem;
  border: 2px solid rgba(0, 0, 0, 0.08);
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
}

.modern-input:focus {
  border-color: var(--role-primary, #800020);
  box-shadow: 0 0 0 4px rgba(128, 0, 32, 0.15);
  outline: none;
}

@media (max-width: 768px) {
  .modern-input, .modern-input input, .modern-input select {
    font-size: 16px !important; /* Prevents iOS zoom */
  }
}

/* ===== Stats/KPI Cards ===== */
.stat-card {
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 640px) {
  .stat-card {
    padding: 1.25rem 1.5rem;
  }
}

.stat-card:hover {
  transform: none;
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.1);
}

/* ===== Section Headers ===== */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid rgba(0, 0, 0, 0.06);
}

.dark .section-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.section-header-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 640px) {
  .section-header-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
  }
}

/* ===== Mobile-First Grid ===== */
.responsive-grid-1 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .responsive-grid-1 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .responsive-grid-1 {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
  }
}

.responsive-grid-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .responsive-grid-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .responsive-grid-2 {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

/* ===== Empty States ===== */
.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
}

@media (min-width: 640px) {
  .empty-state {
    padding: 4rem 2rem;
  }
}

.empty-state-icon {
  width: 5rem;
  height: 5rem;
  border-radius: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.02) 100%);
}

.dark .empty-state-icon {
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.03) 100%);
}

/* ===== Badge/Pill Styles ===== */
.modern-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

@media (min-width: 640px) {
  .modern-badge {
    font-size: 0.8125rem;
    padding: 0.375rem 0.875rem;
  }
}

/* ===== Smooth Page Transitions ===== */
@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-content {
  animation: pageFadeIn 0.4s ease-out;
}

/* ===== Mobile Table Card Fallback ===== */
.mobile-table-card {
  display: block;
  border-radius: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.dark .mobile-table-card {
  border-color: rgba(255, 255, 255, 0.08);
}

@media (min-width: 768px) {
  .mobile-table-card {
    display: none;
  }
}

/* ===== Action Button Group ===== */
.action-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.action-btn-group .touch-btn {
  min-width: 36px;
  min-height: 36px;
  padding: 0.5rem;
}

@media (min-width: 640px) {
  .action-btn-group .touch-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ===== Level/Class Header Card ===== */
.level-header-card {
  background: linear-gradient(135deg, var(--role-primary, #800020) 0%, var(--role-secondary, #A00030) 100%);
  color: white;
  padding: 1rem 1.25rem;
  border-radius: 1rem 1rem 0 0;
}

@media (min-width: 640px) {
  .level-header-card {
    padding: 1.25rem 1.5rem;
  }
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .filter-bar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
  }
}

/* ===== Staff Management Directory ===== */
.staff-directory-overview .staff-mini-stat {
  padding: 0.875rem 1rem;
  min-height: 4.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
}

.dark .staff-directory-overview .staff-mini-stat {
  background: rgba(31, 41, 55, 0.5);
}

.staff-mini-stat__label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(107 114 128);
}

.dark .staff-mini-stat__label {
  color: rgb(156 163 175);
}

.staff-mini-stat__value {
  font-size: 1.375rem;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 0.125rem;
}

.staff-directory-card {
  border-radius: 1rem;
  overflow: hidden;
}

.staff-directory-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.staff-directory-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(249, 250, 251, 0.98);
  backdrop-filter: blur(8px);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(107 114 128);
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  white-space: nowrap;
}

.dark .staff-directory-table thead th {
  background: rgba(17, 24, 39, 0.98);
  color: rgb(156 163 175);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.staff-directory-table tbody tr {
  transition: background-color 0.15s ease;
}

.staff-directory-table tbody tr:hover {
  background: rgba(128, 0, 32, 0.03);
}

.dark .staff-directory-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.staff-directory-table tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  vertical-align: middle;
}

.dark .staff-directory-table tbody td {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

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

.staff-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--role-primary, #800020), var(--role-secondary, #A00030));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px -2px rgba(128, 0, 32, 0.35);
}

@media (min-width: 640px) {
  .staff-avatar {
    width: 2.75rem;
    height: 2.75rem;
  }
}

.staff-mobile-card {
  border-radius: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.98);
  padding: 1rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.dark .staff-mobile-card {
  background: rgba(31, 41, 55, 0.98);
  border-color: rgba(255, 255, 255, 0.08);
}

.staff-mobile-card:hover {
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.12);
}

.staff-toolbar-search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.staff-toolbar-search i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgb(156 163 175);
  pointer-events: none;
}

.staff-toolbar-search input {
  width: 100%;
  padding: 0.625rem 1rem 0.625rem 2.5rem;
  border-radius: 0.75rem;
  border: 2px solid rgba(0, 0, 0, 0.08);
  background: white;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dark .staff-toolbar-search input {
  background: rgb(55 65 81);
  border-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.staff-toolbar-search input:focus {
  outline: none;
  border-color: var(--role-primary, #800020);
  box-shadow: 0 0 0 3px rgba(128, 0, 32, 0.12);
}

.staff-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.staff-status-pill::before {
  content: '';
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 9999px;
  background: currentColor;
  opacity: 0.85;
}

.staff-action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  transition: background-color 0.15s, color 0.15s;
}

.staff-action-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.dark .staff-action-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.staff-modal-panel {
  border-radius: 1rem;
  max-height: min(92vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (min-width: 640px) {
  .staff-modal-panel {
    border-radius: 1.25rem;
  }
}

.staff-modal-body {
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.staff-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 2px solid transparent;
  background: rgba(0, 0, 0, 0.04);
  color: rgb(75 85 99);
  transition: all 0.15s ease;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.dark .staff-filter-chip {
  background: rgba(255, 255, 255, 0.06);
  color: rgb(209 213 219);
}

.staff-filter-chip:hover {
  background: rgba(128, 0, 32, 0.08);
  color: var(--role-primary, #800020);
}

.staff-filter-chip--active {
  background: var(--role-primary, #800020);
  color: white;
  border-color: var(--role-primary, #800020);
}

.dark .staff-filter-chip--active {
  background: var(--role-primary, #800020);
  color: white;
}

.staff-mobile-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.875rem;
}

@media (min-width: 360px) {
  .staff-mobile-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dark .staff-mobile-meta {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.staff-mobile-meta dt {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(107 114 128);
}

.dark .staff-mobile-meta dt {
  color: rgb(156 163 175);
}

.staff-mobile-meta dd {
  margin-top: 0.125rem;
  font-weight: 600;
  color: rgb(31 41 55);
  word-break: break-word;
}

.dark .staff-mobile-meta dd {
  color: rgb(229 231 235);
}

.staff-mobile-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.staff-mobile-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 3.25rem;
  padding: 0.5rem 0.25rem;
  border-radius: 0.75rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: transform 0.15s ease, background-color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.staff-mobile-action:active:not(.staff-mobile-action--disabled) {
  transform: scale(0.98);
}

.staff-mobile-action--edit {
  color: rgb(37 99 235);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.dark .staff-mobile-action--edit {
  color: rgb(96 165 250);
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
}

.staff-mobile-action--delete {
  color: rgb(220 38 38);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.dark .staff-mobile-action--delete {
  color: rgb(248 113 113);
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
}

.staff-mobile-action--suspend {
  color: rgb(107 114 128);
  background: rgba(107, 114, 128, 0.08);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.staff-mobile-action--suspend-active {
  color: rgb(220 38 38);
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

.staff-mobile-action--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: rgb(156 163 175);
  background: rgba(156, 163, 175, 0.08);
  border: 1px solid rgba(156, 163, 175, 0.2);
}

@media (min-width: 640px) {
  .staff-directory-overview .staff-mini-stat {
    padding: 1rem 1.125rem;
  }

  .staff-mini-stat__value {
    font-size: 1.5rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .staff-directory-table thead th,
  .staff-directory-table tbody td {
    padding: 0.75rem 0.625rem;
    font-size: 0.8125rem;
  }

  .staff-action-icon-btn {
    width: 2rem;
    height: 2rem;
  }
}
