/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

/* Header Styles */
header {
    background-color: #fff;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
}

header h1 {
    color: #2c3e50;
    margin: 0;
    font-size: 28px;
    flex: 1;
}

/* Hamburger positioned on left */
.hamburger-btn {
    order: -1;
}

/* Controls in settings menu */
.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.control-group label {
    font-weight: 600;
    color: #555;
    min-width: 120px;
}

.settings-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

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

.settings-section h4 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.control-group select {
    flex: 1;
    max-width: 200px;
}

.toggle-btn {
    padding: 6px 12px;
    border: 2px solid #ddd;
    background-color: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    margin-right: 5px;
}

.toggle-btn:hover {
    background-color: #f0f0f0;
}

.toggle-btn.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

select {
    padding: 6px 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    cursor: pointer;
}

/* Table Container */
.table-container {
    background-color: #fff;
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

/* Table Headers */
thead {
    background-color: #2c3e50;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-main td {
    padding: 10px 5px;
    text-align: center;
    font-weight: 600;
    border-right: 1px solid #34495e;
    background-color: #2c3e50;
}

.header-sub td {
    padding: 8px 5px;
    text-align: center;
    font-weight: 500;
    border-right: 1px solid #34495e;
    border-top: 1px solid #34495e;
    background-color: #34495e;
    font-size: 12px;
}

.header-main td:last-child,
.header-sub td:last-child {
    border-right: none;
}

/* Table Body */
tbody td {
    padding: 8px 5px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #f0f0f0;
}

tbody td:last-child {
    border-right: none;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

/* Team Row Styles */
.team-row {
    transition: background-color 0.2s ease;
}

.team-name {
    font-weight: 600;
    text-align: left;
    padding-left: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.ranking-cell {
    font-weight: 600;
    color: #2c3e50;
}

.trend-cell {
    font-size: 12px;
    color: #666;
}

.conf-cell,
.conf-name {
    font-weight: 500;
}

.record-cell {
    font-weight: 500;
}

/* Game Result Cells */
.win {
    background-color: #d4f4dd;
    color: #1b5e20;
    font-weight: 600;
}

.loss {
    background-color: #ffebee;
    color: #c62828;
    font-weight: 600;
}

.upcoming {
    background-color: #e3f2fd;
    color: #1565c0;
    font-style: italic;
}

.no-game {
    background-color: #fafafa;
    color: #999;
}

/* Week-specific Styles - only apply to tbody cells */
tbody .current-week {
    background-color: #fff3cd !important;
    border: 2px solid #ffc107 !important;
    font-weight: 700;
    position: relative;
}

tbody .past-week {
    opacity: 0.9;
}

tbody .future-week {
    background-color: #e8f4f8 !important;
}

/* Special Week Styles */
tbody .last-week {
    background-color: #f3e5f5 !important;
    border-left: 3px solid #9c27b0 !important;
}

tbody .next-week {
    background-color: #e1f5fe !important;
    border-right: 3px solid #03a9f4 !important;
}

/* Keep header week cells consistent */
thead .week-1, thead .week-2, thead .week-3, thead .week-4,
thead .week-5, thead .week-6, thead .week-7, thead .week-8,
thead .week-9, thead .week-10, thead .week-11, thead .week-12 {
    background-color: inherit !important;
    border: inherit !important;
    font-weight: inherit !important;
}

/* Home/Away Indicators */
.home::before {
    content: "";
    display: none; /* Hidden but available if needed */
    width: 6px;
    height: 6px;
    background-color: #4CAF50;
    border-radius: 50%;
    margin-right: 3px;
}

.away::before {
    content: "@";
    display: none; /* Hidden but available if needed */
    font-weight: normal;
    margin-right: 2px;
}

/* Use italics for away games */
tbody .away {
    font-style: italic;
}

tbody .home {
    font-style: normal;
}

/* Opponent Row Styles */
.opponent-row {
    background-color: #f8f9fa;
    animation: slideDown 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.opponent-row.show {
    opacity: 1;
    transform: translateY(0);
}

.opponent-row.fade-out {
    animation: fadeOut 0.3s ease;
}

.opponent-name {
    color: #666;
    font-style: italic;
    padding-left: 20px;
}

.opponent-row .opponent-cell {
    background-color: #f0f0f0 !important;
    pointer-events: none;
}

.highlight-matchup {
    background-color: #ffeb3b !important;
    border: 2px solid #f57c00 !important;
    font-weight: bold;
}

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

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

/* Clickable Cells */
.clickable-cell {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-cell:hover {
    background-color: #fffde7 !important;
    box-shadow: inset 0 0 0 2px #ffc107;
    position: relative;
    z-index: 1;
}

/* Special Week Styles */
.last-week {
    background-color: #f3e5f5 !important;
    border-left: 3px solid #9c27b0 !important;
}

.next-week {
    background-color: #e1f5fe !important;
    border-right: 3px solid #03a9f4 !important;
}

.last-week-header,
.next-week-header,
.current-week-header {
    background-color: #1a237e !important;
    font-weight: bold;
    color: #fff;
}

/* Hamburger Menu & Settings */
.hamburger-btn {
    background-color: #2c3e50;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    transition: background-color 0.3s ease;
}

.hamburger-btn:hover {
    background-color: #34495e;
}

.settings-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background-color: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.settings-menu.hidden {
    transform: translateX(100%);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #2c3e50;
    color: white;
}

.settings-header h3 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
}

.close-btn:hover {
    color: #e74c3c;
}

.settings-content {
    padding: 20px;
}

.settings-content h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
}

.column-toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.column-toggles label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.column-toggles label:hover {
    background-color: #f0f0f0;
}

.column-toggles input[type="checkbox"] {
    margin-right: 10px;
}

/* Sortable Headers */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.sortable:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sort-indicator {
    margin-left: 5px;
    font-size: 10px;
    color: #ffc107;
}

/* Legend Styles */
.legend-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.legend-container.hidden {
    display: none;
}

.legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.legend-container h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 20px;
}

.hide-legend-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.hide-legend-btn:hover {
    background-color: #c0392b;
}

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

.legend-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
}

.legend-section h4 {
    color: #34495e;
    margin-bottom: 10px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.legend-symbol {
    display: inline-block;
    min-width: 40px;
    margin-right: 10px;
    font-weight: bold;
    text-align: center;
    padding: 2px 6px;
}

.legend-desc {
    color: #555;
}

.legend-win {
    background-color: #d4f4dd;
    color: #1b5e20;
    padding: 2px 6px;
    border-radius: 3px;
}

.legend-loss {
    background-color: #ffebee;
    color: #c62828;
    padding: 2px 6px;
    border-radius: 3px;
}

.legend-upcoming {
    background-color: #e3f2fd;
    color: #1565c0;
    font-style: italic;
    padding: 2px 6px;
    border-radius: 3px;
}

.legend-last-week {
    background-color: #f3e5f5;
    padding: 2px 6px;
    border-radius: 3px;
    border-left: 3px solid #9c27b0;
}

.legend-current-week {
    background-color: #fff3cd;
    padding: 2px 6px;
    border-radius: 3px;
    border: 2px solid #ffc107;
}

.legend-next-week {
    background-color: #e1f5fe;
    padding: 2px 6px;
    border-radius: 3px;
    border-right: 3px solid #03a9f4;
}

.home-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #4CAF50;
    border-radius: 50%;
}

/* Conference Ranking Cell */
.conf-ranking-cell {
    font-weight: 600;
    color: #7b1fa2;
}

/* Clickable Rankings */
.clickable-ranking {
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.clickable-ranking:hover {
    background-color: #3498db !important;
    color: white !important;
}

/* Multi-line Tooltip Support */
[title] {
    position: relative;
}

[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-line;
    z-index: 1000;
    min-width: 200px;
    max-width: 300px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    margin-bottom: 5px;
}

[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
    z-index: 1001;
    pointer-events: none;
}


/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        padding: 10px;
    }

    table {
        font-size: 12px;
    }

    .team-name {
        max-width: 150px;
    }

    tbody td {
        padding: 6px 3px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 20px;
    }

    .controls {
        flex-direction: column;
        align-items: flex-start;
    }

    table {
        font-size: 11px;
    }

    tbody td {
        padding: 4px 2px;
    }

    .team-name {
        max-width: 100px;
    }
}

/* Print Styles */
@media print {
    .controls {
        display: none;
    }

    .table-container {
        box-shadow: none;
    }

    tbody tr:hover {
        background-color: transparent;
    }

    .opponent-row {
        display: none;
    }
}

/* Conference-specific Colors (optional) */
.team-row[data-conference="SEC"] .conf-cell {
    color: #8B0000;
    font-weight: bold;
}

.team-row[data-conference="Big Ten"] .conf-cell {
    color: #002B5C;
    font-weight: bold;
}

.team-row[data-conference="ACC"] .conf-cell {
    color: #003366;
    font-weight: bold;
}

.team-row[data-conference="Big 12"] .conf-cell {
    color: #512888;
    font-weight: bold;
}

.team-row[data-conference="Pac-12"] .conf-cell {
    color: #004B91;
    font-weight: bold;
}