:root {
    --navy: #1e3a5f;
    --gold: #c9a961;
    --light-gold: #e8d4a2;
    --dark-navy: #0f1f33;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

::-webkit-scrollbar-corner {
    background: rgba(0, 0, 0, 0.2);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0f1f33 0%, #1e3a5f 100%);
    color: white;
    min-height: 100vh;
}

/* Modern Tech Header */
.tech-header {
    background: linear-gradient(180deg, #0a0f1a 0%, #0f172a 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.header-accent {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(201, 169, 97, 0.5) 20%,
        rgba(201, 169, 97, 0.8) 50%,
        rgba(201, 169, 97, 0.5) 80%,
        transparent 100%);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.logo-section:hover {
    opacity: 0.85;
}

.logo-container {
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 10px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.brand-tagline {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--gold);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.nav-section {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: #0f172a;
    background: linear-gradient(135deg, var(--gold) 0%, #e8d4a2 100%);
    font-weight: 600;
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        height: auto;
        padding: 16px;
        gap: 16px;
    }

    .logo-section {
        width: 100%;
        justify-content: center;
    }

    .nav-section {
        width: 100%;
        justify-content: center;
    }

    .nav-link {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    font-size: 1.1rem;
    color: var(--gold);
    font-weight: 500;
    letter-spacing: 1px;
}

/* Glassmorphism Cards */
.glass-panel {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Filter section needs higher z-index so dropdowns appear above table */
.glass-panel:has(.filter-section) {
    position: relative;
    z-index: 100;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 12px;
    justify-content: center;
}

.tab-btn {
    padding: 12px 30px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--gold) 0%, var(--light-gold) 100%);
    color: var(--dark-navy);
    box-shadow: 0 4px 12px rgba(201, 169, 97, 0.3);
}

/* Filter Section */
.filter-section {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-input {
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    transition: all 0.2s ease;
}

.filter-input:focus {
    outline: none;
    border-color: var(--gold);
    background: rgba(0, 0, 0, 0.3);
}

/* Clear Column Filters Button */
.clear-column-filters-btn {
    padding: 12px 20px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(220, 38, 38, 0.1);
    color: #fca5a5;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-column-filters-btn:hover {
    background: rgba(220, 38, 38, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Multi-select dropdown */
.multi-select-wrapper {
    position: relative;
}

.multi-select-btn {
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    width: 100%;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.multi-select-btn::after {
    content: '▼';
    font-size: 0.7rem;
    color: #94a3b8;
}

.multi-select-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.3);
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
}

.multi-select-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.multi-select-option {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.multi-select-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.multi-select-option label {
    cursor: pointer;
    color: #e2e8f0;
    flex: 1;
    font-size: 0.9rem;
    text-transform: none;
}

.multi-select-search {
    width: calc(100% - 16px);
    margin: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
}

/* Stats Table */
.table-container {
    overflow: auto;
    max-height: 70vh;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
}

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

.stats-table th {
    background: #0f172a;
    color: #94a3b8;
    padding: 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
}

.stats-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    color: #e2e8f0;
    background: transparent;
}

/* Sticky Columns - Header cells (highest z-index for corner cells) */
.stats-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 50;
    background: #0f172a;
    width: 50px;
    text-align: center;
}

.stats-table th:nth-child(2) {
    position: sticky;
    left: 50px;
    z-index: 50;
    background: #0f172a;
    min-width: 250px;
}

.stats-table th:nth-child(3) {
    position: sticky;
    left: 300px;
    z-index: 50;
    background: #0f172a;
    width: 60px;
}

.stats-table th:nth-child(4) {
    position: sticky;
    left: 360px;
    z-index: 50;
    background: #0f172a;
    min-width: 180px;
    box-shadow: 4px 0 10px rgba(0,0,0,0.3);
}

/* Sticky Columns - Body cells (lower z-index so headers stay on top) */
.stats-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background: #0f172a;
    width: 50px;
    text-align: center;
}

.stats-table td:nth-child(2) {
    position: sticky;
    left: 50px;
    z-index: 10;
    background: #0f172a;
    min-width: 250px;
}

.stats-table td:nth-child(3) {
    position: sticky;
    left: 300px;
    z-index: 10;
    background: #0f172a;
    width: 60px;
}

.stats-table td:nth-child(4) {
    position: sticky;
    left: 360px;
    z-index: 10;
    background: #0f172a;
    min-width: 180px;
    box-shadow: 4px 0 10px rgba(0,0,0,0.3);
}

.stats-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

/* Keep sticky columns solid on hover */
.stats-table tbody tr:hover td:first-child,
.stats-table tbody tr:hover td:nth-child(2),
.stats-table tbody tr:hover td:nth-child(3),
.stats-table tbody tr:hover td:nth-child(4) {
    background: #1a2744;
}

/* Player & Team Styling */
.player-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-headshot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1e293b;
    object-fit: cover;
    border: 2px solid var(--navy);
}

.player-name {
    font-weight: 600;
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
}

.player-name:hover {
    color: var(--gold);
}

.team-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.team-name {
    color: #cbd5e1;
    font-weight: 500;
}

/* Stat Colors */
.stat-value {
    font-variant-numeric: tabular-nums;
}

.grade-cell {
    font-weight: 700;
    text-align: center;
    border-radius: 4px;
    padding: 4px 8px !important;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.page-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--gold);
}

.page-btn.active {
    background: var(--gold);
    color: var(--dark-navy);
    border-color: var(--gold);
    font-weight: 700;
}

/* Loading */
.loading-spinner {
    border: 4px solid rgba(201, 169, 97, 0.2);
    border-top: 4px solid var(--gold);
}

/* Error Message */
.error-message {
    color: #f87171;
    background: rgba(220, 38, 38, 0.1);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: none;
}

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

/* Column Key Section */
.column-key-section {
    margin-top: 24px;
}

.column-key-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 0;
}

.column-key-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0;
}

.column-key-toggle {
    color: #94a3b8;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.column-key-toggle.collapsed {
    transform: rotate(180deg);
}

.column-key-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 500px;
}

.column-key-content.collapsed {
    max-height: 0;
}

.column-key-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 8px;
}

.key-item {
    font-size: 0.9rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 10px;
}

.key-abbr {
    font-weight: 700;
    color: #e2e8f0;
    min-width: 80px;
}

/* Tooltip for column headers */
.stats-table th[title] {
    position: relative;
}

.stats-table th .tooltip {
    visibility: hidden;
    background: #1e293b;
    color: #e2e8f0;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
    position: absolute;
    z-index: 100;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.stats-table th .tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #1e293b;
}

.stats-table th:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* Drag and Drop Column Reordering */
.stats-table th[draggable="true"] {
    cursor: grab;
    user-select: none;
}

.stats-table th[draggable="true"]:active {
    cursor: grabbing;
}

.stats-table th:first-child {
    cursor: default;
}

.stats-table th.dragging {
    opacity: 0.5;
    background: rgba(201, 169, 97, 0.3) !important;
}

.stats-table th.drag-over {
    border-left: 3px solid var(--gold);
}

.stats-table th.drag-over-right {
    border-right: 3px solid var(--gold);
}

.stats-table th .drag-handle {
    display: inline-block;
    margin-right: 6px;
    color: #64748b;
    font-size: 0.7rem;
    vertical-align: middle;
}

.stats-table th:hover .drag-handle {
    color: var(--gold);
}

/* Small Screen Sticky overrides */
 @media (max-width: 1024px) {
    .stats-table td:nth-child(3),
    .stats-table th:nth-child(3),
    .stats-table td:nth-child(4),
    .stats-table th:nth-child(4) {
        position: static;
        box-shadow: none;
        background: transparent;
    }
    .stats-table td:nth-child(2) {
        box-shadow: 4px 0 10px rgba(0,0,0,0.3);
    }
 }

/* Excel-like Column Filter Dropdown - Dark Theme */
.column-filter-dropdown {
    position: fixed;
    min-width: 280px;
    max-width: 320px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    font-weight: 400;
    color: #e2e8f0;
}

.column-filter-dropdown.show {
    display: block;
}

.filter-dropdown-section {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.filter-dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    gap: 12px;
    color: #e2e8f0;
}

.filter-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.filter-dropdown-item.active {
    background: rgba(201, 169, 97, 0.2);
    color: var(--gold);
}

.filter-dropdown-item .filter-icon {
    width: 24px;
    font-size: 14px;
    color: #94a3b8;
    text-align: center;
}

.filter-dropdown-item span {
    flex: 1;
    font-size: 14px;
}

.filter-search-container {
    padding: 12px 16px;
}

.filter-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.3);
    color: #e2e8f0;
}

.filter-search-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.2);
}

.filter-search-input::placeholder {
    color: #64748b;
}

.filter-values-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 0;
}

.filter-value-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    gap: 10px;
    font-size: 14px;
    color: #e2e8f0;
}

.filter-value-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.filter-value-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--gold);
}

.filter-dropdown-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 12px 12px;
}

.filter-action-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

.filter-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.filter-action-btn.primary {
    background: linear-gradient(135deg, var(--gold), #b8860b);
    color: #0f172a;
    border-color: var(--gold);
    flex: 1;
    font-weight: 600;
}

.filter-action-btn.primary:hover {
    background: linear-gradient(135deg, #d4b896, var(--gold));
}

/* Filter icon in header */
.stats-table th .filter-icon-btn {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 4px;
    cursor: pointer;
    color: #64748b;
    font-size: 10px;
    vertical-align: middle;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.stats-table th .filter-icon-btn:hover {
    color: var(--gold);
    background: rgba(255, 255, 255, 0.1);
}

.stats-table th .filter-icon-btn.has-filter {
    color: var(--gold);
    background: rgba(201, 169, 97, 0.3);
}

/* Number filter submenu */
.number-filter-submenu {
    display: none;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
}

.number-filter-submenu.show {
    display: block;
}

.number-filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.number-filter-select {
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.3);
    color: #e2e8f0;
    min-width: 120px;
}

.number-filter-select option {
    background: #1e293b;
    color: #e2e8f0;
}

.number-filter-input {
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.3);
    color: #e2e8f0;
    width: 80px;
}

.number-filter-select:focus,
.number-filter-input:focus {
    outline: none;
    border-color: var(--gold);
}
