/*
 * Clean, modern, and maintainable CSS for Tube Cycling Challenge UI
 * - Uses CSS variables for colors and spacing
 * - Groups related styles
 * - Removes redundant and unused rules
 * - All layout handled in CSS, not inline
 */
:root {
    --primary-blue: #0019a8;
    --accent-red: #e32017;
    --accent-yellow: #ffd300;
    --accent-green: #00782a;
    --accent-cyan: #0098d4;
    --gray-bg: #e5e5e5;
    --gray-dark: #444;
    --header-padding: 2em 0 1em 0;
    --road-height: 180px;
    --road-offset: 100px;
    --container-max-width: 1600px;
    --card-radius: 16px;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
body {
    font-family: 'Montserrat', Arial, sans-serif;
    margin: 0;
    background: linear-gradient(135deg, var(--gray-bg) 60%, #b3e0ff 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}
body.has-content {
    padding-bottom: 0;
}
body.has-content.table-view-active {
    padding-bottom: 60px;
}
header.tfl-header {
    background: var(--primary-blue);
    color: #fff;
    padding: var(--header-padding);
    position: relative;
    z-index: 10;
}
.tfl-header-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 2em;
}
.tfl-logos-title {
    display: flex;
    align-items: center;
    gap: 2em;
    text-align: left;
}
.tfl-logos {
    display: flex;
    align-items: center;
    gap: 1em;
}
main {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 2em;
}
.view-toggle {
    text-align: center;
    margin: 1em 0;
    display: none;
}
#toggle-table-view {
    background: var(--accent-cyan);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 0.7em 2em;
    font-size: 1em;
    cursor: pointer;
}
#activities,
#table-view {
    margin-top: 2em !important;
}
#activities {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2em;
    max-width: var(--container-max-width);
    margin: 2em auto 0;
    align-items: stretch;
    position: relative;
    z-index: 5;
}
#activities[data-has-road="true"] {
    margin-bottom: calc(var(--road-height) - var(--road-offset));
}
.activity {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 1.5em 1.2em 1.2em 1.2em;
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    min-height: 120px;
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 0.5em;
}
.activity:hover {
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.activity strong {
    font-size: 1.1em;
    margin-bottom: 0.3em;
    display: block;
}
.activity em {
    color: #888;
    font-size: 0.95em;
    margin-bottom: 0.5em;
    display: block;
}
.activity .description {
    margin: 0.5em 0 1em 0;
    color: #444;
    font-size: 1em;
}
.activity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    font-size: 0.98em;
    margin-top: auto;
}
.activity .activity-meta span {
    display: flex;
    align-items: center;
    gap: 0.4em;
    color: var(--accent-green);
    background: #eaf7ed;
    border-radius: 6px;
    padding: 0.2em 0.7em;
    font-weight: 500;
}
.activity .activity-meta span.time {
    color: #b36305;
    background: #fff6e5;
}
.activity .activity-meta span.distance {
    color: var(--accent-cyan);
    background: #e6f6fb;
}
#table-view {
    margin-bottom: 2em;
    padding-bottom: 0;
    max-width: none;
    width: 100%;
    position: relative;
    z-index: 5;
}
#table-view[hidden] { display: none !important; }
#table-view table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin: 0 auto;
    table-layout: auto;
}
#table-view table td, #table-view table th {
    font-weight: normal;
    padding: 8px;
    border: 1px solid #ccc;
    text-align: center;
}
#table-view table th {
    font-weight: bold;
    white-space: nowrap;
}
#table-view table th.elevation-col, #table-view table td.elevation-col {
    min-width: 110px;
}
#table-view table th.distance-col, #table-view table td.distance-col {
    min-width: 100px;
}
#table-view table th.time-col, #table-view table td.time-col {
    min-width: 90px;
}
#table-view table th.speed-col, #table-view table td.speed-col {
    min-width: 90px;
}
#table-view table th.ride-name-col, #table-view table td.ride-name-col {
    min-width: 180px;
}
#table-view table th.date-col, #table-view table td.date-col {
    min-width: 110px;
}
footer {
    position: relative;
    width: 100%;
    z-index: 1;
    margin-top: 0;
}
.cycle-road-bg {
    position: relative;
    left: 0; right: 0;
    bottom: 0;
    height: var(--road-height);
    z-index: 1;
    pointer-events: none;
}

body:not(.has-content) footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin-top: 0;
}
.cycle-road {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: var(--road-height);
    background: linear-gradient(to top, var(--gray-dark) 80%, transparent 100%);
    z-index: 1;
}
.cycle-road-markings {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 80vw;
    max-width: 600px;
    height: 100px;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    z-index: 6;
    pointer-events: none;
}
.cycle-road-marking {
    width: 40px;
    height: 8px;
    background: #fff;
    border-radius: 4px;
    opacity: 0.7;
    margin: 0 12px;
}
.follow-strava {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3em 0.6em;
    background: #fc4c02; /* Strava orange */
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
}
.follow-strava:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.follow-strava img {
    height: 36px;
    width: auto;
    display: block;
}
.tfl-logo-wrapper, .cycle-logo-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 16px;
    background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.65) 55%, rgba(255,255,255,0.15) 100%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.5) inset;
    backdrop-filter: saturate(160%) blur(2px);
    -webkit-backdrop-filter: saturate(160%) blur(2px);
}
.tfl-logo-wrapper .tfl-logo-img { height: 70px; }
.cycle-logo-wrapper .header-cycle-img { height: 70px; }
@media (max-width: 900px) {
    #activities {
        grid-template-columns: 1fr;
        padding: 0 1em;
    }
    main {
        padding: 0 0.5em;
    }
    .follow-strava img { height: 30px; }
    #table-view {
        max-width: 100vw;
        overflow-x: auto;
    }
    #table-view table {
        min-width: 600px;
    }
}
