/* Admin Tournament Management Neon Theme (scoped to body.admin-tournaments-page) */
body.admin-tournaments-page {
  --bg: #050505;
  --neon: #39FF14;
  --accent: #00FF7F;
  --accent-gradient: linear-gradient(90deg, #00FF7F 0%, #39FF14 60%, #00FFBF 100%);
  --warning: #FF8A00;
  --error: #FF3B3B;
  --card-radius: 14px;
  --border-subtle: rgba(57, 255, 20, 0.06);
  --text-heading: #FFFFFF;
  --text-meta: #A6A6A6;
  background: var(--bg);
  color: var(--text-heading);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: hidden;
  touch-action: manipulation;
}

/* Page Header */
.page-header {
  background: linear-gradient(135deg, #0A0A0A, #050505) !important;
  color: var(--text-heading) !important;
  padding: 2rem 0;
  position: relative;
  border-bottom: 1px solid rgba(57, 255, 20, 0.1);
  transform: translateZ(0);
}

.page-header h1 {
  color: var(--text-heading);
  text-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
  font-weight: 800;
  position: relative;
  display: inline-block;
}

.page-header h1::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--neon), var(--accent));
  border-radius: 2px;
  box-shadow: 0 0 10px var(--neon);
}

.page-header .lead {
  color: var(--text-meta);
  font-weight: 500;
}

/* Admin Card Base */
.admin-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  border-radius: var(--card-radius);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 6px 18px rgba(57, 255, 20, 0.04);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  transform: translateZ(0);
  will-change: transform, box-shadow;
  margin-bottom: 1.5rem;
}

.admin-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(57, 255, 20, 0.08);
}

.admin-card .card-header {
  background: rgba(57, 255, 20, 0.05);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 1.5rem;
}

.admin-card .card-title {
  color: var(--neon);
  font-weight: 700;
  margin: 0;
  text-shadow: 0 0 5px rgba(57, 255, 20, 0.3);
}

.admin-card .card-body {
  padding: 1.5rem;
}

/* Tournament List Table */
.tournament-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--card-radius);
  overflow: hidden;
}

.tournament-table thead {
  background: rgba(57, 255, 20, 0.1);
}

.tournament-table th {
  padding: 1rem;
  text-align: left;
  color: var(--neon);
  font-weight: 600;
  border-bottom: 1px solid rgba(57, 255, 20, 0.2);
  text-shadow: 0 0 5px rgba(57, 255, 20, 0.3);
}

.tournament-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(57, 255, 20, 0.05);
  color: var(--text-heading);
}

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

.tournament-table tr:hover {
  background: rgba(57, 255, 20, 0.05);
  box-shadow: inset 0 0 10px rgba(57, 255, 20, 0.1);
  transform: translateZ(0);
}

.tournament-table tr.live-row {
  border-left: 3px solid var(--neon);
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 5px rgba(57, 255, 20, 0.3); }
  50% { box-shadow: 0 0 15px rgba(57, 255, 20, 0.6); }
  100% { box-shadow: 0 0 5px rgba(57, 255, 20, 0.3); }
}

/* Status Badges */
.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-block;
}

.status-badge.upcoming {
  background: rgba(255, 138, 0, 0.15);
  color: #FF8A00;
  border: 1px solid rgba(255, 138, 0, 0.3);
}

.status-badge.ongoing {
  background: rgba(57, 255, 20, 0.15);
  color: #39FF14;
  border: 1px solid rgba(57, 255, 20, 0.3);
  box-shadow: 0 0 5px rgba(57, 255, 20, 0.2);
}

.status-badge.completed {
  background: rgba(166, 166, 166, 0.15);
  color: #A6A6A6;
  border: 1px solid rgba(166, 166, 166, 0.3);
}

/* Action Buttons */
.action-btn {
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  transform: translateZ(0);
  will-change: transform;
  border: 1px solid rgba(57, 255, 20, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--neon);
  margin: 0.1rem;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.3);
  background: rgba(57, 255, 20, 0.1);
  border-color: var(--neon);
}

.action-btn:focus {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.3);
}

.action-btn i {
  font-size: 0.9rem;
}

.action-btn-primary {
  background: var(--accent-gradient);
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  font-weight: 600;
  transition: transform 0.12s ease;
  color: #000 !important;
  border: none;
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.4);
}

.action-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(57, 255, 20, 0.6);
}

.action-btn-primary:focus:not(:disabled) {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.3), 0 0 15px rgba(57, 255, 20, 0.6);
}

.action-btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.action-btn-danger {
  background: linear-gradient(90deg, #FF6B6B, #FF3B3B);
  color: #000 !important;
  border: none;
  box-shadow: 0 0 10px rgba(255, 59, 59, 0.4);
}

.action-btn-danger:hover {
  box-shadow: 0 0 15px rgba(255, 59, 59, 0.6);
}

.action-btn-danger:focus {
  outline: 2px solid var(--error);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(255, 59, 59, 0.3);
}

/* Form Elements */
.form-control, .form-select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(57, 255, 20, 0.25);
  color: var(--text-heading);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 0 5px rgba(57, 255, 20, 0.1);
  height: auto;
  min-height: 44px;
}

.form-control:focus, .form-select:focus {
  background: rgba(0, 0, 0, 0.4);
  border-color: var(--neon);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
  outline: 2px solid var(--neon);
  outline-offset: 2px;
  color: var(--text-heading);
}

.form-label {
  color: var(--text-heading);
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.form-check-input {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.15);
}

.form-check-input:checked {
  background-color: var(--neon);
  border-color: var(--neon);
  box-shadow: 0 0 0 0.25rem rgba(57, 255, 20, 0.2);
}

.form-check-input:focus {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
  box-shadow: 0 0 0 0.25rem rgba(57, 255, 20, 0.2);
}

/* Filter Bar */
.filter-bar {
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(57, 255, 20, 0.1);
  padding: 1rem 0;
  z-index: 100;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-pill {
  background: transparent;
  border: 1px solid rgba(57, 255, 20, 0.3);
  color: var(--neon);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-pill:hover {
  background: rgba(57, 255, 20, 0.1);
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.2);
}

.filter-pill:focus {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.3);
}

.filter-pill.active {
  background: var(--accent-gradient);
  color: #000;
  border-color: var(--neon);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.4);
}

/* Quick Stats */
.stats-item {
  padding: 1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(57, 255, 20, 0.1);
  margin-bottom: 1rem;
}

.stats-item .fw-bold.success {
  color: var(--neon);
}

.stats-item .fw-bold.warning {
  color: var(--warning);
}

.stats-item .fw-bold.secondary {
  color: var(--text-meta);
}

/* Modals */
.modal-content {
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.95), rgba(10, 10, 10, 0.85));
  color: var(--text-heading);
  border: 1px solid rgba(57, 255, 20, 0.2);
  border-radius: 15px;
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.3);
}

.modal-header {
  border-bottom: 1px solid rgba(57, 255, 20, 0.2);
  background: rgba(57, 255, 20, 0.05);
}

.modal-footer {
  border-top: 1px solid rgba(57, 255, 20, 0.2);
  background: rgba(57, 255, 20, 0.05);
}

.modal-content .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.modal-content .btn-close:focus {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.3);
}

/* Confirm Modal */
.confirm-modal {
  border-left: 4px solid rgba(255, 138, 0, 0.18);
}

/* Tabs */
.nav-tabs {
  border-bottom: 1px solid rgba(57, 255, 20, 0.1);
  margin-bottom: 1rem;
}

.nav-tabs .nav-link {
  color: var(--text-meta);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 1.5rem;
  transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
  color: var(--neon);
  border-color: rgba(57, 255, 20, 0.3);
}

.nav-tabs .nav-link:focus {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.3);
}

.nav-tabs .nav-link.active {
  color: var(--neon);
  background: transparent;
  border-bottom: 2px solid var(--neon);
  text-shadow: 0 0 5px rgba(57, 255, 20, 0.3);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1050;
}

.toast {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
  transform: translateX(150%);
  transition: transform 0.3s ease;
  min-width: 300px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  border-left: 4px solid var(--neon);
  box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
}

.toast-success i {
  color: var(--neon);
}

.toast-error {
  border-left: 4px solid var(--error);
  box-shadow: 0 0 15px rgba(255, 59, 59, 0.3);
}

.toast-error i {
  color: var(--error);
}

.toast-warning {
  border-left: 4px solid var(--warning);
  box-shadow: 0 0 15px rgba(255, 138, 0, 0.3);
}

.toast-warning i {
  color: var(--warning);
}

.toast-text {
  color: var(--text-heading);
  font-weight: 500;
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--neon);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fadeInUp {
  animation: fadeInUp 0.3s ease forwards;
}

/* Responsive Design */
@media (max-width: 768px) {
  .page-header {
    padding: 1.5rem 0;
  }
  
  .page-header h1 {
    font-size: 1.8rem;
  }
  
  .admin-card {
    margin-bottom: 1rem;
  }
  
  .admin-card .card-body {
    padding: 1rem;
  }
  
  .tournament-table th,
  .tournament-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }
  
  .action-btn {
    min-width: 32px;
    min-height: 32px;
    padding: 0.25rem;
    margin: 0.05rem;
  }
  
  .filter-bar {
    padding: 0.75rem 0;
  }
  
  .filter-pill {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    min-height: 36px;
  }
  
  /* Mobile card view for tournaments */
  .tournament-mobile-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border-radius: var(--card-radius);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 6px 18px rgba(57, 255, 20, 0.04);
    padding: 1rem;
    margin-bottom: 1rem;
    display: none;
  }
  
  .tournament-mobile-card.visible {
    display: block;
  }
  
  .tournament-mobile-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
  }
  
  .tournament-mobile-card .card-title {
    font-weight: 600;
    margin: 0;
    color: var(--neon);
  }
  
  .tournament-mobile-card .status-badge {
    font-size: 0.75rem;
  }
  
  .tournament-mobile-card .card-body {
    padding: 0;
  }
  
  .tournament-mobile-card .info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
  }
  
  .tournament-mobile-card .info-label {
    color: var(--text-meta);
  }
  
  .tournament-mobile-card .info-value {
    font-weight: 500;
  }
  
  .tournament-mobile-card .action-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
  }
  
  /* Reduce animations on mobile */
  .admin-card,
  .action-btn,
  .filter-pill {
    transition: none !important;
    transform: none !important;
  }
  
  .admin-card:hover,
  .action-btn:hover,
  .filter-pill:hover {
    transform: none !important;
  }
}

@media (max-width: 480px) {
  .page-header h1 {
    font-size: 1.5rem;
  }
  
  .tournament-table {
    font-size: 0.85rem;
  }
  
  .tournament-table th,
  .tournament-table td {
    padding: 0.5rem 0.25rem;
  }
  
  .status-badge {
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .toast {
    min-width: 250px;
    right: 10px;
    left: 10px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .pulseGlow,
  .fadeInUp {
    animation: none !important;
  }
  
  .admin-card,
  .action-btn,
  .filter-pill {
    transition: none !important;
  }
  
  .admin-card:hover,
  .action-btn:hover,
  .filter-pill:hover {
    transform: none !important;
  }
}

/* Focus Styles for Accessibility */
.form-control:focus,
.form-select:focus,
.action-btn:focus,
.filter-pill:focus {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  body.admin-tournaments-page {
    --border-subtle: rgba(57, 255, 20, 0.5);
  }
  
  .admin-card,
  .form-control,
  .form-select {
    border: 2px solid var(--neon);
  }
  
  .action-btn:focus,
  .filter-pill:focus,
  .form-control:focus,
  .form-select:focus {
    outline: 3px solid var(--neon);
    outline-offset: 3px;
  }
}

/* Performance optimizations using GPU-accelerated animations */
.admin-card,
.action-btn,
.filter-pill,
.status-badge,
.toast {
  transform: translateZ(0);
  will-change: transform;
}

/* Use transform and opacity for animations (GPU-friendly) */
.admin-card:hover,
.action-btn:hover,
.filter-pill:hover {
  will-change: transform;
}

/* Defer heavy assets and use low-res placeholders */
img.lazy-load {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  transition: opacity 0.3s ease;
  opacity: 0;
}

img.lazy-load.loaded {
  opacity: 1;
  background: transparent;
  border: none;
}

img.lazy-load.error {
  background: rgba(255, 0, 0, 0.1);
  border: 1px solid var(--error);
}

/* Limit will-change usage to few elements */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

/* Tournament Mobile View Toggle */
@media (max-width: 768px) {
  .tournament-table-container {
    display: block;
  }
  
  .tournament-table-container.table-view {
    display: block;
  }
  
  .tournament-table-container.card-view {
    display: none;
  }
  
  .tournament-table-container.card-view .tournament-mobile-card {
    display: block;
  }
  
  .tournament-table-container.table-view .tournament-table {
    display: table;
  }
  
  .view-toggle {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
  }
  
  .view-toggle-btn {
    background: rgba(57, 255, 20, 0.1);
    border: 1px solid rgba(57, 255, 20, 0.3);
    color: var(--neon);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px; /* Tappable target size */
  }
  
  .view-toggle-btn:hover {
    background: rgba(57, 255, 20, 0.1);
    box-shadow: 0 0 8px rgba(57, 255, 20, 0.2);
  }
  
  .view-toggle-btn:focus {
    outline: 2px solid var(--neon);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.3);
  }
  
  .view-toggle-btn.active {
    background: var(--accent-gradient);
    color: #000;
    border-color: var(--neon);
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.4);
  }
}

/* Image loading states */
.image-placeholder {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  position: relative;
  overflow: hidden;
}

.image-placeholder::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(57, 255, 20, 0.1), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.image-placeholder i {
  color: var(--text-meta);
  font-size: 2rem;
}

/* Ensure sufficient contrast ratios */
.sufficient-contrast {
  /* Text against dark background should have contrast ratio >= 4.5:1 */
  /* Neon green (#39FF14) against dark background (#050505) has contrast ratio ~15:1 */
  /* This meets WCAG AA and AAA standards */
}

.text-danger {
  color: #FF3B3B; /* Contrast ratio ~4.7:1 against #050505 - meets WCAG AA */
}

.text-success {
  color: #39FF14; /* Contrast ratio ~15:1 against #050505 - exceeds WCAG AAA */
}

.text-warning {
  color: #FF8A00; /* Contrast ratio ~7.5:1 against #050505 - exceeds WCAG AA */
}

.text-meta {
  color: #A6A6A6; /* Contrast ratio ~8.5:1 against #050505 - exceeds WCAG AA */
}

.text-heading {
  color: #FFFFFF; /* Contrast ratio ~19:1 against #050505 - exceeds WCAG AAA */
}