@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
}

h1 {
    font-family: 'Barlow', sans-serif;
    font-weight: 700;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    cursor: text;
    transition: all 0.3s ease;
}

h1:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
}

h1:focus {
    outline: 2px solid rgba(76, 175, 80, 0.6);
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 12px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    min-width: 300px;
}

.main-controls {
    display: flex;
    gap: 5px;
    width: 100%;
}

.main-controls button {
    flex: 1;
}

.export-controls {
    display: flex;
    gap: 5px;
    width: 100%;
}

.export-controls button {
    flex: 1;
}

#export-btn {
    background: #17a2b8;
}

#export-btn:hover {
    background: #138496;
}

#import-btn {
    background: #6f42c1;
}

#import-btn:hover {
    background: #5a359a;
}

.header-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.sort-controls {
    display: flex;
    gap: 5px;
    width: 100%;
}

.sort-controls button {
    flex: 1;
}

.sort-controls button {
    padding: 6px 12px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.2);
}

.sort-controls button:hover {
    background: rgba(255, 255, 255, 0.3);
}

#sort-avg-btn {
    background: rgba(255, 193, 7, 0.7);
}

#sort-avg-btn:hover {
    background: rgba(255, 193, 7, 0.9);
}

#sort-high-btn {
    background: rgba(76, 175, 80, 0.7);
}

#sort-high-btn:hover {
    background: rgba(76, 175, 80, 0.9);
}

#sort-low-btn {
    background: rgba(244, 67, 54, 0.7);
}

#sort-low-btn:hover {
    background: rgba(244, 67, 54, 0.9);
}

button {
    padding: 10px 20px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-family: 'Barlow', sans-serif;
    font-weight: 500;
    transition: background 0.3s;
}

button:hover {
    background: #ff3742;
}

#add-all-btn {
    background: #4CAF50;
}

#add-all-btn:hover {
    background: #45a049;
}

#view-toggle {
    background: #5352ed;
}

#view-toggle:hover {
    background: #4743d8;
}

.random-teams {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: center;
}

.random-teams h3 {
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    font-size: 1.2em;
    margin: 0;
    white-space: nowrap;
}

.random-teams-container {
    display: flex;
    gap: 15px;
}

.teams-remaining {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-left: 15px;
    display: flex;
    align-items: center;
    font-weight: bold;
}

.team-item {
    text-align: center;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid transparent;
    width: 100px;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.team-item:hover {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
    transform: translateY(-3px);
}

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

.team-item span {
    display: none;
}

.chart-container {
    background: rgba(0, 0, 0, 1);
    border-radius: 15px;
    padding: 60px 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    display: flex;
    min-height: 800px;
}

.y-axis {
    width: 50px;
    position: relative;
    border-right: 2px solid rgba(76, 175, 80, 0.6);
    margin-right: 20px;
}

.y-label {
    position: absolute;
    right: 10px;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: bold;
    color: rgba(76, 175, 80, 0.9);
}

.chart-area {
    flex: 1;
    position: relative;
}

.grid-lines {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.grid-line {
    position: absolute;
    width: 100%;
    height: 1px;
    background: rgba(76, 175, 80, 0.2);
}

.teams-ranges {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    gap: clamp(2px, 1vw, 8px);
    min-height: 700px;
}

.team-range {
    position: relative;
    height: 100%;
    cursor: pointer;
    user-select: none;
    flex: 1;
    min-width: 10px;
    max-width: 80px;
    transition: order 0.3s ease, transform 0.3s ease;
}

.team-range .team-info {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 10px;
    width: 80px;
}

.team-logo-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin: 0 auto 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: bold;
    background: white;
    overflow: hidden;
}

.team-logo-img-small {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.team-logo-small.text-fallback {
    background: #f0f0f0;
    color: #333;
}

.team-name-small {
    font-size: 9px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.range-bar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    background: #ccc;
    border-radius: 3px;
    opacity: 1;
    transition: all 0.3s ease, top 0.3s ease, height 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.team-range.active .range-bar {
    opacity: 1;
    width: 8px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
}

.range-bar:hover {
    opacity: 1;
}

.range-handle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    border: 3px solid rgba(51, 51, 51, 0.4);
    cursor: grab;
    transition: all 0.3s ease, top 0.3s ease;
    opacity: 1;
}

.range-handle:hover {
    transform: translateX(-50%) scale(1.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    opacity: 1;
}

.range-handle:active {
    cursor: grabbing;
}

.range-handle.high {
    border-color: rgba(76, 175, 80, 0.4);
}

.range-handle.avg {
    border: none;
    background: transparent;
    width: 48px;
    height: auto;
    border-radius: 8px;
    z-index: 10;
    padding: 3px;
    box-shadow: none;
    transform: translateX(-50%);
}

.team-avg-slider {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
    min-height: 32px;
}

.avg-logo-img {
    width: clamp(28px, 4vw, 48px);
    height: clamp(28px, 4vw, 48px);
    object-fit: contain;
    border-radius: 10%;
}

.avg-team-name {
    font-size: clamp(12px, 1.5vw, 16px);
    font-weight: bold;
    color: white;
    text-align: center;
    line-height: 1;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    background: rgba(0, 0, 0, 1);
    border-radius: 50%;
    padding: clamp(3px, 0.7vw, 6px) clamp(4px, 0.9vw, 8px);
    min-width: clamp(20px, 2.5vw, 24px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-avg-slider.text-only-avg {
    justify-content: center;
    background: rgba(255, 193, 7, 0.9);
    color: white;
}

.range-handle.low {
    border-color: rgba(244, 67, 54, 0.4);
}

.range-handle.high::before,
.range-handle.low::after {
    content: attr(data-rank);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    pointer-events: auto;
}

.range-handle.high::before {
    top: -28px;
}

.range-handle.low::after {
    bottom: -28px;
}

/* Active team handles - bright and prominent */
.team-range.active .range-handle {
    opacity: 1;
    border-width: 3px;
}

.team-range.active .range-handle.high {
    border-color: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

.team-range.active .range-handle.avg {
    background: transparent;
    box-shadow: none;
    transform: translateX(-50%) scale(1.1);
}

.team-range.active .avg-logo-img {
    box-shadow: 0 0 16px rgba(76, 175, 80, 0.6);
    background: rgba(76, 175, 80, 0.2);
    border: 2px solid rgba(76, 175, 80, 0.6);
}

.team-range.active .avg-team-name {
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.team-range.active .range-handle.low {
    border-color: #F44336;
    box-shadow: 0 0 8px rgba(244, 67, 54, 0.3);
}

.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

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

.legend-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid;
}

.legend-icon.high {
    background: white;
    border-color: #4CAF50;
}

.legend-icon.avg-new {
    background: white;
    border: 2px solid #FFC107;
    width: 32px;
    height: 20px;
    border-radius: 4px;
    position: relative;
}

.legend-icon.avg-new::after {
    content: "🏈";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
}

.legend-icon.low {
    background: white;
    border-color: #F44336;
}

.teams-pool {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    backdrop-filter: blur(10px);
}

.teams-pool h3 {
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2em;
}

.teams-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.team {
    background: white;
    color: #333;
    padding: 8px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.team:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    background: #f8f9fa;
}

.team:active {
    transform: translateY(0px);
    transform: scale(0.95);
}

.team-logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 10px;
    overflow: hidden;
}

.team-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.team-logo.text-fallback {
    background: #f0f0f0;
    color: #333;
}

.team-name {
    font-size: 10px;
    font-weight: bold;
}

/* Team Colors - fallback for text logos only */
.team[data-team="Cardinals"] .team-logo.text-fallback { background: #97233F; color: white; }
.team[data-team="Falcons"] .team-logo.text-fallback { background: #A71930; color: white; }
.team[data-team="Ravens"] .team-logo.text-fallback { background: #241773; color: white; }
.team[data-team="Bills"] .team-logo.text-fallback { background: #00338D; color: white; }
.team[data-team="Panthers"] .team-logo.text-fallback { background: #0085CA; color: white; }
.team[data-team="Bears"] .team-logo.text-fallback { background: #0B162A; color: white; }
.team[data-team="Bengals"] .team-logo.text-fallback { background: #FB4F14; color: white; }
.team[data-team="Browns"] .team-logo.text-fallback { background: #311D00; color: white; }
.team[data-team="Cowboys"] .team-logo.text-fallback { background: #003594; color: white; }
.team[data-team="Broncos"] .team-logo.text-fallback { background: #FB4F14; color: white; }
.team[data-team="Lions"] .team-logo.text-fallback { background: #0076B6; color: white; }
.team[data-team="Packers"] .team-logo.text-fallback { background: #203731; color: white; }
.team[data-team="Texans"] .team-logo.text-fallback { background: #03202F; color: white; }
.team[data-team="Colts"] .team-logo.text-fallback { background: #002C5F; color: white; }
.team[data-team="Jaguars"] .team-logo.text-fallback { background: #006778; color: white; }
.team[data-team="Chiefs"] .team-logo.text-fallback { background: #E31837; color: white; }
.team[data-team="Raiders"] .team-logo.text-fallback { background: #000000; color: white; }
.team[data-team="Chargers"] .team-logo.text-fallback { background: #0080C6; color: white; }
.team[data-team="Rams"] .team-logo.text-fallback { background: #003594; color: white; }
.team[data-team="Dolphins"] .team-logo.text-fallback { background: #008E97; color: white; }
.team[data-team="Vikings"] .team-logo.text-fallback { background: #4F2683; color: white; }
.team[data-team="Patriots"] .team-logo.text-fallback { background: #002244; color: white; }
.team[data-team="Saints"] .team-logo.text-fallback { background: #D3BC8D; color: black; }
.team[data-team="Giants"] .team-logo.text-fallback { background: #0B2265; color: white; }
.team[data-team="Jets"] .team-logo.text-fallback { background: #125740; color: white; }
.team[data-team="Eagles"] .team-logo.text-fallback { background: #004C54; color: white; }
.team[data-team="Steelers"] .team-logo.text-fallback { background: #FFB612; color: black; }
.team[data-team="49ers"] .team-logo.text-fallback { background: #AA0000; color: white; }
.team[data-team="Seahawks"] .team-logo.text-fallback { background: #002244; color: white; }
.team[data-team="Buccaneers"] .team-logo.text-fallback { background: #D50A0A; color: white; }
.team[data-team="Titans"] .team-logo.text-fallback { background: #0C2340; color: white; }
.team[data-team="Commanders"] .team-logo.text-fallback { background: #5A1414; color: white; }

/* Range chart team colors - fallback for text logos only */
.team-range[data-team="Cardinals"] .team-logo-small.text-fallback { background: #97233F; color: white; }
.team-range[data-team="Falcons"] .team-logo-small.text-fallback { background: #A71930; color: white; }
.team-range[data-team="Ravens"] .team-logo-small.text-fallback { background: #241773; color: white; }
.team-range[data-team="Bills"] .team-logo-small.text-fallback { background: #00338D; color: white; }
.team-range[data-team="Panthers"] .team-logo-small.text-fallback { background: #0085CA; color: white; }
.team-range[data-team="Bears"] .team-logo-small.text-fallback { background: #0B162A; color: white; }
.team-range[data-team="Bengals"] .team-logo-small.text-fallback { background: #FB4F14; color: white; }
.team-range[data-team="Browns"] .team-logo-small.text-fallback { background: #311D00; color: white; }
.team-range[data-team="Cowboys"] .team-logo-small.text-fallback { background: #003594; color: white; }
.team-range[data-team="Broncos"] .team-logo-small.text-fallback { background: #FB4F14; color: white; }
.team-range[data-team="Lions"] .team-logo-small.text-fallback { background: #0076B6; color: white; }
.team-range[data-team="Packers"] .team-logo-small.text-fallback { background: #203731; color: white; }
.team-range[data-team="Texans"] .team-logo-small.text-fallback { background: #03202F; color: white; }
.team-range[data-team="Colts"] .team-logo-small.text-fallback { background: #002C5F; color: white; }
.team-range[data-team="Jaguars"] .team-logo-small.text-fallback { background: #006778; color: white; }
.team-range[data-team="Chiefs"] .team-logo-small.text-fallback { background: #E31837; color: white; }
.team-range[data-team="Raiders"] .team-logo-small.text-fallback { background: #000000; color: white; }
.team-range[data-team="Chargers"] .team-logo-small.text-fallback { background: #0080C6; color: white; }
.team-range[data-team="Rams"] .team-logo-small.text-fallback { background: #003594; color: white; }
.team-range[data-team="Dolphins"] .team-logo-small.text-fallback { background: #008E97; color: white; }
.team-range[data-team="Vikings"] .team-logo-small.text-fallback { background: #4F2683; color: white; }
.team-range[data-team="Patriots"] .team-logo-small.text-fallback { background: #002244; color: white; }
.team-range[data-team="Saints"] .team-logo-small.text-fallback { background: #D3BC8D; color: black; }
.team-range[data-team="Giants"] .team-logo-small.text-fallback { background: #0B2265; color: white; }
.team-range[data-team="Jets"] .team-logo-small.text-fallback { background: #125740; color: white; }
.team-range[data-team="Eagles"] .team-logo-small.text-fallback { background: #004C54; color: white; }
.team-range[data-team="Steelers"] .team-logo-small.text-fallback { background: #FFB612; color: black; }
.team-range[data-team="49ers"] .team-logo-small.text-fallback { background: #AA0000; color: white; }
.team-range[data-team="Seahawks"] .team-logo-small.text-fallback { background: #002244; color: white; }
.team-range[data-team="Buccaneers"] .team-logo-small.text-fallback { background: #D50A0A; color: white; }
.team-range[data-team="Titans"] .team-logo-small.text-fallback { background: #0C2340; color: white; }
.team-range[data-team="Commanders"] .team-logo-small.text-fallback { background: #5A1414; color: white; }