/* === FILTER SEARCH INPUT === */
.filter-search-input {
  width: 90%;
  margin: 8px 5%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  background: #f9fafb;
  box-sizing: border-box;
  margin-bottom: 8px;
  transition: border 0.2s;
}
.filter-search-input:focus {
  border: 1.5px solid #667eea;
  background: #fff;
}

/* === GLOBAL RESET === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* === BODY & CONTAINER === */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  overflow: visible;
}

/* === HEADER === */
.header {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: white;
  padding: 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.header p {
  font-size: 1.1rem;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

/* === BACK BUTTON === */
.back-button {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 10px 20px;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  z-index: 2;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* === HOME SCREEN & NAVIGATION === */
.home-screen {
  padding: 60px 40px;
  text-align: center;
}

.home-title {
  font-size: 2rem;
  color: #1f2937;
  margin-bottom: 20px;
  font-weight: 700;
}

.home-subtitle {
  font-size: 1.2rem;
  color: #6b7280;
  margin-bottom: 50px;
}

.page-title {
  font-size: 2rem;
  color: #1f2937;
  margin-bottom: 20px;
  font-weight: 700;
  text-align: center;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
  max-width: 800px;
  margin: 0 auto;
}

.nav-button {
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  color: white;
  border: none;
  padding: 40px 30px;
  border-radius: 20px;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  text-decoration: none;
}

.nav-button:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(59, 130, 246, 0.4);
}

/* === FILTERS === */
.filters {
  display: flex;
  gap: 16px;
  margin: 20px 0;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow: visible;
  padding: 8px 0;
  position: relative;
  z-index: 100;
}

.filters label {
  font-weight: 600;
  color: #1f2937;
}

/* Filter Dropdown */
.filter-dropdown {
  position: relative;
  min-width: 140px;
  z-index: 1000;
}

/* Make player filter wider */
#playerDropdown, #seasonPlayerDropdown {
  min-width: 280px !important;
  max-width: 400px !important;
  flex: 2.5 1 280px;
}

.filter-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: #ffffff;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#playerDropdown .filter-button, #seasonPlayerDropdown .filter-button {
  font-size: 15px;
  padding: 14px 18px;
}

.filter-button:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.filter-button:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-button.active {
  border-color: #3b82f6;
  background: #f8faff;
  color: #1d4ed8;
}

.filter-arrow {
  width: 16px;
  height: 16px;
  margin-left: 8px;
  transition: transform 0.2s ease;
  opacity: 0.6;
}

.filter-button.open .filter-arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  max-height: 320px;
  min-width: 220px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

#playerDropdown .filter-dropdown-menu, #seasonPlayerDropdown .filter-dropdown-menu {
  min-width: 280px !important;
  max-width: 400px !important;
  width: 100% !important;
}

#playerOptions, #seasonPlayerOptions {
  min-height: 40px;
  max-height: 260px;
  overflow-y: auto;
}

.filter-dropdown-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.filter-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.filter-dropdown-menu::-webkit-scrollbar-track {
  background: #f9fafb;
}

.filter-dropdown-menu::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.filter-dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Dropdown Options */
.filter-option {
  display: flex;
  align-items: center;
  padding: 6px 10px 6px 6px;
  font-size: 15px;
  color: #374151;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid #f3f4f6;
  min-height: 28px;
}

.filter-option:last-child {
  border-bottom: none;
}

.filter-option:hover {
  background: #f8faff;
  color: #1d4ed8;
}

.filter-option.selected {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 500;
}

.filter-checkmark {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
  color: #10b981;
}

.filter-option.selected .filter-checkmark {
  opacity: 1;
}

.filter-option-text {
  flex: 1;
}

.filter-count {
  background: #3b82f6;
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 8px;
  min-width: 18px;
  text-align: center;
}

/* Legacy Filter Support */
.filters select,
.filters input {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1.5px solid #e5e7eb;
  font-size: 14px;
  min-width: 140px;
  transition: all 0.2s ease;
}

.filters select:focus,
.filters input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filters select[multiple] {
  min-height: 60px;
  background: #f9fafb;
}

/* === DATA TABLE === */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
}

.data-table thead {
  background: #f3f4f6;
  cursor: pointer;
}

.data-table th,
.data-table td {
  padding: 10px;
  border: 1px solid #e5e7eb;
  text-align: center;
}

.data-table th:hover {
  background: #e5e7eb;
}

.data-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.data-table tbody tr:hover {
  background: #f3f4f6;
}

.data-table td.percent-offense {
  font-weight: 700;
  color: #dc2626;
}

/* Sorting Indicators */
.data-table th.sortable {
  position: relative;
  user-select: none;
}

.data-table th.sortable::after {
  content: '';
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
}

.data-table th.sortable.sorted-asc::after {
  content: "▲";
  color: #2563eb;
  font-size: 0.8rem;
}

.data-table th.sortable.sorted-desc::after {
  content: "▼";
  color: #2563eb;
  font-size: 0.8rem;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 900px) {
  .filters {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .filter-dropdown, #playerDropdown, #seasonPlayerDropdown {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }
  #playerDropdown .filter-dropdown-menu, #seasonPlayerDropdown .filter-dropdown-menu {
    min-width: 0;
    max-width: 100vw;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (max-width: 768px) {
  .filters {
    gap: 12px;
    margin: 16px 0;
  }
  
  .filter-dropdown {
    min-width: 120px;
  }
  
  .filter-button,
  .filters select,
  .filters input {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .filter-option {
    padding: 10px 12px;
    font-size: 13px;
  }

  .button-grid {
    grid-template-columns: 1fr;
  }
}