/* MTA Official Line Colors */
:root {
    --mta-red: #EE352E;
    --mta-green: #00933C;
    --mta-purple: #B933AD;
    --mta-blue: #0039A6;
    --mta-orange: #FF6319;
    --mta-light-green: #6CBE45;
    --mta-brown: #996633;
    --mta-light-gray: #A7A9AC;
    --mta-yellow: #FCCC0A;
    --mta-dark-gray: #808183;
    
    --bg-color: #ffffff;
    --text-color: #000000;
    --border-color: #e0e0e0;
    --section-bg: #f8f8f8;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background-color: var(--text-color);
    color: var(--bg-color);
    padding: 2rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

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

.section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--text-color);
    padding-bottom: 0.5rem;
}

.section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

/* Map Section */
#map {
    height: 600px;
    width: 100%;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.map-controls {
    margin-bottom: 1rem;
}

.metric-toggle {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.metric-btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--bg-color);
    border: 2px solid var(--text-color);
    color: var(--text-color);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s;
}

.metric-btn:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

.metric-btn.active {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* Comparison Section */
.comparison-controls {
    margin-bottom: 2rem;
}

.line-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.line-selector label {
    font-weight: 600;
}

.line-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--bg-color);
    min-width: 150px;
}

.comparison-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.radar-charts {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.comparison-table-container {
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-color);
}

.comparison-table th,
.comparison-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
    background-color: var(--text-color);
    color: var(--bg-color);
    font-weight: 600;
}

.comparison-table tr:hover {
    background-color: #f0f0f0;
}

.ranking-section {
    margin-top: 3rem;
}

.ranking-controls {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-color);
}

.ranking-table th,
.ranking-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.ranking-table th {
    background-color: var(--text-color);
    color: var(--bg-color);
    font-weight: 600;
    cursor: pointer;
}

.ranking-table th:hover {
    background-color: #333;
}

.ranking-table tr:hover {
    background-color: #f0f0f0;
}

/* Explorer Section */
.explorer-controls {
    margin-bottom: 2rem;
}

.search-box {
    position: relative;
    max-width: 500px;
}

#station-search {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:hover {
    background-color: #f0f0f0;
}

.search-result-item:last-child {
    border-bottom: none;
}

.station-details {
    margin-top: 2rem;
}

.station-header {
    margin-bottom: 1.5rem;
}

.station-header h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.station-lines {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.line-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
}

.station-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.station-map-container {
    min-height: 300px;
}

.station-map {
    height: 300px;
    width: 100%;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.station-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-card {
    padding: 1.5rem;
    background-color: var(--bg-color);
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.info-card h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.bars-list {
    list-style: none;
    margin-top: 1rem;
}

.bars-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

/* Findings Section */
.findings-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.insights ul {
    list-style: none;
    padding-left: 0;
}

.insights li {
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: var(--bg-color);
    border-left: 4px solid var(--text-color);
    border-radius: 4px;
}

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

.leaderboard {
    background-color: var(--bg-color);
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.leaderboard h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.leaderboard ol {
    list-style: none;
    counter-reset: rank;
}

.leaderboard li {
    counter-increment: rank;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: var(--section-bg);
    border-radius: 4px;
    position: relative;
    padding-left: 2.5rem;
}

.leaderboard li::before {
    content: counter(rank);
    position: absolute;
    left: 0.75rem;
    font-weight: 600;
    color: var(--text-color);
}

.conclusion {
    background-color: var(--bg-color);
    padding: 2rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.conclusion p {
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Responsive Design */
@media (max-width: 968px) {
    .comparison-content {
        grid-template-columns: 1fr;
    }
    
    .station-content {
        grid-template-columns: 1fr;
    }
    
    .leaderboards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .section {
        padding: 1rem;
    }
    
    #map {
        height: 400px;
    }
    
    .line-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .line-select {
        width: 100%;
    }
}

/* Leaflet Popup Styling */
.leaflet-popup-content {
    min-width: 200px;
}

.popup-station-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.popup-metric {
    margin: 0.5rem 0;
}

.popup-metric-label {
    font-weight: 600;
    display: inline-block;
    min-width: 120px;
}
