/**
 * Strava Challenges CSS
 * Styles for the [strava_challenges] shortcode
 */

.strava-challenges-container {
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.strava-challenges-empty {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
}

.strava-challenges-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.challenge-card {
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 25px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.challenge-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.challenge-header {
    position: relative;
}

.challenge-header h2 {
    margin: 0 0 10px 0;
    color: #333;
}

.challenge-edit-link {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.85em;
    color: #6b7280;
    text-decoration: none;
    padding: 4px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #f9fafb;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.challenge-edit-link:hover {
    color: #2563eb;
    border-color: #2563eb;
    background: #eff6ff;
    text-decoration: none;
}

.challenge-edit-link::before {
    content: '✏️';
    font-size: 0.9em;
}

.challenge-description {
    color: #666;
    line-height: 1.6;
}

.challenge-meta {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.challenge-meta span {
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    color: #374151;
}

.challenge-routes-section {
    margin-bottom: 10px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    min-width: 0;
    position: relative;
}

.challenge-routes-section h3 {
    margin: 15px 0 10px;
    color: #495057;
}

/* Routes grid container */
.strava-routes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .strava-routes-grid {
        grid-template-columns: 1fr;
    }
}

/* Route card */
.route-card {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
    width: 100%;
}

.route-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    background: transparent;
    transition: background 0.2s ease;
    pointer-events: none;
    z-index: 0;
}

.route-card > * {
    position: relative;
    z-index: 1;
}

.route-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-color: #3b82f6;
}

.route-card:hover::before {
    background: rgba(59, 130, 246, 0.05);
}

.route-card.is-active {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.route-card.is-active::before {
    background: rgba(59, 130, 246, 0.1);
}

.route-card.is-active:hover {
    border-color: #2563eb;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.route-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Make route map and embeds non-clickable for tab switching */
.route-card .route-map,
.route-card .route-map iframe,
.route-card .strava-embed-placeholder,
.route-card .participation-embed,
.route-card .participation-embed iframe {
    pointer-events: auto;
    cursor: default;
}

.route-header {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 80px; /* Standard height to prevent inconsistency */
}

.route-header-top {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.route-header-top .strava-save-activity-btn {
    flex: 1;
    width: 100%;
    font-size: 0.9em;
    padding: 8px 12px;
    white-space: normal;
    text-align: center;
    min-height: 36px;
}

.route-header-top .strava-remove-route-btn {
    font-size: 0.9em;
    padding: 8px 12px;
    min-width: 36px;
    height: 36px;
    line-height: 1;
    flex-shrink: 0;
    position: relative;
    z-index: 100; /* High z-index to ensure it's above route card */
    pointer-events: auto; /* Ensure clicks are captured */
}

.route-header-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 24px; /* Ensure consistent height for title row */
}

.route-name {
    margin: 0;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
    flex: 1;
    width: 100%;
    line-height: 1.3;
    word-wrap: break-word;
}

.route-activity-count {
    font-size: 0.85em;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.route-description {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 0.9em;
    line-height: 1.5;
}

.route-description p {
    margin: 0;
}

.route-stats {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.route-stat-item {
    display: flex;
    flex-direction: column;
    min-width: 80px;
}

.route-stat-label {
    font-size: 0.75em;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-weight: 600;
}

.route-stat-value {
    font-size: 0.95em;
    color: #212529;
    font-weight: 500;
}

.route-map iframe,
.available-route-map iframe {
    width: 100%;
    min-width: 250px;
    max-width: 100%;
    height: 400px;
    display: block;
    border-radius: 8px;
    border: none;
}

/* Route actions removed - Save Activity button moved to header */
.route-actions {
    display: none;
    flex-wrap: wrap;
}

.button-strava,
.strava-save-activity-btn,
.strava-add-route-btn,
.strava-remove-route-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 4px;
    border: none;
    font-size: 0.75em;
    cursor: pointer;
    font-weight: 600;
    min-width: 28px;
    height: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.button-strava {
    background: #fc4c02;
    color: #fff;
    text-decoration: none;
}

.strava-save-activity-btn {
    background: #007bff;
    color: #fff;
}

.strava-toggle-add-routes-btn {
    background: #6f42c1;
    color: #fff;
}

.strava-remove-route-btn {
    background: #dc3545;
    color: #fff;
    position: relative;
    z-index: 1000; /* Very high z-index to ensure it's above everything */
    pointer-events: auto; /* Ensure clicks are captured */
    isolation: isolate; /* Create new stacking context */
}

.strava-add-route-btn {
    background: #28a745;
    color: #fff;
}

.strava-add-route-btn:hover,
.strava-remove-route-btn:hover,
.strava-toggle-add-routes-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.strava-add-route-btn:disabled,
.strava-remove-route-btn:disabled,
.strava-save-activity-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.coordinator-controls {
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.coordinator-controls__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
    flex-wrap: wrap;
}

.available-routes-sync-row {
    margin-bottom: 15px;
}

.available-routes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 15px;
}

.available-route-card {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    background: #f8f9fa;
    position: relative;
}

.available-route-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 5px;
}

.available-route-name {
    font-weight: 600;
    color: #333;
    flex: 1;
}

.available-route-meta {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
}

.challenge-route-tabs {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #f0f0f0;
}

.route-tabs-heading {
    margin-top: 0;
    margin-bottom: 10px;
}

.route-tabs-heading h3 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1.2em;
}

.route-tabs-heading p {
    margin: 0;
    font-size: 0.9em;
    color: #666;
}

.route-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.route-tab {
    border: 1px solid #d1d5db;
    background: #f3f4f6;
    color: #374151;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.route-tab:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #111827;
}

.route-tab.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.route-tab.is-active:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.route-tab-count {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.8em;
}

.route-tab .route-tab-count {
    background: rgba(0, 0, 0, 0.1);
    color: #6b7280;
}

.route-tab.is-active .route-tab-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.route-tab-panels {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 15px;
    background: #fff;
    margin-top: 10px;
}

/* User View */
.challenge-user-view {
    margin-top: 20px;
}

.user-view-heading {
    margin-bottom: 20px;
}

.user-view-heading h3 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1.3em;
}

.user-view-heading p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

/* Ranking Type Selector */
.ranking-type-selector {
    margin: 15px 0;
}

.ranking-type-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ranking-type-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.ranking-type-btn:hover {
    background: #f5f5f5;
    border-color: #0073aa;
}

.ranking-type-btn.is-active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* Ranking Content */
.challenge-rankings-container {
    margin-top: 20px;
}

.ranking-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

.ranking-content {
    margin-top: 15px;
}

.ranking-table-wrapper {
    overflow-x: auto;
    margin: 15px 0;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.ranking-table th {
    background: #f5f5f5;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #ddd;
    font-weight: 600;
    font-size: 14px;
}

.ranking-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.ranking-table tbody tr:hover {
    background: #f9f9f9;
}

.ranking-table tbody tr.current-user {
    background: #e8f4f8;
    font-weight: 500;
}

.ranking-table tbody tr.podium-1 {
    background: #fff9e6;
}

.ranking-table tbody tr.podium-2 {
    background: #f5f5f5;
}

.ranking-table tbody tr.podium-3 {
    background: #fef5e7;
}

.ranking-table tbody tr.incomplete {
    opacity: 0.7;
}

.ranking-table tbody tr.ranking-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.ranking-table tbody tr.ranking-row.is-expanded {
    background: #e8f4f8;
}

.ranking-table tbody tr.ranking-row.is-expanded .expand-icon {
    transform: rotate(90deg);
}

.expand-icon {
    display: inline-block;
    margin-right: 8px;
    color: #666;
    font-size: 0.8em;
    transition: transform 0.2s;
    vertical-align: middle;
}

.ranking-details-row {
    background: #f9f9f9;
}

.ranking-details-cell {
    padding: 0 !important;
    border-top: 2px solid #ddd;
}

.ranking-details-content {
    padding: 20px;
}

.ranking-details-title {
    margin: 0 0 15px 0;
    font-size: 1em;
    font-weight: 600;
    color: #333;
}

.ranking-details-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.ranking-details-table thead {
    background: #e8e8e8;
}

.ranking-details-table th {
    padding: 10px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    border-bottom: 1px solid #ddd;
}

.ranking-details-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
}

.ranking-details-table tbody tr:last-child {
    border-bottom: none;
}

.ranking-details-total {
    background: #f0f0f0;
    border-top: 2px solid #ccc;
}

.ranking-details-total td {
    padding-top: 12px;
    padding-bottom: 12px;
}

.you-badge {
    color: #0073aa;
    font-size: 0.9em;
    margin-left: 5px;
}

.status-complete {
    color: #46b450;
}

.status-incomplete {
    color: #dc3232;
}

.ranking-empty,
.ranking-error,
.ranking-placeholder {
    padding: 20px;
    text-align: center;
    color: #666;
    background: #f9f9f9;
    border-radius: 4px;
}

.ranking-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.ranking-stats {
    margin-top: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Podium Section (Top 3) */
.ranking-podium-section {
    margin-bottom: 30px;
}

.ranking-podium-title {
    margin: 0 0 20px 0;
    font-size: 1.3em;
    font-weight: 600;
    text-align: center;
}

.ranking-podium-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.ranking-gender-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
}

.ranking-gender-title {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

/* Full Rankings Accordion */
.ranking-full-accordion {
    margin-top: 30px;
}

.ranking-full-toggle {
    width: 100%;
    padding: 15px 20px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.ranking-full-toggle:hover {
    background: #e8e8e8;
}

.ranking-full-toggle .toggle-icon {
    transition: transform 0.3s;
}

.ranking-full-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.ranking-full-content {
    margin-top: 15px;
}

.ranking-full-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* All Participants Section */
.ranking-all-participants-section {
    margin-top: 40px;
}

.ranking-all-title {
    margin: 0 0 20px 0;
    font-size: 1.3em;
    font-weight: 600;
    text-align: center;
}

.ranking-all-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Route Ranking Tables */
.route-ranking-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
    width: 100%;
}

/* Overall Ranking Gender Tables */
.ranking-gender-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
    width: 100%;
}

.route-gender-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
}

.route-gender-title {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .ranking-podium-tables,
    .ranking-full-tables,
    .ranking-all-tables,
    .route-ranking-tables,
    .ranking-gender-tables {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ranking-gender-section,
    .route-gender-section {
        margin-bottom: 15px;
    }
}

/* Route Selector */
.route-selector {
    margin: 15px 0;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.route-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.route-select {
    width: 100%;
    max-width: 400px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.route-select-prompt {
    padding: 20px;
    text-align: center;
    color: #666;
    background: #f9f9f9;
    border-radius: 4px;
}

.route-info {
    margin: 15px 0;
    padding: 10px;
    background: #f0f8ff;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
}

.route-info h4 {
    margin: 0 0 5px 0;
}

.route-info .fastest-time {
    margin: 5px 0 0 0;
    font-size: 0.9em;
}

.user-rows-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.user-row {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    background: #fff;
}

.user-row.is-incomplete {
    opacity: 0.7;
    background: #f9fafb;
}

.user-row__header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.user-rank {
    flex-shrink: 0;
}

.rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #2563eb;
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.1em;
}

/* Top 3 leaderboard styling */
.user-row:nth-child(1) .rank-number {
    background: #fbbf24; /* Gold */
}

.user-row:nth-child(2) .rank-number {
    background: #9ca3af; /* Silver */
}

.user-row:nth-child(3) .rank-number {
    background: #cd7f32; /* Bronze */
}

.user-info {
    flex: 1;
}

.user-name {
    margin-bottom: 5px;
    font-size: 1.1em;
}

.user-stats {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: #666;
}

.user-total-time,
.user-route-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.user-incomplete-badge {
    flex-shrink: 0;
}

.incomplete-indicator {
    padding: 6px 12px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
}

.user-routes-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.user-route-card {
    flex: 0 0 auto;
    min-width: 150px;
    max-width: 200px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-route-card.is-missing {
    opacity: 0.5;
    background: #f3f4f6;
    border-style: dashed;
}

.route-card-name {
    font-weight: 600;
    font-size: 0.9em;
    color: #333;
    line-height: 1.3;
}

.route-card-time {
    font-size: 0.95em;
    color: #2563eb;
    font-weight: 600;
}

.route-card-missing {
    font-size: 0.85em;
    color: #9ca3af;
    font-style: italic;
}

.route-card-link {
    font-size: 0.85em;
    color: #2563eb;
    text-decoration: none;
    margin-top: auto;
}

.route-card-link:hover {
    text-decoration: underline;
}

.user-missing-routes {
    margin-top: 10px;
    padding: 10px;
    background: #fef3c7;
    border-radius: 6px;
    font-size: 0.85em;
    color: #92400e;
}

.missing-routes-label {
    font-weight: 600;
}

.challenge-user-view-empty {
    padding: 30px;
    text-align: center;
    color: #6b7280;
}

/* Activities panel container - appears below route cards (accordion style) */
.challenge-route-tabs {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e5e7eb;
}

.route-tab-panel {
    display: none; /* Hidden by default - accordion starts collapsed */
    animation: fadeIn 0.3s ease-in;
}

.route-tab-panel.is-active {
    display: block;
}

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

.route-participations {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.participation-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.participation-card.is-verified {
    border-color: #16a34a;
}

/* Route embed card - distinct styling */
.participation-card.route-embed-card {
    background: #f0f9ff;
    border-color: #3b82f6;
    border-width: 2px;
    grid-column: 1 / -1; /* Span full width */
}

.route-embed-wrapper {
    width: 100%;
    margin: 10px 0;
}

.route-embed-wrapper iframe {
    width: 100%;
    min-height: 580px;
    border: none;
    border-radius: 4px;
}

.participation-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.match-badge {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75em;
    color: #fff;
}

.match-perfect {
    background: #28a745;
}

.match-good {
    background: #17a2b8;
}

.match-possible {
    background: #ffc107;
    color: #111;
}

.verification-badge {
    background: #16a34a;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75em;
}

.participation-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    font-size: 0.9em;
    color: #4b5563;
}

.participation-embed {
    margin: 10px 0;
    width: 100%;
    min-height: 300px;
}

.participation-embed .strava-embed-placeholder {
    width: 100%;
    min-height: 300px;
}

.participation-embed iframe {
    width: 100%;
    border: none;
    border-radius: 4px;
}

.participation-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    margin-top: 8px;
}

.strava-activity-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    overflow-y: auto;
}

.strava-activity-modal__dialog {
    position: relative;
    max-width: 1400px;
    width: 95%;
    margin: 50px auto;
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.strava-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.strava-activity-modal__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding: 10px 0;
}

/* Route embed card in modal - same width as other cards */
.strava-activity-modal__list .participation-card.route-embed-card {
    background: #f0f9ff;
    border-color: #3b82f6;
    border-width: 2px;
    grid-column: auto !important; /* Override full-width rule from general .route-embed-card */
}

/* Activity cards in modal - match participation-card style */
.strava-activity-modal__list .participation-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}

.strava-activity-modal__list .participation-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.strava-activity-modal__list .participation-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    font-size: 0.9em;
    color: #4b5563;
}

.strava-activity-modal__list .participation-embed {
    margin: 10px 0;
    width: 100%;
    min-height: 300px;
}

.strava-activity-modal__list .participation-embed iframe {
    width: 100%;
    border: none;
    border-radius: 4px;
    min-height: 300px;
}

.strava-activity-modal__list .strava-select-activity-btn {
    width: 100%;
    padding: 10px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    margin-top: 10px;
    transition: background 0.2s;
}

.strava-activity-modal__list .strava-select-activity-btn:hover {
    background: #1d4ed8;
}

.strava-activity-modal__list .strava-select-activity-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Responsive adjustments for modal */
@media (max-width: 1200px) {
    .strava-activity-modal__list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .strava-activity-modal__dialog {
        width: 98%;
        padding: 15px;
        margin: 20px auto;
    }
    
    .strava-activity-modal__list {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.strava-activity-modal__error {
    padding: 20px;
    background: #f8d7da;
    border-radius: 6px;
    color: #721c24;
    margin-top: 15px;
}

.strava-activity-modal__empty {
    padding: 20px;
    text-align: center;
    color: #6b7280;
}

.strava-activity-card {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    background: #fff;
}

.strava-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #d4edda;
    color: #155724;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 11000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.strava-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Smooth scroll behavior for anchor links */
html {
    scroll-behavior: smooth;
}

/* Disable auto-scroll for route tab panels on page load */
/* The :target pseudo-class causes auto-scroll when URL has hash, so we disable it for route panels */
.route-tab-panel:target {
    scroll-margin-top: 0;
}

/* ============================================
   Route Leaderboard Cards
   ============================================ */

.challenge-route-leaderboards {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e5e7eb;
}

.route-leaderboards-heading {
    margin-bottom: 25px;
}

.route-leaderboards-heading h3 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 1.5em;
}

.route-leaderboards-heading p {
    margin: 0;
    color: #6b7280;
    font-size: 0.95em;
}

.route-leaderboard-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

.route-leaderboard-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow: hidden;
}

.route-leaderboard-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.route-leaderboard-card__header {
    padding: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: background-color 0.2s ease;
    user-select: none;
}

.route-leaderboard-card__header:hover {
    background-color: #f9fafb;
}

.route-leaderboard-card__header[aria-expanded="true"] {
    background-color: #f3f4f6;
}

.route-leaderboard-card__header[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.route-leaderboard-card__title h4 {
    margin: 0 0 8px 0;
    color: #1f2937;
    font-size: 1.2em;
    font-weight: 600;
}

.route-leaderboard-card__meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.9em;
    color: #6b7280;
}

.route-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.route-leaderboard-card__summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.route-leaderboard-card__summary .route-ranking-tables {
    width: 100%;
    max-width: 100%;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 0.95em;
}

.summary-item.summary-overall {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.summary-item.summary-kotm {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
}

.summary-item.summary-qom {
    background: #fce7f3;
    border-left: 3px solid #ec4899;
}

.summary-item.summary-empty {
    background: #f3f4f6;
    color: #9ca3af;
    font-style: italic;
}

.summary-icon {
    font-size: 1.1em;
}

.summary-label {
    font-weight: 600;
    color: #374151;
    min-width: 70px;
}

.summary-value {
    font-weight: 700;
    color: #1f2937;
    font-family: 'Courier New', monospace;
}

.summary-name {
    color: #6b7280;
    margin-left: auto;
}

.route-leaderboard-card__toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.toggle-icon {
    font-size: 0.8em;
    color: #6b7280;
    transition: transform 0.3s ease;
}

.route-leaderboard-card__content {
    padding: 0 20px 20px 20px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

.route-leaderboard-content__loading {
    padding: 20px;
    text-align: center;
    color: #6b7280;
}

.route-leaderboard-content__data {
    padding-top: 20px;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .route-leaderboard-cards {
        grid-template-columns: 1fr;
    }
    
    .route-leaderboard-card__summary {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .summary-item {
        flex: 1;
        min-width: 200px;
    }
}

@media (min-width: 1024px) {
    .route-leaderboard-cards {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Overall Leaderboard Accordion
   ============================================ */

.ranking-rest-accordion {
    margin-top: 20px;
    border-top: 2px solid #e5e7eb;
    padding-top: 20px;
}

.ranking-rest-toggle {
    width: 100%;
    padding: 12px 20px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1em;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s ease;
}

.ranking-rest-toggle:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.ranking-rest-toggle[aria-expanded="true"] {
    background: #eff6ff;
    border-color: #3b82f6;
}

.ranking-rest-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.ranking-rest-toggle .toggle-text {
    flex: 1;
    text-align: left;
}

.ranking-rest-toggle .toggle-icon {
    font-size: 0.8em;
    color: #6b7280;
    transition: transform 0.3s ease;
}

.ranking-rest-content {
    margin-top: 15px;
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.ranking-table-rest {
    margin-top: 0;
}

.ranking-table-rest tbody tr {
    border-bottom: 1px solid #f3f4f6;
}

.ranking-table-rest tbody tr:last-child {
    border-bottom: none;
}

/* ============================================
   Accordion Table with Pagination
   ============================================ */

.accordion-ranking-table {
    margin: 20px 0;
}

.accordion-table-title {
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
    color: #1f2937;
}

.accordion-table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.accordion-table.ranking-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    min-width: 100%;
}

.accordion-table.ranking-table .accordion-row {
    display: none;
}

.accordion-table.ranking-table .pagination-row {
    display: none;
}

.accordion-controls {
    margin-top: 15px;
    text-align: center;
}

.accordion-toggle-btn {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 0.95em;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.accordion-toggle-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.accordion-toggle-btn[aria-expanded="true"] {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.accordion-toggle-icon {
    font-size: 0.9em;
    transition: transform 0.3s ease;
}

.accordion-toggle-btn[aria-expanded="true"] .accordion-toggle-icon {
    transform: rotate(180deg);
}

.accordion-pagination {
    margin-top: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.pagination-info {
    margin-bottom: 10px;
    text-align: center;
    color: #6b7280;
    font-size: 0.9em;
}

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

.pagination-btn {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.9em;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 36px;
    text-align: center;
}

.pagination-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.pagination-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 6px 4px;
    color: #6b7280;
}

.ranking-combined-section {
    margin: 30px 0;
}

.ranking-combined-title {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1f2937;
}

/* Route leaderboard card with accordion table */
.route-leaderboard-card__summary .accordion-ranking-table {
    margin: 0;
}

.route-leaderboard-card__summary .accordion-table-title {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.route-leaderboard-card__summary .accordion-table-wrapper {
    margin-top: 10px;
    width: 100%;
    overflow-x: auto;
}

.route-leaderboard-card__summary .accordion-table.ranking-table {
    font-size: 0.95em;
    width: 100%;
    min-width: 100%;
    table-layout: auto;
}

.route-leaderboard-card__summary .accordion-table.ranking-table th,
.route-leaderboard-card__summary .accordion-table.ranking-table td {
    padding: 8px 10px;
}

.route-leaderboard-card__summary .accordion-controls {
    margin-top: 10px;
}

.route-leaderboard-card__summary .accordion-pagination {
    margin-top: 15px;
}

/* Gender tables styling */
.route-ranking-tables .accordion-ranking-table,
.ranking-gender-tables .accordion-ranking-table {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
}

.route-ranking-tables .accordion-table-title,
.ranking-gender-tables .accordion-table-title {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.route-ranking-tables .accordion-table-wrapper,
.ranking-gender-tables .accordion-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.route-ranking-tables .accordion-table.ranking-table,
.ranking-gender-tables .accordion-table.ranking-table {
    width: 100%;
    min-width: 100%;
    table-layout: auto;
}

