/* ==========================================
   NFL Stats Dashboard - Main Stylesheet
   Modern, clean design with responsive layout
   ========================================== */

/* CSS Variables for consistent theming */
:root {
    --primary-color: #013369;        /* NFL Blue */
    --secondary-color: #D50A0A;      /* NFL Red */
    --accent-color: #FFB612;         /* Gold accent */
    --text-dark: #1a1a1a;
    --text-light: #ffffff;
    --bg-light: #f5f5f5;
    --bg-white: #ffffff;
    --border-color: #ddd;
    --hover-color: #002244;
    --success-color: #28a745;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container for consistent width */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ==========================================
   Header Styles
   ========================================== */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--hover-color) 100%);
    color: var(--text-light);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    text-align: center;
    letter-spacing: 1px;
}

/* Navigation styles */
nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

nav ul li {
    position: relative;
}

nav ul li a {
    color: var(--text-light);
    text-decoration: none;
    padding: 0.5rem 1rem;
    display: block;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
}

nav ul li a:hover,
nav ul li a.active {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

/* Dropdown menu styles */
.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--bg-white);
    min-width: 200px;
    box-shadow: var(--shadow-hover);
    z-index: 1001;
    border-radius: 4px;
    overflow: hidden;
    top: 100%;
    left: 0;
}

.dropdown-content a {
    color: var(--text-dark);
    padding: 0.75rem 1rem;
    text-decoration: none;
    display: block;
    transition: background-color 0.3s ease;
}

.dropdown-content a:hover,
.dropdown-content a.active {
    background-color: var(--bg-light);
    color: var(--secondary-color);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* ==========================================
   Main Content Styles
   ========================================== */
main {
    flex: 1;
    padding: 2rem 0;
}

section {
    background-color: var(--bg-white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Welcome section specific styles */
.welcome-section p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Feature list styles */
.feature-list {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0;
}

.feature-list li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.6;
}

.feature-list li::before {
    content: "▸";
    color: var(--secondary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* About section specific styles */
.about-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* ==========================================
   Table Styles
   ========================================== */
.table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-white);
    font-size: 0.95rem;
}

thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--hover-color) 100%);
    color: var(--text-light);
}

thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: var(--bg-light);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 0.75rem 1rem;
    text-align: left;
}

/* Loading state */
.loading {
    text-align: center !important;
    padding: 2rem !important;
    color: #666;
    font-style: italic;
}

/* Numeric column alignment */
tbody td:nth-child(n+3) {
    text-align: center;
}

thead th:nth-child(n+3) {
    text-align: center;
}

/* Highlight first column (rank/name) */
tbody td:first-child {
    font-weight: 600;
    color: var(--primary-color);
}

tbody td:nth-child(2) {
    font-weight: 500;
}

/* Week separator row styling */
.week-separator td {
    background-color: var(--primary-color) !important;
    color: var(--text-light) !important;
    font-weight: bold !important;
    padding: 0.75rem !important;
    text-align: center !important;
}

.week-separator:hover {
    background-color: var(--primary-color) !important;
}

/* ==========================================
   Footer Styles
   ========================================== */
footer {
    background-color: var(--primary-color);
    color: var(--text-light);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
}

footer p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

/* ==========================================
   Responsive Design
   ========================================== */

/* Tablet styles */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
    }

    nav ul li {
        width: 100%;
        text-align: center;
    }

    .dropdown-content {
        position: static;
        display: none;
        width: 100%;
    }

    .dropdown:hover .dropdown-content,
    .dropdown.active .dropdown-content {
        display: block;
    }

    section {
        padding: 1.5rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    table {
        font-size: 0.85rem;
    }

    thead th,
    tbody td {
        padding: 0.5rem;
    }
}

/* Mobile styles */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    header h1 {
        font-size: 1.25rem;
    }

    section {
        padding: 1rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    table {
        font-size: 0.75rem;
    }

    thead th,
    tbody td {
        padding: 0.4rem 0.25rem;
    }

    /* Stack table on very small screens if needed */
    .table-container {
        font-size: 0.7rem;
    }
}

/* ==========================================
   Sortable Table Styles
   ========================================== */
thead th[style*="cursor: pointer"] {
    user-select: none;
    position: relative;
    padding-right: 20px;
}

thead th[style*="cursor: pointer"]::after {
    content: '⇅';
    position: absolute;
    right: 5px;
    opacity: 0.3;
    font-size: 0.8em;
}

thead th.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--secondary-color);
}

thead th.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--secondary-color);
}

thead th[style*="cursor: pointer"]:hover {
    background-color: rgba(1, 51, 105, 0.1);
}

/* ==========================================
   Filter Controls (Search & Team Filter)
   ========================================== */
.filter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-box,
.team-filter {
    flex: 1;
    min-width: 200px;
}

.search-box input,
.team-filter select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: var(--bg-white);
}

.search-box input:focus,
.team-filter select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(1, 51, 105, 0.1);
}

.search-box input::placeholder {
    color: #999;
}

/* Screen reader only class for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================
   Stat Tabs (for multi-category pages)
   ========================================== */
.stat-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border-color);
}

.stat-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    bottom: -2px;
}

.stat-tab:hover {
    background-color: rgba(1, 51, 105, 0.05);
    color: var(--primary-color);
}

.stat-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: rgba(1, 51, 105, 0.05);
}

.stat-tab:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: -3px;
}

.stat-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.stat-section.active {
    display: block;
}

.stat-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* ==========================================
   Scroll to Top Button
   ========================================== */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--hover-color) 100%);
    color: var(--text-light);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    background: var(--secondary-color);
}

.scroll-to-top:active {
    transform: translateY(-2px);
}

.scroll-to-top:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* ==========================================
   Loading Animations
   ========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

tbody tr {
    animation: fadeIn 0.3s ease-in-out;
}

/* Loading spinner for async operations */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(1, 51, 105, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

/* ==========================================
   Smooth Scrolling
   ========================================== */
html {
    scroll-behavior: smooth;
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Skip to main content link for accessibility */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: var(--text-light);
    padding: 8px;
    text-decoration: none;
    z-index: 9999;
}

.skip-to-main:focus {
    top: 0;
}

/* ==========================================
   League Leaders Grid
   ========================================== */
.leaders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.leader-card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.leader-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.leader-card-title {
    background: linear-gradient(135deg, var(--primary-color), var(--hover-color));
    color: var(--text-light);
    padding: 16px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.stat-icon {
    font-size: 1.4rem;
}

.leader-card-content {
    padding: 20px;
    flex: 1;
}

.leader-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.leader-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

.leader-list li:last-child {
    border-bottom: none;
}

.leader-list li:hover {
    background-color: rgba(1, 51, 105, 0.02);
    padding-left: 8px;
    padding-right: 8px;
    margin-left: -8px;
    margin-right: -8px;
    border-radius: 4px;
}

.leader-list .player-name {
    font-weight: 600;
    color: var(--text-dark);
}

.leader-list .player-team {
    color: #666;
    font-size: 0.85rem;
    margin-left: 8px;
}

.leader-list .stat-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.05rem;
}

.leader-list .loading {
    color: #999;
    font-style: italic;
    justify-content: center;
}

.view-more-link {
    display: block;
    text-align: center;
    padding: 12px 20px;
    background-color: var(--bg-light);
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.view-more-link:hover {
    background-color: var(--primary-color);
    color: var(--text-light);
}

/* ==========================================
   Playoff Picture Styles
   ========================================== */
.playoff-subtitle {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.playoff-status-badge {
    background: linear-gradient(135deg, var(--accent-color), #FFA500);
    color: var(--text-dark);
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(255, 182, 18, 0.3);
}

.playoff-legend {
    display: flex;
    gap: 24px;
    padding: 16px 20px;
    background: var(--bg-white);
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.legend-icon {
    font-size: 1.3rem;
    font-weight: bold;
}

.legend-icon.division-winner {
    color: var(--accent-color);
}

.legend-icon.wild-card {
    color: var(--secondary-color);
    font-size: 1.8rem;
}

.legend-icon.bye-week {
    color: #28a745;
}

.playoff-conferences {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.conference-playoff {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.conference-header {
    padding: 20px;
    color: var(--text-light);
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.afc-header {
    background: linear-gradient(135deg, #D50A0A, #A00808);
}

.nfc-header {
    background: linear-gradient(135deg, #013369, #001F4D);
}

.conference-logo {
    font-size: 1.6rem;
    font-weight: 900;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

.playoff-seeds {
    padding: 20px;
}

.playoff-seed {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--bg-white);
    transition: all 0.3s ease;
}

.playoff-seed:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.playoff-seed.seed-1,
.playoff-seed.seed-2,
.playoff-seed.seed-3,
.playoff-seed.seed-4 {
    border-left: 4px solid var(--accent-color);
    background: linear-gradient(to right, rgba(255, 182, 18, 0.05), var(--bg-white));
}

.playoff-seed.seed-5,
.playoff-seed.seed-6,
.playoff-seed.seed-7 {
    border-left: 4px solid var(--secondary-color);
}

.seed-number {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 50px;
}

.seed-rank {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary-color);
    min-width: 32px;
}

.bye-indicator {
    font-size: 1.2rem;
    color: #28a745;
    animation: pulse 2s infinite;
}

.seed-team {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.team-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.team-record {
    font-size: 0.9rem;
    color: #666;
}

.team-division {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
}

.seed-team.loading {
    color: #999;
    font-style: italic;
}

.in-the-hunt {
    padding: 20px;
    background: var(--bg-light);
    border-top: 2px solid var(--border-color);
}

.hunt-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hunt-teams {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hunt-team {
    padding: 8px 14px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.hunt-team:hover {
    background: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
}

.hunt-team .team-name {
    font-weight: 600;
}

.hunt-team .team-record {
    color: inherit;
    opacity: 0.8;
    margin-left: 6px;
}

.info-box {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 24px;
    margin-top: 30px;
    box-shadow: var(--shadow);
}

.info-box h3 {
    margin: 0 0 16px 0;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.info-box h4 {
    margin: 0 0 12px 0;
    color: var(--text-dark);
    font-size: 1rem;
}

.info-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.info-column ol {
    margin: 0;
    padding-left: 20px;
}

.info-column li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.format-explanation p {
    margin: 12px 0;
    line-height: 1.7;
}

.format-explanation strong {
    color: var(--primary-color);
}

/* ==========================================
   Betting Odds Styles
   ========================================== */

/* Odds controls container */
.odds-controls {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

/* Toggle odds button */
.btn-toggle-odds {
    background: linear-gradient(135deg, var(--primary-color), var(--hover-color));
    color: var(--text-light);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-toggle-odds:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-toggle-odds:active {
    transform: translateY(0);
}

.btn-toggle-odds .icon {
    font-size: 1.2rem;
}

.btn-toggle-odds.active {
    background: linear-gradient(135deg, var(--secondary-color), #b00808);
}

/* Odds disclaimer */
.odds-disclaimer {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
    padding: 0.5rem 0.75rem;
    background-color: #fff9e6;
    border-left: 3px solid var(--accent-color);
    border-radius: 4px;
}

/* Odds table columns */
.odds-column {
    background-color: #f8f9ff !important;
    font-weight: 600;
    white-space: nowrap;
}

.odds-cell {
    background-color: #f8f9ff !important;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    padding: 0.5rem !important;
}

.odds-cell .odds-label {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.25rem;
    font-family: 'Segoe UI', sans-serif;
}

.odds-cell .odds-value {
    display: block;
    font-weight: 700;
    color: var(--primary-color);
}

.odds-cell .favorite {
    color: var(--secondary-color);
}

.odds-cell .underdog {
    color: var(--success-color);
}

.odds-unavailable {
    color: #999;
    font-style: italic;
    font-family: 'Segoe UI', sans-serif;
}

/* Week separator with odds columns */
.week-separator.with-odds td {
    background-color: var(--primary-color) !important;
}

/* Responsive odds display */
@media (max-width: 768px) {
    .odds-controls {
        padding: 0.75rem;
    }
    
    .btn-toggle-odds {
        width: 100%;
        justify-content: center;
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }
    
    .odds-disclaimer {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .odds-cell {
        font-size: 0.8rem;
        padding: 0.4rem !important;
    }
    
    .odds-cell .odds-label {
        font-size: 0.7rem;
    }
}

/* Print styles */
@media print {
    header,
    footer,
    nav {
        display: none;
    }

    body {
        background-color: white;
    }

    section {
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    /* Hide sort indicators when printing */
    thead th::after {
        display: none;
    }
    
    /* Hide odds controls when printing */
    .odds-controls {
        display: none;
    }
}

