.track-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-family: 'Roboto', sans-serif;
}

/* UPDATED: Selector is now more specific to ensure centering overrides other styles */
.track-container .track-selector {
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 500px;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
    background: #f3f4f6;
}

.track-title {
    font-size: 3rem;
    font-weight: 800;
    text-transform: uppercase;
    background: linear-gradient(45deg, #009540, #005a27);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    padding: 1rem 0;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 2rem;
}
.track-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.track-card {
    background: linear-gradient(145deg, #f9fafb, #e5e7eb);
    border: 1px solid #d1d5db;
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.track-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.track-card h3 {
    font-size: 1rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.track-card h3 i {
    font-size: 1.25rem;
    color: #009540;
    margin-right: 0.75rem;
}
.track-card p {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
}
.track-segments {
    margin-top: 1.5rem;
    text-align: center;
}
.track-segments-list {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    padding: 1rem 0;
}
.track-segment-link {
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0;
    text-align: center;
    font-weight: 600;
    border: 2px solid #009540;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-decoration: none;
    color: #1f2937;
    transition: background 0.3s;
}
.track-segment-link:hover {
    background: #d1d5db;
}
.track-segment-link i {
    font-size: 1rem;
    margin-right: 0;
    margin-bottom: 2px;
}
.dashed-line {
    flex-grow: 1;
    max-width: 50px;
    border-bottom: 2px solid #d1d5db !important;
    height: 2px !important;
    margin: 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    align-self: center !important;
}
.start-icon { color: #dc2626; }
.finish-icon { color: #16a34a; }
.waypoint-icon { color: #4b5563; }
.track-banner {
    background: #fefcbf;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
    color: #7f6600;
    border: 1px solid #fed7aa;
}
.sponsor-info {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    text-align: center;
    border: 1px solid #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.sponsor-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}
.sponsor-logo {
    max-width: 200px;
    max-height: 100px;
    width: auto;
    height: auto;
    margin: 0 auto 0.5rem;
    display: block;
}
#track-sponsor-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}
#track-sponsor-custom-information {
    font-size: 1rem;
    color: #4b5563;
    line-height: 1.5;
}
.sponsor-thanks {
    font-size: 0.9rem;
    color: #4b5563;
    font-style: italic;
    margin-top: 0.5rem;
}
.custom-info {
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: 0.375rem;
    margin-top: 1.5rem;
    border: 1px solid #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.custom-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}
#track-custom-information {
    font-size: 1rem;
    color: #4b5563;
    line-height: 1.5;
}
.track-grid-alternative {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #d1d5db;
}
.track-grid-alternative h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 1rem;
    text-align: center;
}
.track-search-form {
    text-align: center;
    margin-bottom: 1rem;
}
.track-search-form input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
    width: 300px;
}
.track-search-form button {
    padding: 0.5rem 1rem;
    background: #1f2937;
    color: white;
    border-radius: 0.375rem;
    margin-left: 0.5rem;
    cursor: pointer;
}
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}
.grid-item {
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 0.375rem;
    text-align: center;
    text-decoration: none;
    color: #1f2937;
    transition: background 0.3s;
}
.grid-item:hover {
    background: #d1d5db;
}
.pagination {
    text-align: center;
    margin-top: 1rem;
}
.pagination-link {
    padding: 0.5rem 1rem;
    background: #1f2937;
    color: white;
    border-radius: 0.375rem;
    margin: 0 0.5rem;
    text-decoration: none;
}
.pagination-link:hover {
    background: #4b5563;
}

/* --- LAYOUT FIXES FOR MAP & PAGE BUILDER --- */

.track-container .e-con-inner {
    height: auto !important;
}
.track-container #track_viewer .gpxv-view {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0;
    float: none;
    border: none;
}
#map-container {
    width: 100%;
    margin: 1.5rem 0;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #d1d5db;
}
#map-container.small-viewport {
    height: 100% !important;
}
#leaflet-map {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 1;
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 767px) {
    .track-container .gpxv-view {
        display: none !important;
    }
    .dashed-line {
        border-bottom: 2px solid #d1d5db !important;
        height: 2px !important;
    }
}


/* ==========================================================================
   STYLES FOR THE NEW ROUTE OVERVIEW PAGE
   ========================================================================== */

.route-overview-container {
    /* Uses the same base styles as your main track container for consistency */
    max-width: 1000px;
    margin: 2rem auto;
    font-family: 'Roboto', sans-serif;
}

.route-section {
    margin-bottom: 3rem;
}

.route-section-title {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    color: #1f2937;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.overview-grid {
    display: grid;
    /* Creates a responsive grid of cards */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.route-card {
    display: block;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-decoration: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.route-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.route-card-number {
    position: absolute;
    top: -20px;
    right: 5px;
    font-size: 4rem;
    font-weight: 800;
    color: #f3f4f6;
    z-index: 1;
}

.route-card-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.route-card-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    font-size: 1rem;
    color: #4b5563;
    position: relative;
    z-index: 2;
}

.route-card-stats i {
    margin-right: 0.5rem;
    color: #009540; /* Brand Green */
}