/**
 * TrailLab Event Management - Frontend Styles
 * Version: 1.0.0
 */

/* Event Overview Section */
.traillab-event-overview {
    background: #f5f9ff;
    border-left: 4px solid #0073aa;
    padding: 25px;
    margin: 30px 0;
    border-radius: 8px;
}

.event-meta-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-meta-item {
    font-size: 16px;
    line-height: 1.6;
}

.event-meta-item strong {
    color: #333;
}

.event-short-description {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    font-size: 18px;
    line-height: 1.8;
    color: #555;
}

/* Event Registration Section */
.traillab-event-registration {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    margin: 30px 0;
}

.traillab-event-registration h2 {
    margin-top: 0;
    color: #333;
    font-size: 28px;
    border-bottom: 3px solid #0073aa;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.race-distance-option {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

.race-distance-option:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.race-distance-option h3 {
    margin-top: 0;
    color: #0073aa;
    font-size: 22px;
}

.race-distance-option .distance-details {
    margin: 15px 0;
    line-height: 1.6;
}

.race-distance-option .price {
    font-size: 24px;
    color: #333;
    margin: 15px 0;
}

.race-distance-option .price strong {
    font-weight: 600;
}

.race-distance-option .stock-info {
    color: #666;
    font-size: 14px;
    margin: 10px 0;
}

.race-distance-option .add-to-cart-button {
    display: inline-block;
    background: #0073aa;
    color: #fff !important;
    padding: 12px 30px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s ease;
}

.race-distance-option .add-to-cart-button:hover {
    background: #005177;
}

.race-distance-option .sold-out {
    color: #d63638;
    font-size: 18px;
    font-weight: bold;
    padding: 10px;
    background: #ffe8e8;
    border-radius: 4px;
    text-align: center;
}

/* Distance Info Badges */
.distance-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

.distance-badge,
.elevation-badge,
.difficulty-badge,
.cutoff-badge {
    display: inline-block;
    padding: 6px 12px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.distance-badge {
    background: #e3f2fd;
    color: #1976d2;
}

.elevation-badge {
    background: #f3e5f5;
    color: #7b1fa2;
}

.difficulty-badge {
    background: #fff3e0;
    color: #f57c00;
}

.cutoff-badge {
    background: #fce4ec;
    color: #c2185b;
}

/* Cart Merchandise */
.traillab-cart-merchandise {
    margin: 40px 0;
    padding: 30px;
    background: #FFFFFF;
    border: 2px solid #0D1B2A;
}

.traillab-cart-merchandise h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 700;
    color: #0D1B2A;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.traillab-cart-merchandise .merchandise-description {
    margin: 0 0 25px 0;
    font-size: 14px;
    color: #666666;
}

.traillab-cart-merchandise .related-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.traillab-cart-merchandise .related-product-item {
    border: 1px solid #E0E0E0;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    background: #FFFFFF;
}

.traillab-cart-merchandise .related-product-item:hover {
    border-color: #D32F2F;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.traillab-cart-merchandise .related-product-item img {
    width: 100%;
    height: auto;
    margin-bottom: 10px;
    display: block;
}

.traillab-cart-merchandise .related-product-item h4 {
    margin: 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #0D1B2A;
}

.traillab-cart-merchandise .related-product-item h4 a {
    color: #0D1B2A;
    text-decoration: none;
}

.traillab-cart-merchandise .related-product-item h4 a:hover {
    color: #D32F2F;
}

.traillab-cart-merchandise .related-product-item .price {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #D32F2F;
    margin: 10px 0;
}

.traillab-cart-merchandise .related-product-item .button {
    display: inline-block;
    padding: 10px 20px;
    background: #0D1B2A;
    color: #FFFFFF;
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.traillab-cart-merchandise .related-product-item .button:hover {
    background: #D32F2F;
    color: #FFFFFF;
}

/* Related Products */
.traillab-related-products {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin: 20px 0;
}

.traillab-related-products h3 {
    margin-top: 0;
    color: #333;
    font-size: 22px;
}

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.related-product-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    transition: box-shadow 0.3s ease;
}

.related-product-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.related-product-item img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.related-product-item h4 {
    font-size: 16px;
    margin: 10px 0;
}

.related-product-item .price {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #0073aa;
    margin: 10px 0;
}

.related-product-item .button {
    display: inline-block;
    background: #0073aa;
    color: #fff !important;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s ease;
}

.related-product-item .button:hover {
    background: #005177;
}

/* Archive Hero Image */
/* Archive Hero Slider Container */
.archive-hero-slider-container {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-top: -64px;
    margin-bottom: 40px;
    overflow: hidden;
    display: block;
    background: #F5F5F5;
    position: relative;
    height: 50vh;
    min-height: 400px;
    max-height: 600px;
}

.archive-hero-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.archive-hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    z-index: 1;
}

.archive-hero-slide.active {
    opacity: 1;
    z-index: 2;
}

.archive-hero-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    /* Optimize image rendering for smooth, high-quality scaling */
    image-rendering: -webkit-optimize-contrast; /* Safari - smooth scaling */
    image-rendering: smooth; /* Standard - smooth scaling for photos */
    image-rendering: auto; /* Fallback */
    -ms-interpolation-mode: bicubic; /* IE/Edge - smooth interpolation */
    /* Force hardware acceleration for smoother rendering */
    backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    will-change: transform;
}

/* Slider Thumbnail Indicators */
.archive-hero-slider-thumbnails {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.slider-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    border: 3px solid transparent;
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
    outline: none;
    overflow: hidden;
    position: relative;
    opacity: 0.7;
}

.slider-thumbnail:hover {
    opacity: 1;
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
}

.slider-thumbnail.active {
    opacity: 1;
    border-color: #FFFFFF;
    border-width: 3px;
    transform: scale(1.15);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.slider-thumbnail .thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 2px;
}

@media (min-width: 768px) {
    .archive-hero-slider-container {
        height: 60vh;
        min-height: 500px;
    }
}

@media (min-width: 1024px) {
    .archive-hero-slider-container {
        height: 70vh;
        min-height: 600px;
        max-height: 800px;
    }
    
    .archive-hero-slider-thumbnails {
        bottom: 30px;
        gap: 10px;
        padding: 10px;
    }
    
    .slider-thumbnail {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 768px) {
    .archive-hero-slider-thumbnails {
        gap: 6px;
        padding: 6px;
        bottom: 15px;
    }
    
    .slider-thumbnail {
        width: 50px;
        height: 50px;
    }
}

/* Event Main Content */
.traillab-event-main-content {
    margin: 40px 0;
    font-size: 16px;
    line-height: 1.8;
}

/* Event Sections */
.traillab-event-sections {
    margin: 40px 0;
}

.event-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.event-section h2 {
    margin-top: 0;
    color: #333;
    font-size: 24px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

/* Collapsible Section Styles */
.event-section.collapsible {
    padding: 0;
}

.event-section.collapsible h2 {
    margin: 0;
    padding: 20px 30px;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.event-section.collapsible h2:hover {
    background: #f8f8f8;
}

.event-section.collapsible.collapsed h2 {
    border-bottom: none;
}

.event-section.collapsible .section-content {
    padding: 0 30px 30px 30px;
}

.section-toggle {
    background: #0073aa;
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 15px;
}

.section-toggle:hover {
    background: #005177;
    transform: scale(1.1);
}

.section-toggle .toggle-icon {
    display: block;
    font-weight: bold;
    line-height: 1;
}

/* Collapsed state */
.event-section.collapsed {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.event-section.collapsed:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Expanded state */
.event-section.expanded {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Section content styling */
.event-section h3 {
    color: #0073aa;
    font-size: 20px;
    margin-top: 25px;
    margin-bottom: 15px;
}

.event-section p {
    line-height: 1.8;
    margin-bottom: 15px;
}

.event-section ul,
.event-section ol {
    margin: 15px 0;
    padding-left: 30px;
}

.event-section li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.event-section table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.event-section table th,
.event-section table td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}

.event-section table th {
    background: #f5f5f5;
    font-weight: 600;
}

.event-section table tr:nth-child(even) {
    background: #fafafa;
}

/* Specific Section Styling */
.event-schedule {
    border-left: 4px solid #4caf50;
}

.event-course {
    border-left: 4px solid #2196f3;
}

.event-rules {
    border-left: 4px solid #ff9800;
}

.event-accommodation {
    border-left: 4px solid #9c27b0;
}

/* User Events in Profile */
.traillab-user-events {
    margin: 20px 0;
}

.traillab-event-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.traillab-event-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.traillab-event-card h3 a {
    color: #0073aa;
    text-decoration: none;
}

.traillab-event-card h3 a:hover {
    text-decoration: underline;
}

.traillab-event-card p {
    margin: 8px 0;
    color: #666;
}

.traillab-event-card p strong {
    color: #333;
}

.traillab-event-card .status {
    color: #2e7d32;
    font-weight: 600;
    margin-top: 15px;
}

.traillab-event-card.past {
    opacity: 0.85;
}

.traillab-event-card .button {
    display: inline-block;
    background: #0073aa;
    color: #fff !important;
    padding: 8px 20px;
    border-radius: 4px;
    text-decoration: none;
    margin-top: 10px;
    transition: background 0.3s ease;
}

.traillab-event-card .button:hover {
    background: #005177;
}

/* Empty state */
.traillab-user-events p:only-child {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 6px;
}

/* Responsive */
@media (max-width: 768px) {
    .traillab-event-overview {
        padding: 20px;
    }
    
    .traillab-event-registration {
        padding: 20px;
    }
    
    .race-distance-option {
        padding: 15px;
    }
    
    .race-distance-option h3 {
        font-size: 20px;
    }
    
    .race-distance-option .price {
        font-size: 20px;
    }
    
    .event-section {
        padding: 20px;
    }
    
    .event-section h2 {
        font-size: 20px;
    }
}

/* Registration Status Messages */
.registration-status {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
}

.related.products {
    .registration-status {
        display: none;
    }
}

.registration-status.not-open {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.registration-status.paused {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.registration-status.closed {
    background: #d6d8d9;
    color: #383d41;
    border: 1px solid #c6c8ca;
}

.price-change-notice {
    color: #856404;
    background: #fff3cd;
    padding: 4px 8px;
    border-radius: 3px;
    display: inline-block;
    margin-top: 5px;
}

/* ========================================
   EVENTS ARCHIVE - BRUTAL DESIGN
   ======================================== */

.traillab-events-archive {
    background: #FFFFFF;
    min-height: 100vh;
    padding: 64px 0;
    width: 100%;
}

.archive-container {
    width: 100%;
    padding: 0 32px;
}

/* Events Map Container */
.events-map-container {
    width: 100%;
    margin-bottom: 64px;
    border: 1px solid #E0E0E0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.events-map {
    width: 100%;
    height: 500px;
    background: #f5f5f5;
}

.map-info-window {
    padding: 8px;
    min-width: 200px;
}

/* Tilt Google Maps InfoWindow to match event card design */
.gm-style-iw-d {
    transform: skewX(-5deg) !important;
}

.gm-style-iw-c {
    transform: skewX(-5deg) !important;
}

.map-info-window h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    /* Color will be set inline via theme color */
}

.map-info-window h3 a {
    text-decoration: none;
    transition: opacity 0.2s ease;
    /* Color will be set inline via theme color */
}

.map-info-window h3 a:hover {
    opacity: 0.8;
}

.map-info-window p {
    margin: 0;
    font-size: 14px;
    /* Color will be set inline via theme color */
}

.map-api-key-missing {
    padding: 24px;
    background: #FFF3CD;
    border: 1px solid #FFC107;
    border-radius: 4px;
    margin-bottom: 32px;
}

.map-api-key-missing p {
    margin: 0;
    font-size: 14px;
    color: #856404;
}

.map-api-key-missing code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

.map-no-events {
    padding: 24px;
    background: #F5F5F5;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    margin-bottom: 32px;
    text-align: center;
}

.map-no-events p {
    margin: 0;
    font-size: 14px;
    color: #666666;
}

/* Archive Header */
.archive-header {
    text-align: center;
    margin-bottom: 64px;
    padding-bottom: 32px;
    border-bottom: 1px solid #E0E0E0;
}

.archive-title {
    font-size: 42px;
    font-weight: 700;
    color: #0D1B2A;
    margin: 0 0 12px 0;
    letter-spacing: -0.5px;
}

.archive-description {
    font-size: 18px;
    color: #666666;
    margin: 0;
    font-weight: 400;
}

/* Filter Bar */
.events-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 48px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    background: #FFFFFF;
    border: 1px solid #E0E0E0;
    border-radius: 24px;
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #424242;
}

.filter-btn:hover {
    background: #F5F5F5;
    border-color: #D32F2F;
    color: #0D1B2A;
}

.filter-btn.active {
    background: #0D1B2A;
    color: #FFFFFF;
    border-color: #0D1B2A;
}

/* Series filter (single select) */
.series-filter {
    display: inline-flex;
    position: relative;
}

.series-filter::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 50%;
    width: 7px;
    height: 7px;
    margin-top: -5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    pointer-events: none;
    color: #424242;
}

.events-filters .series-filter-select {
    /* !important: keep the theme/site form styles from restyling this select */
    appearance: none;
    -webkit-appearance: none;
    background: #FFFFFF !important;
    border: 1px solid #E0E0E0 !important;
    border-radius: 24px !important;
    padding: 10px 44px 10px 24px !important;
    height: auto !important;
    margin: 0 !important;
    box-shadow: none !important;
    font: inherit;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #424242 !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.events-filters .series-filter-select:hover,
.events-filters .series-filter-select:focus {
    border-color: #D32F2F !important;
    color: #0D1B2A !important;
    outline: none;
}

.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

/* Events Grid */
.events-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 84px;
    margin-bottom: 64px;
    padding: 0 32px;
}

/* Event Card - Horizontal Layout */
.event-card {
    background: #FFFFFF;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    transition: all 0.3s ease;
    display: grid;
    grid-template-columns: 280px 1fr auto;
    min-height: 380px;
    overflow: hidden;
    max-height: 375px;
    transform: skewX(-5deg);
}

.event-card:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    transform: translateY(-4px) skewX(-5deg);
}

/* Event Image Section */
.event-card-image {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    min-height: 380px;
    transform: translateX(1px);
}

.event-featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    min-height: 380px;
}

.event-placeholder-image {
    width: 100%;
    height: 100%;
    min-height: 380px;
    background: linear-gradient(135deg, #0D1B2A 0%, #1a2f45 100%);
    position: relative;
}

.event-placeholder-image::before {
    content: '📸';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 64px;
    opacity: 0.3;
}

/* Date Badge */
.event-date-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: #D32F2F;
    color: #FFFFFF;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
    z-index: 2;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Registration Status Badge */
.event-registration-badge {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.95);
    color: #0D1B2A;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

/* Card Content Section */
.event-card-content {
    margin: 24px 0;
    padding: 0 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-left: 8px solid var(--theme-color, #D32F2F);
}

/* ITRA Points Vertical Component */
.event-itra-points-vertical {
    width: 45px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 16px 8px;
    gap: 12px;
    background: linear-gradient(180deg, var(--theme-color, #D32F2F) 0%, rgba(211, 47, 47, 0.9) 100%);
    border-left: 2px solid rgba(255, 255, 255, 0.2);
    align-self: stretch;
    min-height: 100%;
    height: 100%;
}

.itra-point-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

.itra-point-value {
    font-size: 18px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1;
    margin-bottom: 2px;
    letter-spacing: -0.5px;
}

.itra-point-label {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #FFFFFF;
    text-transform: uppercase;
    opacity: 0.9;
}

.event-card-header {
    margin-bottom: 24px;
}

.event-card-title {
    font-size: 26px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.event-card-title a {
    color: #0D1B2A;
    text-decoration: none;
    transition: color 0.2s ease;
}

.event-card-title a:hover {
    color: var(--theme-color, #D32F2F);
}

/* Event Stats Grid */
.event-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 24px;
    margin-bottom: 20px;
}

.event-stat {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9E9E9E;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #0D1B2A;
    line-height: 1;
}


/* Race Distances List */
.event-distances-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.distance-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #FFFFFF;
    border: 2px solid #E0E0E0;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    flex: 0 0 auto;
    min-width: fit-content;
    text-decoration: none;
    color: inherit;
}

.distance-badge:hover {
    background: #F5F5F5;
    border-color: var(--theme-color, #D32F2F);
    transform: translateY(-2px);
}

.distance-badge-name {
    font-weight: 700;
    color: #0D1B2A;
    white-space: nowrap;
}

.distance-badge-value {
    font-weight: 600;
    color: #666666;
    padding-left: 6px;
    border-left: 1px solid #E0E0E0;
    white-space: nowrap;
}

/* Location */
.event-location-wrapper {
    margin-bottom: 24px;
}

.location-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9E9E9E;
    margin-bottom: 6px;
}

.event-location {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #0D1B2A;
}

.location-icon {
    width: 14px;
    height: 18px;
    color: #9E9E9E;
    flex-shrink: 0;
}

/* Card Footer / CTA Button */
.event-card-footer {
    margin-top: auto;
}

.event-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #0D1B2A;
    color: #FFFFFF;
    padding: 14px 28px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    min-width: 180px;
}

.event-cta-button:hover {
    background: var(--theme-color, #D32F2F);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.event-cta-button:hover {
    color: #fff;
}

.event-cta-button svg {
    transition: transform 0.3s ease;
}

.event-cta-button:hover svg {
    transform: translateX(4px);
}

/* Pagination */
.events-pagination {
    text-align: center;
    padding-top: 48px;
    margin-top: 32px;
    border-top: 1px solid #E0E0E0;
}

.events-pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.events-pagination a,
.events-pagination .current,
.events-pagination .dots {
    display: inline-block;
    padding: 10px 16px;
    background: #FFFFFF;
    border: 1px solid #E0E0E0;
    color: #424242;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
    min-width: 44px;
    text-align: center;
}

.events-pagination a:hover {
    background: #F5F5F5;
    border-color: #0D1B2A;
    color: #0D1B2A;
}

.events-pagination .current {
    background: #0D1B2A;
    color: #FFFFFF;
    border-color: #0D1B2A;
}

.events-pagination .prev,
.events-pagination .next {
    font-weight: 600;
    padding: 10px 20px;
}

/* No Events Found */
.no-events-found {
    text-align: center;
    padding: 64px 32px;
    border: 1px solid #E0E0E0;
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.no-events-found h2 {
    font-size: 32px;
    font-weight: 700;
    color: #0D1B2A;
    margin: 0 0 16px 0;
}

.no-events-found p {
    font-size: 16px;
    color: #666666;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .event-card {
        grid-template-columns: 240px 1fr auto;
        min-height: 340px;
        transform: skewX(-2deg);
    }
    
    .event-itra-points-vertical {
        width: 40px;
        padding: 12px 6px;
        gap: 10px;
    }
    
    .event-card-content {
        padding: 24px;
    }
    
    .event-card-title {
        font-size: 24px;
    }
    
    .event-stats {
        gap: 16px;
    }
    
    .stat-value {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .traillab-events-archive {
        padding: 32px 0;
    }
    
    .archive-container {
        padding: 0 16px;
    }
    
    .archive-hero-slider-container {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
    }
    
    .archive-header {
        margin-bottom: 32px;
    }
    
    .archive-title {
        font-size: 32px;
    }
    
    .archive-description {
        font-size: 16px;
    }
    
    .events-filters {
        gap: 8px;
        margin-bottom: 32px;
    }
    
    .filter-btn {
        padding: 10px 16px;
        font-size: 12px;
    }

    .events-filters .series-filter-select {
        padding: 10px 40px 10px 16px !important;
        font-size: 12px !important;
    }
    
    .events-grid {
        gap: 24px;
        margin-bottom: 48px;
        padding: 0;
    }
    
    .events-map-container {
        margin-bottom: 32px;
    }
    
    .events-map {
        height: 350px;
    }
    
    .event-card {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        min-height: auto;
        max-height: none; /* desktop caps at 375px, which cut off the stacked card */
        transform: none; /* drop the skew on stacked cards so they fit the screen */
    }
    
    .event-card:hover {
        transform: translateY(-2px);
    }
    
    .event-itra-points-vertical {
        width: 100%;
        height: auto;
        min-height: auto;
        flex-direction: row;
        justify-content: center;
        padding: 12px;
        gap: 8px;
        border-left: none;
        border-top: 2px solid rgba(255, 255, 255, 0.2);
    }
    
    .event-card-image {
        height: 240px;
        min-height: 240px;
    }
    
    .event-featured-image,
    .event-placeholder-image {
        min-height: 240px;
    }
    
    .event-placeholder-image::before {
        font-size: 48px;
    }
    
    .event-card-content {
        padding: 20px;
    }
    
    .event-itra-points-vertical {
        width: 100%;
        height: auto;
        min-height: auto;
        flex-direction: row;
        justify-content: center;
        padding: 12px;
        gap: 8px;
        border-left: none;
        border-top: 2px solid rgba(255, 255, 255, 0.2);
    }
    
    .itra-point-item {
        padding: 6px 3px;
    }
    
    .itra-point-value {
        font-size: 16px;
    }
    
    .itra-point-label {
        font-size: 7px;
    }
    
    .event-card-title {
        font-size: 22px;
    }
    
    .event-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .event-distances-list {
        margin-bottom: 16px;
    }
    
    .distance-badge {
        font-size: 10px;
        padding: 4px 9px;
        gap: 4px;
    }
    
    .distance-badge-value {
        padding-left: 4px;
    }
    
    .event-cta-button {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   SINGLE EVENT PAGE STYLES
   ======================================== */

.traillab-single-event {
    width: 100%;
    min-height: 100vh;
    background: #FFFFFF;
}

/* Hero Section */
.event-hero-section {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    margin-bottom: 0;
}

.event-hero-image {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.event-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.event-hero-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0D1B2A 0%, #1a2f45 100%);
}

.event-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box; /* keep the padding inside the fixed-height hero so content isn't pushed past its bottom edge */
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    align-items: flex-end;
    padding: 48px;
}

.event-hero-content {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    color: #FFFFFF;
}

.event-hero-date-badge {
    display: inline-block;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.event-hero-title {
    font-size: 56px;
    font-weight: 700;
    margin: 0 0 16px 0;
    line-height: 1.2;
    letter-spacing: -1px;
    color: #FFFFFF;
}

/* Edition (year) switcher within a series: first item of the event info bar */
.traillab-single-event .event-info-edition .info-label {
    /* <label> element: keep the theme's label styles off it */
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #666666 !important;
    margin: 0 !important;
    line-height: normal !important;
}

.traillab-single-event .event-info-edition .info-value {
    position: relative;
    align-self: flex-start;
}

.traillab-single-event .event-info-edition .info-value::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 7px;
    height: 7px;
    margin-top: -6px;
    border-right: 2px solid var(--theme-color, #D32F2F);
    border-bottom: 2px solid var(--theme-color, #D32F2F);
    transform: rotate(45deg);
    pointer-events: none;
}

.traillab-single-event .event-edition-select {
    /* !important: the theme/site form styles otherwise restyle selects */
    appearance: none;
    -webkit-appearance: none;
    background: #FFFFFF !important;
    border: 2px solid #E0E0E0 !important;
    border-radius: 6px !important;
    padding: 6px 40px 6px 12px !important;
    height: auto !important;
    min-height: 0 !important;
    width: auto !important;
    margin: 0 !important;
    box-shadow: none !important;
    font: inherit;
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: #0D1B2A !important;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.traillab-single-event .event-edition-select:hover,
.traillab-single-event .event-edition-select:focus {
    border-color: var(--theme-color, #D32F2F) !important;
    outline: none;
}

.event-hero-description {
    font-size: 16px;
    line-height: 1.4;
    margin: 0 0 16px 0;
    opacity: 0.9;
    max-width: 600px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-hero-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #0D1B2A;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.event-hero-status-badge .status-indicator {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Event Info Bar */
.event-info-bar {
    background: #FFFFFF;
    border-bottom: 1px solid #E0E0E0;
    padding: 32px 0;
}

.event-info-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
}

.event-info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666666;
}

.info-value {
    font-size: 18px;
    font-weight: 600;
    color: #0D1B2A;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-value .location-icon {
    color: var(--theme-color, #D32F2F);
    flex-shrink: 0;
}

/* Main Content Area */
.event-main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 64px 32px;
}

.event-content-container {
    display: flex;
    flex-direction: column;
    gap: 64px;
}

.event-description-section {
    font-size: 18px;
    line-height: 1.8;
    color: #0D1B2A;
}

.event-description-section h2,
.event-description-section h3 {
    color: #0D1B2A;
    margin-top: 32px;
    margin-bottom: 16px;
}

/* Registration Section */
.event-registration-section {
    border-top: 2px solid var(--theme-color, #D32F2F);
    padding-top: 48px;
}

/* Distance Switcher */
.distance-switcher {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.distance-switch-btn {
    padding: 8px 16px;
    background: #FFFFFF;
    border: 2px solid #E0E0E0;
    color: #0D1B2A;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.distance-switch-btn:hover {
    border-color: var(--primary-color, #D32F2F);
    background-color: var(--primary-color, #D32F2F);
    color: #FFFFFF;
}

.distance-switch-btn.active {
    background: var(--theme-color, #D32F2F);
    border-color: var(--theme-color, #D32F2F);
    color: #FFFFFF;
}

.switch-itra-badge {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.8;
}

.distance-switch-btn.active .switch-itra-badge {
    opacity: 1;
}

.distance-content-wrapper {
    display: none;
}

.distance-content-wrapper.active,
.distance-content-wrapper[style*="display: block"] {
    display: block !important;
}

.section-title {
    font-size: 32px;
    font-weight: 700;
    color: #0D1B2A;
    margin: 0 0 32px 0;
    letter-spacing: -0.5px;
    text-transform: uppercase;
}

.distance-description {
    margin: 0;
    padding: 0;
    background: transparent;
}

.distance-description + .distance-description {
    margin-top: 0;
    border: none;
    font-size: 14px;
    line-height: 1.6;
    color: #0D1B2A;
}

/* Override event-content-sections styling when inside distance card */
.race-distance-card .distance-description .event-content-sections {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.race-distance-card .distance-description .event-section-item {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #E0E0E0;
}

.race-distance-card .distance-description .section-item-header {
    padding: 16px 0;
}

.race-distance-card .distance-description .section-item-content {
    padding-bottom: 16px;
    padding-top: 0;
}

.race-distance-card {
    background: #FFFFFF;
    border: 2px solid #E0E0E0;
    border-left: 8px solid var(--theme-color, #D32F2F);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    margin-bottom: 32px;
    position: relative;
    overflow: visible;
}

/* ITRA and UTMB Badge Images Container */
.distance-badges-container {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
}

.distance-badge-image {
    width: auto;
    height: 50px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.itra-badge-image {
    max-width: 80px;
}

.utmb-badge-image {
    max-width: 80px;
}

@media (max-width: 768px) {
    .distance-badge-image {
        height: 40px;
    }
    
    .itra-badge-image,
    .utmb-badge-image {
        max-width: 60px;
    }
    
    .distance-badges-container {
        top: 12px;
        right: 12px;
        gap: 6px;
    }
}

.race-distance-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.distance-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.distance-title {
    font-size: 20px;
    font-weight: 600;
    color: #0D1B2A;
    margin: 0;
    flex: 1;
}

.distance-itra-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 10px;
    background: linear-gradient(135deg, var(--theme-color, #D32F2F) 0%, rgba(211, 47, 47, 0.9) 100%);
    border-radius: 4px;
    min-width: 50px;
}

.distance-itra-badge .itra-value {
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1;
}

.distance-itra-badge .itra-label {
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #FFFFFF;
    text-transform: uppercase;
    margin-top: 2px;
    opacity: 0.9;
}

.distance-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.distance-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.distance-stat .stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666666;
}

.distance-stat .stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #0D1B2A;
}

.distance-price {
    padding: 12px;
    background: #F5F5F5;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.price-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666666;
}

.price-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--theme-color, #D32F2F);
}

.distance-stock {
    font-size: 14px;
    color: #666666;
    text-align: center;
}

.distance-action {
    margin-top: auto;
}

.register-button.disabled {
    cursor: not-allowed !important;
    opacity: 0.6;
    pointer-events: none;
}

.register-button.disabled:hover {
    background: var(--theme-color, #D32F2F);
    transform: none;
}

.register-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 20px;
    background: var(--theme-color, #D32F2F);
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.register-button:hover {
    background: #0D1B2A;
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.elevation-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.elevation-profile-header .elevation-profile-title {
    margin: 0;
}

/* On small phones, stack the heading and a full-width, thumb-friendly button */
@media (max-width: 480px) {
    .elevation-profile-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .elevation-profile-header .download-gpx-button {
        width: 100%;
    }
}

.download-gpx-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    padding: 8px 16px;
    background: transparent;
    color: var(--theme-color, #D32F2F);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    border-radius: 4px;
    border: 2px solid var(--theme-color, #D32F2F);
    transition: all 0.2s ease;
    cursor: pointer;
}

.download-gpx-button:hover {
    background: var(--theme-color, #D32F2F);
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sold-out-badge {
    width: 100%;
    padding: 14px 24px;
    background: #E0E0E0;
    color: #666666;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    border-radius: 4px;
}

/* Event Content Sections */
.event-content-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid #E0E0E0;
    margin-top: 48px;
}

.event-section-item {
    border-bottom: 1px solid #E0E0E0;
}

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

.section-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    position: relative;
    z-index: 1;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.section-item-header:hover {
    background: #FAFAFA;
}

.section-item-header:active {
    background: #F0F0F0;
}

.section-item-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #0D1B2A;
}

.section-item-chevron {
    color: #0D1B2A;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.event-section-item.expanded .section-item-chevron {
    transform: rotate(180deg);
}

.section-item-content {
    display: none;
    padding-bottom: 24px;
    font-size: 16px;
    line-height: 1.8;
    color: #0D1B2A;
}

.event-section-item.expanded .section-item-content {
    display: block;
}

/* Checkpoints List (nested within Checkpoints section) */
.checkpoints-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 12px;
}

.checkpoint-item {
    border-bottom: 1px solid #E8E8E8;
    background: #FAFAFA;
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

.checkpoint-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.checkpoint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.checkpoint-header.no-content {
    cursor: default;
}

.checkpoint-header:hover {
    background: #F0F0F0;
}

.checkpoint-header.no-content:hover {
    background: transparent;
}

.checkpoint-name {
    font-size: 13px;
    font-weight: 600;
    color: #0D1B2A;
    letter-spacing: 0.3px;
}

.checkpoint-chevron {
    color: #666666;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.checkpoint-item.expanded .checkpoint-chevron {
    transform: rotate(180deg);
}

.checkpoint-content {
    display: none;
    padding: 0 16px 12px 16px;
    color: #666666;
    font-size: 13px;
    line-height: 1.6;
}

.checkpoint-item.expanded .checkpoint-content {
    display: block;
}

/* Nested checkpoint items within distance description */
.race-distance-card .distance-description .checkpoints-list {
    margin-top: 12px;
}

.race-distance-card .distance-description .checkpoint-item {
    background: #F9F9F9;
    border: 1px solid #E8E8E8;
}

.race-distance-card .distance-description .checkpoint-header {
    padding: 10px 14px;
}

.race-distance-card .distance-description .checkpoint-content {
    padding: 0 14px 10px 14px;
}

/* Results Section */
.event-results-section {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid #e5e7eb;
}

.event-results-section .event-section-title {
    font-size: 1.75rem;
    font-weight: 900;
    color: #0D1B2A;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.event-results-section .event-section-title::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: var(--theme-color, #D32F2F);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ------------------------------------------------------------------
 * RaceResult results widget (RRPublish) restyled to match the site.
 * The widget renders into .event-leaderboard-embed and sets some colors
 * inline, hence the !important on those.
 * ------------------------------------------------------------------ */
.event-leaderboard-embed .RRPublish,
.event-leaderboard-embed {
    font-family: inherit;
    color: #0D1B2A;
    font-size: 14px;
}

/* Search bar */
.event-leaderboard-embed .ListControl {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.event-leaderboard-embed .ListControlSearch {
    display: flex;
    align-items: center;
    gap: 6px;
}

.event-leaderboard-embed .ListControlSearch input {
    border: 1px solid #E0E0E0 !important;
    border-radius: 24px !important;
    padding: 9px 16px !important;
    font: inherit;
    font-size: 14px !important;
    color: #0D1B2A !important;
    background: #FFFFFF !important;
    min-width: 220px;
    height: auto !important;
    box-shadow: none !important;
}

.event-leaderboard-embed .ListControlSearch input:focus {
    border-color: var(--theme-color, #D32F2F) !important;
    outline: none;
}

.event-leaderboard-embed .ListControlSearch button,
.event-leaderboard-embed .ListBack {
    background-color: #FFFFFF !important; /* not the shorthand: the clear/favorite buttons use background-image icons */
    border: 1px solid #E0E0E0 !important;
    border-radius: 24px !important;
    padding: 8px 12px !important;
    color: #424242 !important;
    cursor: pointer;
    line-height: 1;
    box-shadow: none !important;
}

.event-leaderboard-embed .ListControlSearch button:hover,
.event-leaderboard-embed .ListBack:hover {
    border-color: var(--theme-color, #D32F2F) !important;
}

/* Contest / gender / age-group filters: keep RaceResult's own layout (it swaps desktop/mobile
   versions at 640px), only bring in our colors. RaceResult colors its accents with --brandColorDark. */
.event-leaderboard-embed .RRPublish,
.event-leaderboard-embed > div {
    --brandColorDark: var(--theme-color, #D32F2F) !important;
}

.event-leaderboard-embed .RRSelectorParent {
    margin-bottom: 16px;
    background-color: #FFFFFF !important;
}

.event-leaderboard-embed .RRSelectorParent select {
    color: #0D1B2A !important;
    font-family: inherit !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.event-leaderboard-embed .RRSelectorParent .hasLabel > span {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Table */
.event-leaderboard-embed .MainDiv {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
}

.event-leaderboard-embed table.MainTable {
    width: 100%;
    border-collapse: collapse !important;
    border: 0 !important;
    margin: 0 !important;
    font-size: 14px;
    background: #FFFFFF;
}

.event-leaderboard-embed table.MainTable th {
    background: #F8F8F8 !important;
    color: #666666 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 12px 10px !important;
    border: 0 !important;
    border-bottom: 1px solid #E0E0E0 !important;
    white-space: nowrap;
}

.event-leaderboard-embed table.MainTable td {
    padding: 11px 10px !important;
    border: 0 !important;
    border-bottom: 1px solid #F0F0F0 !important;
    color: #0D1B2A !important;   /* overrides RaceResult's inline colors (e.g. blue age group) */
    vertical-align: middle;
    white-space: nowrap;
    overflow-wrap: normal !important; /* RaceResult sets "anywhere" inline, which splits names letter by letter */
    word-break: normal !important;
    background: transparent;
}

.event-leaderboard-embed table.MainTable tr.Hover:hover td {
    background: #FAFAFA !important;
}

/* Rank and time columns stand out a little */
.event-leaderboard-embed table.MainTable tr.Hover td:nth-child(2) {
    font-weight: 700;
}

/* Group headers (distance, then gender): RaceResult paints them red/grey inline */
.event-leaderboard-embed table.MainTable td.listGrouping {
    background: #0D1B2A !important;
    color: #FFFFFF !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 12px !important;
    border-left: 4px solid var(--theme-color, #D32F2F) !important;
}

.event-leaderboard-embed table.MainTable tbody + tbody td.listGrouping {
    border-top: 0 !important;
}

/* Second-level group rows (gender, age group): tagged .rr-subgroup by single-event.php */
.event-leaderboard-embed table.MainTable td.listGrouping.rr-subgroup {
    background: #F1F3F5 !important;
    color: #0D1B2A !important;
}

/* Collapsible detail rows (club, pace) */
.event-leaderboard-embed table.MainTable tr.brokeCols td {
    font-size: 12px !important;
    color: #666666 !important;
    background: #FCFCFC !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}

.event-leaderboard-embed table.MainTable tr.brokeCols td > div {
    display: inline-flex;
    gap: 4px;
    margin-right: 16px;
}

.event-leaderboard-embed table.MainTable a {
    color: var(--theme-color, #D32F2F) !important;
}

/* Favorite star column + timer logo footer: quieter */
.event-leaderboard-embed .RRPStar {
    opacity: 0.4;
}

.event-leaderboard-embed .RRPStar:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .event-leaderboard-embed .ListControlSearch input {
        min-width: 0;
        width: 100%;
    }

    .event-leaderboard-embed .ListControlSearch {
        flex: 1 1 100%;
    }

    .event-leaderboard-embed table.MainTable {
        font-size: 13px;
    }

    .event-leaderboard-embed table.MainTable td,
    .event-leaderboard-embed table.MainTable th {
        padding: 9px 8px !important;
    }
}

/* Race photos (Witisi) */
.event-photos-section {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid #e5e7eb;
}

.event-photos-section .event-section-title {
    font-size: 1.75rem;
    font-weight: 900;
    color: #0D1B2A;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.event-photos-section .event-section-title::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: var(--theme-color, #D32F2F);
    border-radius: 2px;
    flex-shrink: 0;
}

.event-photos-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 28px;
    background: #F8F8F8;
    border: 1px solid #E0E0E0;
    border-left: 4px solid var(--theme-color, #D32F2F);
    border-radius: 8px;
}

.event-photos-text p {
    margin: 0;
}

.event-photos-lead {
    font-size: 18px;
    font-weight: 700;
    color: #0D1B2A;
    margin-bottom: 6px !important;
}

.event-photos-note {
    font-size: 14px;
    color: #666666;
    max-width: 520px;
}

.event-photos-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.event-photos-search input {
    border: 1px solid #E0E0E0 !important;
    border-radius: 24px !important;
    padding: 10px 16px !important;
    font: inherit;
    font-size: 14px !important;
    width: 140px;
    height: auto !important;
    background: #FFFFFF !important;
    color: #0D1B2A !important;
    box-shadow: none !important;
}

.event-photos-search input:focus {
    border-color: var(--theme-color, #D32F2F) !important;
    outline: none;
}

.event-photos-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 2px solid #0D1B2A;
    border-radius: 24px;
    background: #FFFFFF;
    color: #0D1B2A !important;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.2;
}

.event-photos-btn:hover {
    background: #0D1B2A;
    color: #FFFFFF !important;
}

.event-photos-btn--primary {
    background: var(--theme-color, #D32F2F);
    border-color: var(--theme-color, #D32F2F);
    color: #FFFFFF !important;
}

.event-photos-btn--primary:hover {
    background: #0D1B2A;
    border-color: #0D1B2A;
}

@media (max-width: 768px) {
    .event-photos-card {
        padding: 20px;
    }

    .event-photos-search input {
        flex: 1 1 100%;
        width: 100%;
    }

    .event-photos-btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}

.results-filters {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 150px;
    flex: 1;
}

.filter-group label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.results-filter {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background: white;
    color: #111827;
    cursor: pointer;
    transition: all 0.2s;
}

.results-filter:focus {
    outline: none;
    border-color: var(--theme-color, #D32F2F);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.clear-filters-btn {
    padding: 0.5rem 1.25rem;
    background: var(--theme-color, #D32F2F);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    height: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.clear-filters-btn:hover {
    filter: brightness(0.9);
    background-color: var(--primary-color, #D32F2F);
}

.results-table-container {
    overflow-x: auto;
    margin-bottom: 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
}

.results-table thead {
    background: #0D1B2A;
}

.results-table th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: none;
}

.results-table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: #111827;
    border-bottom: 1px solid #f1f5f9;
}

.results-table td:first-child {
    font-weight: 700;
    color: var(--theme-color, #D32F2F);
}

.results-table tbody tr {
    transition: background 0.15s;
}

.results-table tbody tr:hover {
    background: #f8fafc;
}

.results-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.results-table tbody tr:nth-child(even):hover {
    background: #f1f5f9;
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.status-finished {
    background: #dcfce7;
    color: #166534;
}

.status-badge.status-dnf {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.status-dns {
    background: #fef3c7;
    color: #92400e;
}

.results-count {
    font-size: 0.8125rem;
    color: #64748b;
    margin-top: 0.75rem;
    font-weight: 500;
}

.no-results {
    padding: 4rem 2rem;
    text-align: center;
    color: #94a3b8;
    font-size: 1rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    border: 1px dashed #e2e8f0;
}

@media (max-width: 768px) {
    .results-filters {
        flex-wrap: wrap;
    }
    
    .filter-group {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: 120px;
    }
    
    .clear-filters-btn {
        flex: 1 1 100%;
        margin-top: 0.25rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 0.625rem 0.5rem;
        font-size: 0.75rem;
    }
}

.section-item-content p {
    margin-bottom: 16px;
}

.section-item-content h3,
.section-item-content h4 {
    color: #0D1B2A;
    margin-top: 24px;
    margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .event-hero-section {
        height: 400px;
    }
    
    .event-hero-overlay {
        padding: 32px 24px;
    }
    
    .event-hero-title {
        font-size: 36px;
    }
    
    .event-hero-description {
        font-size: 16px;
    }
    
    .event-info-container {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 0 24px;
    }
    
    .event-main-content {
        padding: 48px 24px;
    }
    
    .distance-switcher {
        gap: 6px;
    }
    
    .distance-switch-btn {
        padding: 7px 12px;
        font-size: 11px;
        flex: 1 1 auto;
        justify-content: center;
    }
    
    .race-distance-card {
        padding: 20px;
    }
    
    .distance-track-map {
        margin-top: 24px;
    }
    
    .track-map-container {
        height: 350px;
        min-height: 350px;
    }
    
    .section-item-header:hover {
        margin: 0 -24px;
        padding: 20px 24px;
    }
}

/* Track Map Styles */
.view-track-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px;
    margin-top: 12px;
    background: #FFFFFF;
    color: var(--theme-color, #D32F2F);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid var(--theme-color, #D32F2F);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-track-button:hover {
    background: var(--theme-color, #D32F2F);
    color: #FFFFFF;
}

/* Checkpoint tooltip on elevation chart */
.traillab-cp-tooltip {
    display: none;
    position: absolute;
    background: rgba(13, 27, 42, 0.82);
    color: #FFFFFF;
    padding: 10px 14px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 6px;
    min-width: 200px;
    max-width: 260px;
    pointer-events: none;
    z-index: 10;
    white-space: normal;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.traillab-cp-tooltip--visible {
    opacity: 1;
    transform: translateX(0);
}

.traillab-cp-tooltip strong {
    font-weight: 700;
    font-size: 13px;
    display: block;
    margin-bottom: 3px;
}

.traillab-cp-desc {
    display: block;
    font-size: 11px;
    opacity: 0.75;
    margin-bottom: 7px;
}

.traillab-cp-stats {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 7px;
}

.traillab-cp-stats li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 11px;
    padding: 2px 0;
}

.traillab-cp-stats li span:first-child {
    opacity: 0.7;
    white-space: nowrap;
}

.traillab-cp-stats li span:last-child {
    font-weight: 600;
    white-space: nowrap;
}

/* Elevation Profile */
.elevation-profile-section {
    margin-top: 32px;
    margin-bottom: 32px;
}

.elevation-profile-title {
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #0D1B2A;
    margin: 0 0 16px 0;
}

.elevation-profile-container {
    width: 100%;
    height: 300px;
    position: relative;
    background: #FFFFFF;
    border: 2px solid #E0E0E0;
    border-radius: 4px;
    padding: 16px;
}

.elevation-profile-container canvas {
    max-height: 100%;
}

.distance-track-map {
    margin-top: 32px;
    border: 2px solid #E0E0E0;
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
}

.track-map-container {
    width: 100%;
    height: 500px;
    min-height: 500px;
}

.gm-style-mtc-bbw {
    display: flex !important;
    flex-direction: row-reverse !important;
}