/* Modern Dashboard Styles */
:root {
  --primary-color: #374151;
  --primary-dark: #1f2937;
  --secondary-color: #f8fafc;
  --accent-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: #f8fafc;
  margin: 0;
  padding: 0;
}

/* Modern Navbar */
.navbar {
  background: linear-gradient(135deg, #4b5563 0%, #1f2937 100%) !important;
  box-shadow: var(--shadow-lg);
  border: none;
  padding: 0.75rem 1.5rem;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: white !important;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar .btn-outline-light {
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar .btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.navbar .btn-outline-light:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
  outline: none;
}

.navbar .form-control {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: white;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.navbar .form-control:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
  color: white;
}

.navbar .form-control::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
}

.nav-link:hover {
  color: white !important;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

/* Modern Sidebar */
.sidebar {
  background: white;
  box-shadow: var(--shadow-lg);
  border-right: 1px solid var(--border-color);
  padding-top: 1rem;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: 250px;
}

.sidebar-sticky {
  padding: 1rem 0;
  min-height: 100%;
}

.sidebar .nav-link {
  color: var(--text-secondary) !important;
  padding: 0.75rem 1.5rem;
  margin: 0.25rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar .nav-link:hover {
  color: var(--primary-color) !important;
  background: var(--border-light);
  transform: translateX(4px);
}

.sidebar .nav-link.active {
  color: var(--primary-color) !important;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white !important;
  box-shadow: var(--shadow-md);
}

.sidebar .nav-link i {
  width: 1.25rem;
  text-align: center;
}

/* Sidebar Scrollbar Styling */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--border-light);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Main Content Area */
[role="main"] {
  margin-top: 4rem;
  padding: 2rem;
  background: #f8fafc;
  min-height: calc(100vh - 4rem);
  margin-left: 250px; /* Account for fixed sidebar width */
}

/* Modern Cards */
.dashboard-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  overflow: hidden;
}

.dashboard-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.125rem;
}

.card-body {
  padding: 1.5rem;
}

/* Modern Tables */
.table-modern {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.table-modern thead th {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border: none;
  padding: 1rem 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table-modern tbody td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.table-modern tbody tr:hover {
  background: var(--border-light);
}

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

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.5rem;
}

.stat-change.positive {
  color: var(--accent-color);
}

.stat-change.negative {
  color: var(--danger-color);
}

/* Modern Buttons */
.btn-modern {
  border-radius: var(--radius-md);
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-primary-modern {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary-modern:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-light);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Charts and Graphs */
.chart-container {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

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

.chart-title {
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  max-width: 400px;
  z-index: 9999;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.notification-content i {
  font-size: 1.25rem;
}

.notification-success .notification-content i {
  color: var(--accent-color);
}

.notification-error .notification-content i {
  color: var(--danger-color);
}

.notification-info .notification-content i {
  color: var(--primary-color);
}

.notification-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.notification-close:hover {
  color: var(--text-secondary);
  background: var(--border-light);
}

/* Search Enhancements */
.search-focused {
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

/* Loading States */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 280px;
  }
  
  .sidebar.sidebar-open {
    transform: translateX(0);
  }
  
  body.sidebar-open::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }
  
  [role="main"] {
    margin-left: 0;
    padding: 1rem;
    margin-top: 3rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .table-modern {
    font-size: 0.75rem;
  }
  
  .table-modern thead th,
  .table-modern tbody td {
    padding: 0.75rem;
  }
  
  .notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

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

.dashboard-card,
.stat-card,
.chart-container {
  animation: fadeInUp 0.6s ease-out;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--border-light);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Utility Classes */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.border-gradient {
  border: 2px solid;
  border-image: linear-gradient(135deg, var(--primary-color), var(--accent-color)) 1;
}

/* DataTables Customization */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-secondary) !important;
  padding: 0.5rem 0.75rem;
  margin: 0 0.125rem;
  transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary-color) !important;
  color: white !important;
  border-color: var(--primary-color);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary-color) !important;
  color: white !important;
  border-color: var(--primary-color);
}

/* ============================================
   Dynamic Navigation Styles
   ============================================ */

/* Smooth content transitions */
main[role="main"] {
  transition: opacity 0.3s ease;
  position: relative;
}

/* Loading state for main content */
main[role="main"].loading-content {
  pointer-events: none;
  position: relative;
  min-height: 200px;
}

main[role="main"].loading-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px);
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

main[role="main"].loading-content::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid var(--border-light);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 101;
}

/* Sidebar navigation link loading states */
.sidebar .nav-link {
  position: relative;
  transition: all 0.2s ease;
}

.sidebar .nav-link.loading {
  pointer-events: none;
  opacity: 0.6;
}

.sidebar .nav-link.loading::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.sidebar .nav-link:not(.active).loading::after {
  border: 2px solid var(--border-light);
  border-top: 2px solid var(--primary-color);
}

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Spin animation (reuse for consistency) */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Content fade animation */
.content-fade-enter {
  animation: contentFadeIn 0.4s ease;
}

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

/* Prevent sidebar from moving during navigation */
.sidebar {
  position: fixed !important;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  width: 280px; /* Increased from default ~16.67% to fixed 280px */
  box-sizing: border-box;
}

.sidebar * {
  box-sizing: border-box;
}

/* Ensure dropdown doesn't overflow sidebar */
.sidebar .dropdown-menu {
  max-width: 100% !important;
  width: 100% !important;
  left: 0 !important;
  right: 0 !important;
  box-sizing: border-box;
}

.sidebar .dropdown-item {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Ensure main content area is properly positioned */
main[role="main"] {
  margin-left: 0;
  padding: 1.5rem;
  min-height: 100vh;
}

@media (min-width: 768px) {
  main[role="main"] {
    margin-left: 280px; /* Match sidebar width */
  }
}

@media (min-width: 992px) {
  .sidebar {
    width: 300px; /* Slightly wider on large screens */
  }
  main[role="main"] {
    margin-left: 300px; /* Match sidebar width */
  }
}

/* Season selector loading state */
#select_season {
  transition: opacity 0.2s ease;
}

#select_season.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Smooth transitions for all interactive elements */
.btn, .nav-link, .card, .table-row {
  transition: all 0.2s ease;
}

/* Page transition overlay */
.page-transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.page-transition-overlay.active {
  opacity: 1;
  pointer-events: all;
}