/* MyRaceHub - Race Search Page
   TRAIL RUN MAGAZINE INSPIRED - Bold & Energetic Light Theme
   Matching race-detail.css aesthetic
   ============================================================ */

@import url('/static/fonts/fonts.css');

/* ============================================================
   CSS VARIABLES - Light Theme with Golden Accent
   ============================================================ */
.race-search-body {
    /* Backgrounds - clean white */
    --rs-bg: #ffffff;
    --rs-bg-elevated: #f8f8f8;
    --rs-bg-card: #ffffff;
    --rs-bg-input: #ffffff;

    /* Text - rich dark */
    --rs-text: #161616;
    --rs-text-secondary: #3d3d3d;
    --rs-text-muted: #6b6b6b;

    /* Borders */
    --rs-border: #e5e5e5;
    --rs-border-light: #f0f0f0;
    --rs-border-dark: #cccccc;

    /* Accent - Trail Run Mag golden yellow */
    --rs-accent: #FBD40E;
    --rs-accent-hover: #e5c10d;
    --rs-accent-text: #161616;
    --rs-accent-glow: rgba(251,212,14,0.3);

    /* Distance badge colors */
    --rs-marathon: #e53935;
    --rs-half: #00acc1;
    --rs-10k: #8e24aa;
    --rs-5k: #43a047;

    /* Sport category colors */
    --rs-triathlon: #3b82f6;
    --rs-duathlon: #f97316;
    --rs-aquathon: #14b8a6;
    --rs-multisport: #8b5cf6;

    /* Typography */
    --font-display: 'Varela Round', sans-serif;
    --font-body: 'Rubik', sans-serif;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* ============================================================
   BASE RESET
   ============================================================ */
html:has(.race-search-body),
.race-search-body {
    overflow-x: clip;
    overscroll-behavior-x: none;
}

.race-search-body {
    background: var(--rs-bg) !important;
    color: var(--rs-text) !important;
    font-family: var(--font-body) !important;
}

.race-search-body * {
    box-sizing: border-box;
}

.race-search-body .container {
    max-width: none;
    background: transparent;
    padding: 0;
}

/* ============================================================
   HEADER - Frosted Glass (Fixed)
   ============================================================ */
.race-search-body header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(22, 22, 22, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 0 48px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background-image: none;
    overflow: visible;
}

.race-search-body header::after {
    display: none;
}

.race-search-body .header-content {
    max-width: none;
    margin: 0;
    background: transparent;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.race-search-body .site-logo {
    filter: brightness(0) invert(1);
    height: 40px;
    width: auto;
    animation: none;
}

.race-search-body .header-text h1 {
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    animation: none;
}

.race-search-body .header-text h1 .highlight {
    color: var(--rs-accent);
    -webkit-text-fill-color: var(--rs-accent);
    background: none;
}

.race-search-body .subtitle {
    display: none;
}

/* ============================================================
   NAVIGATION - Fixed with Frosted Glass
   ============================================================ */
.race-search-body .nav-links {
    background: transparent;
    border: none;
    padding: 0 48px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    z-index: 101;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.race-search-body .nav-links .nav-left {
    display: flex;
    align-items: center;
    gap: 32px;
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.race-search-body .nav-links .nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 0;
    position: absolute;
    right: 48px;
}

.race-search-body .nav-links .nav-left a {
    color: rgba(255,255,255,0.9);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.15s ease;
    border: none;
    padding: 0;
}

.race-search-body .nav-links .nav-left a:hover {
    color: var(--rs-accent);
}

.race-search-body .nav-links .nav-left a.active {
    color: var(--rs-accent);
    border: none;
    text-decoration: none;
}

/* Sign in button - frosted glass */
.race-search-body .nav-sign-in {
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: all 0.25s ease;
}

.race-search-body .nav-sign-in:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.race-search-body .nav-sign-in:active {
    transform: translateY(0);
}

/* User dropdown */
.race-search-body .nav-user-dropdown {
    background: transparent;
    color: #fff;
}

.race-search-body .nav-user-btn {
    background: transparent;
    color: #fff;
}

.race-search-body .nav-user-name {
    color: #fff;
}

.race-search-body .nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.race-search-body .nav-user-initials {
    background: var(--rs-accent);
    color: var(--rs-accent-text);
}

/* Dropdown menu - light theme */
.race-search-body .nav-dropdown-menu {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    box-shadow: var(--shadow-lg);
    border-radius: 12px;
}

.race-search-body .nav-dropdown-menu a,
.race-search-body .nav-dropdown-menu button {
    color: var(--rs-text-secondary);
    background: transparent;
    font-family: var(--font-body);
    border: none;
    padding: 10px 16px;
}

.race-search-body .nav-dropdown-menu a:hover,
.race-search-body .nav-dropdown-menu button:hover {
    background: var(--rs-bg-elevated);
    color: var(--rs-text);
}

.race-search-body .nav-dropdown-menu hr {
    border-color: var(--rs-border);
    margin: 4px 0;
}

/* ============================================================
   HERO SECTION - Compact with Image
   ============================================================ */
.race-search-body .search-hero {
    position: relative;
    height: 45vh;
    min-height: 320px;
    max-height: 450px;
    margin-top: 70px;
    overflow: hidden;
}

.race-search-body .search-hero .hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
}

.race-search-body .search-hero .hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.35) 0%,
        rgba(0,0,0,0.15) 25%,
        rgba(0,0,0,0.1) 40%,
        rgba(0,0,0,0.15) 55%,
        rgba(0,0,0,0.1) 70%,
        rgba(255,255,255,0.3) 80%,
        rgba(255,255,255,0.7) 90%,
        rgba(255,255,255,1) 100%
    );
}

.race-search-body .search-hero .hero-content {
    position: absolute;
    top: 45%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    text-align: center;
    padding: 0 24px;
}

.race-search-body .search-hero .hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 400;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
    margin: 0 0 12px 0;
    line-height: 1.1;
}

.race-search-body .search-hero .hero-subtitle {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    margin: 0 0 8px 0;
    font-weight: 500;
}

.race-search-body .search-hero .hero-description {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 6px rgba(0,0,0,0.3);
    margin: 0 auto 12px;
    font-weight: 400;
    max-width: 500px;
}

/* State links integrated into hero */
.race-search-body .search-hero .hero-state-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 20px;
    margin-top: 4px;
}

.race-search-body .search-hero .hero-state-links a {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 4px 0;
    position: relative;
    transition: color 0.2s ease;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.02em;
}

.race-search-body .search-hero .hero-state-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--rs-accent);
    transition: width 0.2s ease;
}

.race-search-body .search-hero .hero-state-links a:hover {
    color: #ffffff;
}

.race-search-body .search-hero .hero-state-links a:hover::after {
    width: 100%;
}

/* ============================================================
   FILTER CONTROLS - Light Theme, Sticky
   ============================================================ */
.race-search-body .controls {
    background: var(--rs-bg);
    border-bottom: 1px solid var(--rs-border);
    padding: 20px 32px;
    position: sticky;
    top: 70px;
    z-index: 99;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* Desktop: show all filters inline */
.race-search-body .controls-top-row {
    display: contents;
}

.race-search-body .filter-options {
    display: contents;
}

.race-search-body .mobile-filter-toggle {
    display: none;
}

.race-search-body .controls-row {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

/* Inputs, Selects, Date Pickers */
.race-search-body select,
.race-search-body input[type="text"],
.race-search-body input[type="date"],
.race-search-body .search-input {
    background: var(--rs-bg-input);
    border: 1px solid var(--rs-border);
    border-radius: 25px;
    color: var(--rs-text);
    font-family: var(--font-body);
    font-size: 14px;
    padding: 12px 18px;
    transition: all 0.2s ease;
}

.race-search-body select:hover,
.race-search-body input[type="text"]:hover,
.race-search-body input[type="date"]:hover,
.race-search-body .search-input:hover {
    border-color: var(--rs-border-dark);
}

.race-search-body select:focus,
.race-search-body input[type="text"]:focus,
.race-search-body input[type="date"]:focus,
.race-search-body .search-input:focus {
    outline: none;
    border-color: var(--rs-accent);
    box-shadow: 0 0 0 3px var(--rs-accent-glow);
}

.race-search-body select option {
    background: var(--rs-bg-card);
    color: var(--rs-text);
}

.race-search-body .search-input {
    min-width: 200px;
}

.race-search-body .search-input::placeholder {
    color: var(--rs-text-muted);
}

/* Multi-select dropdown */
.race-search-body .multi-select-btn {
    background: var(--rs-bg-input);
    border: 1px solid var(--rs-border);
    border-radius: 25px;
    color: var(--rs-text);
    font-family: var(--font-body);
    font-size: 14px;
    padding: 12px 18px;
    transition: all 0.2s ease;
}

.race-search-body .multi-select-btn:hover {
    border-color: var(--rs-border-dark);
}

.race-search-body .multi-select-btn:focus {
    border-color: var(--rs-accent);
    box-shadow: 0 0 0 3px var(--rs-accent-glow);
}

.race-search-body .dropdown-arrow {
    color: var(--rs-text-muted);
}

.race-search-body .multi-select-options {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.race-search-body .multi-select-option {
    color: var(--rs-text-secondary);
    font-family: var(--font-body);
    padding: 12px 16px;
}

.race-search-body .multi-select-option:hover {
    background: var(--rs-bg-elevated);
    color: var(--rs-text);
}

/* ============================================================
   MAIN LAYOUT - 3-Column Grid
   ============================================================ */
.race-search-body .main-layout {
    display: grid;
    grid-template-columns: 200px 1fr 360px;
    min-height: calc(100vh - 200px);
    gap: 0;
    background: var(--rs-bg);
}

/* ============================================================
   MONTH NAVIGATION SIDEBAR (Left)
   ============================================================ */
.race-search-body .month-nav-sidebar {
    background: var(--rs-bg-elevated);
    border-right: 1px solid var(--rs-border);
    padding: 28px 20px;
    position: sticky;
    top: 130px;
    align-self: start;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.race-search-body .month-nav-sidebar h3 {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rs-border);
}

/* Year groups */
.race-search-body .year-group {
    margin-bottom: 8px;
}

.race-search-body .year-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.race-search-body .year-header:hover {
    background: var(--rs-bg-card);
}

.race-search-body .year-toggle {
    font-size: 11px;
    color: var(--rs-text-muted);
    transition: transform 0.2s ease;
}

.race-search-body .year-group.expanded .year-toggle {
    transform: rotate(90deg);
}

.race-search-body .year-label {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--rs-text);
}

.race-search-body .year-count {
    font-size: 13px;
    color: var(--rs-text-muted);
    margin-left: auto;
}

.race-search-body .year-months {
    display: none;
    padding-left: 20px;
}

.race-search-body .year-group.expanded .year-months {
    display: block;
}

.race-search-body .month-nav-item {
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--rs-text-secondary);
    cursor: pointer;
    border-radius: 8px;
    border: none;
    transition: all 0.15s ease;
    margin-bottom: 4px;
}

.race-search-body .month-nav-item:hover {
    background: var(--rs-bg-card);
    color: var(--rs-text);
    transform: none;
}

.race-search-body .month-nav-item.active {
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    font-weight: 600;
    box-shadow: none;
}

/* ============================================================
   MAIN CONTENT AREA (Center)
   ============================================================ */
.race-search-body .main-content {
    background: var(--rs-bg);
    padding: 32px 40px;
    position: relative;
}

.race-search-body #races-container {
    max-width: none;
}

/* Loading state - positioned absolutely to avoid CLS when hidden */
.race-search-body .loading {
    color: var(--rs-text-secondary);
    font-family: var(--font-body);
    padding: 48px;
    text-align: center;
    position: absolute;
    left: 0;
    right: 0;
    z-index: 1;
}

/* Empty state */
.race-search-body .empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--rs-text-secondary);
}

.race-search-body .empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.race-search-body .empty-state h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--rs-text);
    margin-bottom: 8px;
}

/* ============================================================
   MONTH SECTIONS & HEADERS
   ============================================================ */
.race-search-body .month-section {
    margin-bottom: 48px;
    animation: none;
}

.race-search-body .month-header {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--rs-text);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--rs-border);
    display: inline-block;
}

.race-search-body .month-header::after {
    display: none;
}

/* ============================================================
   RACE TABLE - Light Theme Cards
   ============================================================ */
.race-search-body .races-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
}

.race-search-body .races-table thead {
    background: var(--rs-bg-elevated);
}

.race-search-body .races-table th {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    padding: 14px 16px;
    text-align: left;
    border-bottom: 2px solid var(--rs-border);
}

.race-search-body .races-table td {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--rs-text-secondary);
    padding: 16px;
    border-bottom: 1px solid var(--rs-border-light);
    vertical-align: middle;
}

.race-search-body .races-table tbody tr:last-child td {
    border-bottom: 1px solid var(--rs-border);
}

.race-search-body .race-row {
    transition: all 0.15s ease;
}

.race-search-body .race-row:hover {
    background: var(--rs-bg-elevated);
}

.race-search-body .race-row:hover td {
    color: var(--rs-text);
}

/* Featured race styles - light theme */
.race-search-body .race-row.featured-gold {
    background: rgba(251, 212, 14, 0.08);
    border-left: 3px solid var(--rs-accent);
}

.race-search-body .race-row.featured-gold:hover {
    background: rgba(251, 212, 14, 0.15);
}

.race-search-body .race-row.featured-silver {
    background: rgba(148, 163, 184, 0.08);
    border-left: 3px solid #94a3b8;
}

.race-search-body .race-row.featured-bronze {
    border-left: 3px solid #d97706;
}

.race-search-body .featured-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.race-search-body .featured-badge-gold {
    background: var(--rs-accent);
    color: var(--rs-accent-text);
}

.race-search-body .featured-badge-silver {
    background: #94a3b8;
    color: #fff;
}

/* Date cell */
.race-search-body .race-date-cell {
    color: var(--rs-text-muted);
    font-weight: 600;
    white-space: nowrap;
    width: 80px;
}

/* Race name cell */
.race-search-body .race-name-cell {
    font-weight: 600;
    color: var(--rs-text);
}

.race-search-body .race-name-cell .race-name-link {
    color: var(--rs-text);
    text-decoration: none;
    transition: color 0.15s ease;
}

.race-search-body .race-name-cell .race-name-link:hover {
    color: var(--rs-accent-hover);
    text-decoration: underline;
}

/* Sport badges - light theme */
.race-search-body .sport-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #fff;
}

.race-search-body .sport-badge-triathlon { background: var(--rs-triathlon); }
.race-search-body .sport-badge-duathlon { background: var(--rs-duathlon); }
.race-search-body .sport-badge-aquathon { background: var(--rs-aquathon); }
.race-search-body .sport-badge-multisport { background: var(--rs-multisport); }

.race-search-body .terrain-badge-small {
    background: #14b8a6;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 8px;
    color: #fff;
}

/* Location cell */
.race-search-body .race-location-cell {
    color: var(--rs-text-muted);
}

/* ============================================================
   RACE CARD LIST - Horizontal cards with thumbnail
   ============================================================ */
.race-search-body .race-card-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 8px;
}

.race-search-body .race-card {
    display: flex;
    flex-direction: row;
    background: var(--rs-bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--rs-border-light);
}

.race-search-body .race-card-clickable {
    cursor: pointer;
}

.race-search-body .race-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.race-search-body .race-card-thumbnail {
    flex-shrink: 0;
    width: 305px;
    height: 234px;
    overflow: hidden;
    position: relative;
    background: var(--rs-bg-elevated);
}

.race-search-body .race-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--rs-bg-elevated);
    transition: transform 0.3s ease;
}

.race-search-body .race-card:hover .race-card-thumbnail img {
    transform: scale(1.05);
}

.race-search-body .race-card-content {
    flex: 1;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow text truncation */
}

.race-search-body .race-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.race-search-body .race-card-date {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--rs-text-muted);
}

.race-search-body .race-card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--rs-text);
    margin: 0 0 6px 0;
    line-height: 1.3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.race-search-body .race-card-title .race-name-link {
    color: var(--rs-text);
    text-decoration: none;
    transition: color 0.15s ease;
}

.race-search-body .race-card-title .race-name-link:hover {
    color: var(--rs-accent-hover);
}

.race-search-body .race-card-location {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--rs-text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.race-search-body .race-card-location::before {
    content: '📍';
    font-size: 12px;
}

.race-search-body .race-card-description {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--rs-text-secondary);
    margin: 0 0 12px 0;
}

.race-search-body .race-card-distances {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.race-search-body .race-card-distances .distance-badge {
    font-size: 12px;
    padding: 4px 10px;
}

.race-search-body .race-card-distances .tba {
    font-size: 13px;
    color: var(--rs-text-muted);
    font-style: italic;
}

/* ============================================================
   SHARE BUTTON ON RACE CARDS
   ============================================================ */
.race-search-body .share-icon-wrapper {
    position: relative;
    margin-left: auto;
}

.race-search-body .share-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--rs-bg-elevated);
    border-radius: 50%;
    color: var(--rs-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.race-search-body .share-icon-btn:hover {
    background: var(--rs-accent);
    color: var(--rs-accent-text);
}

.race-search-body .share-popup {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    min-width: 140px;
    overflow: hidden;
}

.race-search-body .share-popup.active {
    display: block;
}

.race-search-body .share-popup-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--rs-text-secondary);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s ease, color 0.1s ease;
}

.race-search-body .share-popup-item:hover {
    background: var(--rs-bg-elevated);
    color: var(--rs-text);
}

.race-search-body .share-popup-item:not(:last-child) {
    border-bottom: 1px solid var(--rs-border-light);
}

/* Calendar hint for logged-out users */
.race-search-body .calendar-hint {
    font-size: 11px;
    color: var(--rs-text-muted);
    margin-top: 8px;
    opacity: 0.8;
}

/* Hide hint when logged in */
.race-search-body.logged-in .calendar-hint {
    display: none;
}

/* Featured card styling */
.race-search-body .race-card.featured-gold {
    border: 2px solid var(--rs-accent);
    box-shadow: 0 4px 16px rgba(251, 212, 14, 0.2);
}

.race-search-body .race-card.featured-gold:hover {
    box-shadow: 0 8px 24px rgba(251, 212, 14, 0.3);
}

.race-search-body .race-card.featured-silver {
    border: 2px solid #94a3b8;
}

.race-search-body .race-card.featured-bronze {
    border: 2px solid #d97706;
}

/* Ad slot in card list - collapse to zero height until filled to prevent CLS */
.race-search-body .race-card-ad {
    padding: 0;
    height: 0;
    overflow: hidden;
    contain: layout style;
}

/* Expand only when ad is filled */
.race-search-body .race-card-ad:has(.adsbygoogle[data-ad-status="filled"]) {
    padding: 16px 0;
    height: auto;
    overflow: visible;
    contain: none;
}

/* Infinite scroll load indicator */
.race-search-body .load-more-indicator {
    text-align: center;
    padding: 32px 16px;
    color: var(--rs-text-muted);
    font-size: 14px;
}

.race-search-body .load-more-indicator .loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--rs-border);
    border-top-color: var(--rs-accent);
    border-radius: 50%;
    margin: 12px auto 0;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive - stack vertically on mobile */
@media (max-width: 768px) {
    .race-search-body .race-card {
        flex-direction: column;
    }

    .race-search-body .race-card-thumbnail {
        width: 100%;
        height: 200px;
    }

    .race-search-body .race-card-content {
        padding: 14px;
    }

    .race-search-body .race-card-title {
        font-size: 1rem;
    }
}

/* ============================================================
   DISTANCE BADGES - Light Theme with Color Borders
   ============================================================ */
.race-search-body .race-distances-cell .distance-badge,
.race-search-body .distance-badge {
    background: var(--rs-bg-card);
    border: 2px solid var(--rs-border);
    border-radius: 20px;
    color: var(--rs-text-secondary);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: none;
    white-space: normal;
    max-width: 180px;
    text-align: center;
    line-height: 1.3;
}

/* Long distance names - use normal case for readability */
.race-search-body .distance-badge.long-name {
    text-transform: none;
    font-size: 11px;
}

.race-search-body .race-distances-cell .distance-badge::before,
.race-search-body .distance-badge::before {
    display: none;
}

.race-search-body .distance-badge:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.race-search-body .distance-badge:active {
    transform: scale(0.98);
}

/* Distance badge color variants */
.race-search-body .distance-badge.marathon,
.race-search-body .distance-badge[data-distance*="marathon"] {
    border-color: var(--rs-marathon);
    color: var(--rs-marathon);
}
.race-search-body .distance-badge.marathon:hover {
    background: var(--rs-marathon);
    color: #fff;
}

.race-search-body .distance-badge.half,
.race-search-body .distance-badge[data-distance*="half"] {
    border-color: var(--rs-half);
    color: var(--rs-half);
}
.race-search-body .distance-badge.half:hover {
    background: var(--rs-half);
    color: #fff;
}

.race-search-body .distance-badge.ten-k,
.race-search-body .distance-badge[data-distance*="10k"] {
    border-color: var(--rs-10k);
    color: var(--rs-10k);
}
.race-search-body .distance-badge.ten-k:hover {
    background: var(--rs-10k);
    color: #fff;
}

.race-search-body .distance-badge.five-k,
.race-search-body .distance-badge[data-distance*="5k"] {
    border-color: var(--rs-5k);
    color: var(--rs-5k);
}
.race-search-body .distance-badge.five-k:hover {
    background: var(--rs-5k);
    color: #fff;
}

/* Added state */
.race-search-body .distance-badge.added {
    background: var(--rs-5k);
    border-color: var(--rs-5k);
    color: #fff;
}

.race-search-body .distance-badge.added::after {
    content: ' ✓';
    margin-left: 4px;
}

.race-search-body .race-distances-cell .tba {
    color: var(--rs-text-muted);
    font-style: italic;
}

/* ============================================================
   MY CALENDAR SIDEBAR (Right)
   ============================================================ */
.race-search-body .my-calendar-sidebar {
    background: var(--rs-bg-elevated);
    border-left: 1px solid var(--rs-border);
    padding: 28px 24px;
    position: sticky;
    top: 130px;
    align-self: start;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    display: block;
}

.race-search-body .calendar-header h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--rs-text);
    margin-bottom: 4px;
}

.race-search-body .calendar-subtitle {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--rs-text-muted);
    margin-bottom: 20px;
}

/* Stats box */
.race-search-body .calendar-stats {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.race-search-body .stat-box {
    text-align: center;
}

.race-search-body .stat-number {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 400;
    color: var(--rs-accent-hover);
    background: none;
    -webkit-text-fill-color: var(--rs-accent-hover);
    line-height: 1;
}

.race-search-body .stat-label {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    margin-top: 8px;
    display: block;
}

/* Summary section */
.race-search-body .sidebar-summary {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.race-search-body .summary-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--rs-border-light);
    font-family: var(--font-body);
    font-size: 14px;
}

.race-search-body .summary-item:last-child {
    border-bottom: none;
}

.race-search-body .summary-item span:first-child {
    color: var(--rs-text-muted);
}

.race-search-body .summary-item span:last-child {
    color: var(--rs-text);
    font-weight: 600;
}

/* Parkrun section */
.race-search-body .parkrun-section {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.race-search-body .parkrun-section h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 400;
    color: var(--rs-text);
    margin-bottom: 12px;
}

.race-search-body .parkrun-section input,
.race-search-body .parkrun-section select {
    width: 100%;
    margin-bottom: 8px;
}

.race-search-body .parkrun-section .hint {
    font-size: 13px;
    color: var(--rs-text-muted);
    margin-top: 8px;
}

/* Calendar event cards */
.race-search-body .calendar-event-card {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-left: 4px solid var(--rs-accent);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    animation: none;
    box-shadow: var(--shadow-sm);
}

.race-search-body .calendar-event-card:hover {
    background: var(--rs-bg-elevated);
    transform: none;
    box-shadow: var(--shadow-md);
}

.race-search-body .event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.race-search-body .event-name {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--rs-text);
    line-height: 1.3;
}

.race-search-body .event-date {
    font-size: 13px;
    color: var(--rs-text-muted);
    white-space: nowrap;
}

.race-search-body .event-distance {
    display: inline-block;
    background: var(--rs-bg-elevated);
    border: 1px solid var(--rs-border);
    color: var(--rs-text-secondary);
    padding: 4px 12px;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.race-search-body .event-time-until {
    background: var(--rs-bg-elevated);
    border-left: 3px solid var(--rs-accent);
    color: var(--rs-text-secondary);
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 0 8px 8px 0;
    margin-top: 12px;
}

.race-search-body .event-time-until.event-today {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    font-weight: 600;
}

.race-search-body .event-gap {
    border-top: 1px solid var(--rs-border-light);
    font-size: 12px;
    color: var(--rs-text-muted);
}

.race-search-body .gap-badge {
    background: var(--rs-bg-elevated);
    color: var(--rs-text-secondary);
    padding: 4px 10px;
    border-radius: 12px;
}

.race-search-body .gap-warning {
    color: #dc2626;
}

.race-search-body .gap-good {
    color: var(--rs-5k);
}

/* Empty calendar */
.race-search-body .empty-calendar {
    text-align: center;
    padding: 32px 16px;
    color: var(--rs-text-muted);
}

.race-search-body .empty-calendar p {
    font-size: 14px;
    margin-bottom: 4px;
}

.race-search-body .empty-calendar .hint,
.race-search-body .empty-calendar .help-text {
    font-size: 13px;
    color: var(--rs-text-muted);
}

/* ============================================================
   BUTTONS - Golden Accent, Rounded
   ============================================================ */
.race-search-body .btn {
    font-family: var(--font-body);
    font-weight: 600;
    border-radius: 25px;
    padding: 12px 24px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.race-search-body .btn-primary {
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    border: none;
    box-shadow: none;
}

.race-search-body .btn-primary:hover {
    background: var(--rs-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--rs-accent-glow);
}

.race-search-body .btn-secondary {
    background: transparent;
    color: var(--rs-text-secondary);
    border: 1px solid var(--rs-border);
}

.race-search-body .btn-secondary:hover {
    background: var(--rs-bg-elevated);
    color: var(--rs-text);
    border-color: var(--rs-border-dark);
    transform: none;
    box-shadow: none;
}

.race-search-body .btn-remove {
    background: transparent;
    color: #dc2626;
    border: 1px solid #dc2626;
    border-radius: 20px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    margin-top: 12px;
}

.race-search-body .btn-remove:hover {
    background: #dc2626;
    color: #fff;
}

/* ============================================================
   FOOTER - Dark Theme (Contrasting)
   ============================================================ */
.race-search-body footer {
    background: #161616;
    border-top: none;
    padding: 48px 32px;
    text-align: center;
}

.race-search-body footer p {
    font-family: var(--font-body);
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 8px;
}

.race-search-body footer a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.15s ease;
}

.race-search-body footer a:hover {
    color: var(--rs-accent);
}

.race-search-body .footer-links {
    margin-top: 8px;
}

/* Popular searches section in footer */
.race-search-body .popular-searches {
    margin: 32px 0;
    padding: 24px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.race-search-body .popular-searches h4 {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.4);
    margin-bottom: 16px;
}

.race-search-body .search-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 20px;
}

.race-search-body .search-links a {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color 0.15s ease;
}

.race-search-body .search-links a:hover {
    color: var(--rs-accent);
}

/* ============================================================
   LOGIN MODAL - Light Theme
   ============================================================ */
.race-search-body .modal {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.race-search-body .modal-content,
.race-search-body .login-modal-content {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 16px;
    color: var(--rs-text);
    box-shadow: var(--shadow-lg);
}

.race-search-body .modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--rs-text);
}

.race-search-body .modal-close {
    color: var(--rs-text-muted);
}

.race-search-body .modal-close:hover {
    color: var(--rs-text);
}

.race-search-body .login-tabs {
    border-bottom: 1px solid var(--rs-border);
}

.race-search-body .login-tab {
    color: var(--rs-text-secondary);
    background: transparent;
    border: none;
}

.race-search-body .login-tab.active {
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    border-bottom: 2px solid var(--rs-accent);
}

/* Login Modal Button - Golden Accent */
.race-search-body .login-modal-content .btn-primary,
.race-search-body .auth-form .btn-primary {
    background: linear-gradient(135deg, #FBD40E 0%, #f0c800 50%, #e5bc00 100%);
    color: #1a1a1a;
    border: none;
    box-shadow: 0 2px 8px rgba(251, 212, 14, 0.3);
}

.race-search-body .login-modal-content .btn-primary:hover,
.race-search-body .auth-form .btn-primary:hover {
    background: linear-gradient(135deg, #ffe14d 0%, #FBD40E 50%, #f0c800 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(251, 212, 14, 0.4);
}

.race-search-body .auth-form label {
    color: var(--rs-text-secondary);
}

.race-search-body .auth-form input {
    background: var(--rs-bg-input);
    border: 1px solid var(--rs-border);
    color: var(--rs-text);
    border-radius: 12px;
}

.race-search-body .form-hint {
    color: var(--rs-text-muted);
}

.race-search-body .form-footer a {
    color: var(--rs-accent-hover);
}

.race-search-body .divider span {
    background: var(--rs-bg-card);
    color: var(--rs-text-muted);
}

.race-search-body .oauth-buttons .btn-login {
    background: var(--rs-bg-elevated);
    border: 1px solid var(--rs-border);
    color: var(--rs-text);
    border-radius: 12px;
}

.race-search-body .oauth-buttons .btn-login:hover {
    background: var(--rs-bg-card);
    border-color: var(--rs-border-dark);
}

/* ============================================================
   RESPONSIVE - Tablet
   ============================================================ */
@media (max-width: 1200px) {
    .race-search-body .main-layout {
        grid-template-columns: 180px 1fr 320px;
    }
}

@media (max-width: 1024px) {
    .race-search-body .main-layout {
        grid-template-columns: 1fr 300px;
    }

    .race-search-body .month-nav-sidebar {
        display: none;
    }

    .race-search-body .nav-links .nav-left {
        display: none !important;
    }

    /* Show hamburger menu when nav is hidden */
    .race-search-body .hamburger-menu {
        display: flex !important;
    }
}

/* ============================================================
   RESPONSIVE - Mobile
   ============================================================ */
@media (max-width: 768px) {
    /* Hide scrollbar on mobile — meaningless with infinite scroll */
    .race-search-body { scrollbar-width: none !important; }
    .race-search-body::-webkit-scrollbar { display: none !important; }

    .race-search-body header {
        padding: 0 16px !important;
        height: 50px !important;
        border-bottom: none !important;
        background: rgba(12, 12, 12, 0.95) !important;
    }

    .race-search-body .nav-links {
        height: 50px !important;
        padding: 0 16px !important;
    }

    .race-search-body .nav-links .nav-right {
        right: 16px !important;
    }

    .race-search-body .site-logo {
        height: 28px !important;
    }

    .race-search-body .header-text h1 {
        font-size: 1.05rem !important;
    }

    .race-search-body .mobile-nav-bar {
        top: 50px !important;
        background: rgba(12, 12, 12, 0.95) !important;
        padding-top: 0 !important;
        padding-bottom: 3px !important;
    }

    .race-search-body .search-hero {
        height: 35vh;
        min-height: 250px;
        margin-top: 68px;
    }

    .race-search-body .search-hero .hero-title {
        font-size: 1.8rem !important;
    }

    .race-search-body .search-hero .hero-subtitle {
        font-size: 0.95rem !important;
    }

    .race-search-body .search-hero .hero-description {
        font-size: 0.85rem;
    }

    .race-search-body .search-hero .hero-state-links {
        gap: 4px 14px;
    }

    .race-search-body .search-hero .hero-state-links a {
        font-size: 0.85rem;
    }

    .race-search-body .search-hero .hero-content {
        bottom: 40px;
    }

    .race-search-body .controls {
        padding: 12px 16px !important;
        top: 56px;
    }

    /* Mobile filter layout */
    .race-search-body .controls-top-row {
        display: flex;
        gap: 10px;
        align-items: center;
    }

    .race-search-body .controls-top-row .search-input {
        flex: 1;
        min-width: 0 !important;
    }

    .race-search-body .mobile-filter-toggle {
        display: flex !important;
        align-items: center;
        gap: 6px;
        padding: 10px 14px;
        background: var(--rs-bg-input);
        border: 1px solid var(--rs-border);
        border-radius: 8px;
        color: var(--rs-text-secondary);
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        white-space: nowrap;
    }

    .race-search-body .mobile-filter-toggle:hover {
        background: var(--rs-bg-elevated);
    }

    .race-search-body .mobile-filter-toggle[aria-expanded="true"] {
        background: var(--rs-accent);
        color: white;
        border-color: var(--rs-accent);
    }

    .race-search-body .filter-options {
        display: none;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--rs-border);
    }

    .race-search-body .filter-options.expanded {
        display: flex;
    }

    .race-search-body .filter-options select,
    .race-search-body .filter-options input[type="date"],
    .race-search-body .filter-options .multi-select-dropdown {
        flex: 1 1 calc(50% - 5px);
        min-width: 120px;
    }

    .race-search-body .controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .race-search-body .search-input {
        min-width: 100% !important;
    }

    /* Scroll-aware header - hide on scroll down, show on scroll up */
    .race-search-body .site-header {
        transition: transform 0.3s ease;
    }

    .race-search-body .site-header.header-hidden {
        transform: translateY(-100%);
    }

    .race-search-body .mobile-nav-bar {
        transition: transform 0.3s ease;
    }

    .race-search-body .mobile-nav-bar.nav-hidden {
        transform: translateY(-100%);
    }

    /* Adjust controls position when header is hidden */
    .race-search-body .controls {
        transition: top 0.3s ease;
    }

    .race-search-body .site-header.header-hidden ~ .controls,
    .race-search-body .site-header.header-hidden ~ * .controls {
        top: 0 !important;
    }

    .race-search-body .main-layout {
        grid-template-columns: 1fr;
    }

    .race-search-body .my-calendar-sidebar {
        display: none !important;
    }

    .race-search-body .main-content {
        padding: 24px 20px !important;
    }

    .race-search-body .month-header {
        font-size: 1.3rem !important;
    }

    /* Mobile table cards */
    .race-search-body .races-table {
        display: block !important;
    }

    .race-search-body .races-table thead {
        display: none !important;
    }

    .race-search-body .races-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .race-search-body .race-row {
        display: flex !important;
        flex-direction: column !important;
        background: var(--rs-bg-card) !important;
        border: 1px solid var(--rs-border) !important;
        border-radius: 12px !important;
        padding: 16px !important;
        box-shadow: var(--shadow-sm) !important;
    }

    .race-search-body .race-row.featured-gold,
    .race-search-body .race-row.featured-silver,
    .race-search-body .race-row.featured-bronze {
        border-left-width: 4px !important;
    }

    .race-search-body .races-table td {
        display: block !important;
        padding: 4px 0 !important;
        border: none !important;
        width: 100% !important;
    }

    .race-search-body .race-date-cell {
        font-size: 12px !important;
        color: var(--rs-text-muted) !important;
        margin-bottom: 4px !important;
    }

    .race-search-body .race-name-cell {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }

    .race-search-body .race-distances-cell {
        margin-bottom: 10px !important;
    }

    .race-search-body .race-distances-cell .distance-badges-wrapper {
        gap: 8px !important;
    }

    .race-search-body .distance-badge {
        max-width: 100% !important;
    }

    .race-search-body .distance-badge.long-name {
        font-size: 10px !important;
    }

    .race-search-body .race-location-cell {
        font-size: 13px !important;
    }

    .race-search-body footer {
        padding: 32px 20px !important;
    }
}

@media (max-width: 480px) {
    .race-search-body .header-text h1 {
        font-size: 1rem !important;
    }

    .race-search-body .search-hero {
        height: 30vh;
        min-height: 200px;
    }

    .race-search-body .search-hero .hero-title {
        font-size: 1.5rem !important;
    }

    .race-search-body .search-hero .hero-subtitle {
        font-size: 0.85rem !important;
    }

    .race-search-body .search-hero .hero-description {
        font-size: 0.75rem;
    }

    .race-search-body .search-hero .hero-state-links {
        gap: 2px 10px;
    }

    .race-search-body .search-hero .hero-state-links a {
        font-size: 0.75rem;
    }
}

/* ============================================================
   ANIMATIONS - Keep subtle transitions
   ============================================================ */
.race-search-body * {
    animation-duration: 0s !important;
}

/* Re-enable specific transitions */
.race-search-body .distance-badge {
    transition: all 0.15s ease;
}

.race-search-body .race-row {
    transition: all 0.15s ease;
}

.race-search-body .btn {
    transition: all 0.2s ease;
}

/* ============================================================
   SCROLLBAR - Light Theme
   ============================================================ */
.race-search-body ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.race-search-body ::-webkit-scrollbar-track {
    background: var(--rs-bg-elevated);
}

.race-search-body ::-webkit-scrollbar-thumb {
    background: var(--rs-border-dark);
    border-radius: 4px;
}

.race-search-body ::-webkit-scrollbar-thumb:hover {
    background: var(--rs-text-muted);
}

/* ============================================================
   NOSCRIPT - Light Theme
   ============================================================ */
.race-search-body noscript > div {
    background: var(--rs-bg-card);
    border: 2px solid var(--rs-accent);
    color: var(--rs-text);
    border-radius: 12px;
}

.race-search-body noscript h2 {
    color: var(--rs-text);
}

.race-search-body noscript p {
    color: var(--rs-text-secondary);
}

/* ============================================================
   EXAMPLE DASHBOARD - Logged Out User Preview
   ============================================================ */
.race-search-body .example-dashboard {
    margin-top: 70px; /* Account for fixed header */
}

/* Hero Section */
.race-search-body .example-hero {
    position: relative;
    height: 50vh;
    min-height: 400px;
    max-height: 500px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.race-search-body .example-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
}

.race-search-body .example-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.4) 0%,
        rgba(0,0,0,0.2) 30%,
        rgba(0,0,0,0.4) 60%,
        rgba(248,248,246,1) 100%
    );
}

.race-search-body .example-hero-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 50px;
    text-align: center;
}

.race-search-body .example-avatar-wrapper {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(135deg, var(--rs-accent) 0%, #f7c500 100%);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    margin-bottom: 16px;
}

.race-search-body .example-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--rs-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.race-search-body .example-avatar .avatar-emoji {
    font-size: 3.5rem;
}

.race-search-body .example-name {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 400;
    color: #fff;
    text-shadow: 0 2px 16px rgba(0,0,0,0.5);
    margin: 0 0 8px 0;
}

.race-search-body .example-subtitle {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: rgba(255,255,255,0.95);
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    margin: 0;
}

/* Preview Section */
.race-search-body .example-preview {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px 40px;
    background: var(--rs-bg-elevated);
}

.race-search-body .example-section {
    margin-bottom: 32px;
}

.race-search-body .example-section-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--rs-text);
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--rs-accent);
    display: inline-block;
}

/* PB Grid */
.race-search-body .example-pb-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.race-search-body .example-pb-card {
    background: var(--rs-bg-card);
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--rs-border);
    border-top: 4px solid var(--rs-border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.race-search-body .example-pb-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.race-search-body .example-pb-card.pb-5k { border-top-color: var(--rs-5k); }
.race-search-body .example-pb-card.pb-10k { border-top-color: var(--rs-10k); }
.race-search-body .example-pb-card.pb-half { border-top-color: var(--rs-half); }
.race-search-body .example-pb-card.pb-marathon { border-top-color: var(--rs-marathon); }

.race-search-body .example-pb-card .pb-distance {
    display: block;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.race-search-body .example-pb-card .pb-time {
    display: block;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--rs-text);
    margin-bottom: 6px;
}

.race-search-body .example-pb-card .pb-event {
    display: block;
    font-size: 0.75rem;
    color: var(--rs-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Upcoming Races */
.race-search-body .example-upcoming {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.race-search-body .example-race-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--rs-bg-card);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--rs-border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.race-search-body .example-race-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.race-search-body .example-race-card.highlight {
    border: 2px solid var(--rs-accent);
    background: rgba(251,212,14,0.05);
}

.race-search-body .example-race-card .race-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--rs-bg-elevated);
    border-radius: 10px;
    flex-shrink: 0;
}

.race-search-body .example-race-card .race-date.goal {
    background: var(--rs-accent);
}

.race-search-body .example-race-card .date-month {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    letter-spacing: 0.5px;
}

.race-search-body .example-race-card .race-date.goal .date-month {
    color: var(--rs-accent-text);
}

.race-search-body .example-race-card .date-day {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--rs-text);
    line-height: 1;
}

.race-search-body .example-race-card .race-date.goal .date-day {
    color: var(--rs-accent-text);
}

.race-search-body .example-race-card .race-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.race-search-body .example-race-card .race-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--rs-text);
}

.race-search-body .example-race-card .race-distance {
    font-size: 0.85rem;
    color: var(--rs-text-muted);
}

.race-search-body .example-race-card .goal-race {
    color: var(--rs-marathon);
    font-weight: 600;
}

.race-search-body .example-race-card .race-countdown {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--rs-text-muted);
    white-space: nowrap;
}

/* CTA Section */
.race-search-body .example-cta {
    background: linear-gradient(135deg, var(--rs-text) 0%, #2d2d2d 100%);
    border-radius: 16px;
    padding: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    margin-top: 16px;
}

.race-search-body .cta-content h3 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 400;
    color: #fff;
    margin: 0 0 12px 0;
}

.race-search-body .cta-content p {
    font-size: 1rem;
    color: rgba(255,255,255,0.8);
    margin: 0 0 24px 0;
    line-height: 1.6;
}

.race-search-body .cta-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.race-search-body .btn-cta-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(251,212,14,0.4);
}

.race-search-body .btn-cta-primary:hover {
    background: var(--rs-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(251,212,14,0.5);
}

.race-search-body .btn-cta-secondary {
    display: inline-flex;
    align-items: center;
    color: rgba(255,255,255,0.9);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    padding: 14px 24px;
    text-decoration: none;
    transition: color 0.2s;
}

.race-search-body .btn-cta-secondary:hover {
    color: var(--rs-accent);
}

.race-search-body .cta-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.race-search-body .cta-features .feature {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.9);
    font-size: 0.95rem;
}

.race-search-body .cta-features .feature-icon {
    font-size: 1.5rem;
}

/* Divider */
.race-search-body .example-dashboard + .controls {
    border-top: 1px solid var(--rs-border);
    padding-top: 24px;
    margin-top: 0;
}

/* Hide example dashboard for logged-in users */
.race-search-body.logged-in .example-dashboard {
    display: none;
}

/* ============================================================
   EXAMPLE DASHBOARD - MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .race-search-body .example-pb-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .race-search-body .example-cta {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 32px 24px;
    }

    .race-search-body .cta-features {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .race-search-body .cta-features .feature {
        flex-direction: column;
        text-align: center;
        gap: 6px;
        font-size: 0.8rem;
    }
}

@media (max-width: 600px) {
    .race-search-body .example-dashboard {
        margin-top: 56px;
    }

    .race-search-body .example-hero {
        min-height: 320px;
        max-height: 380px;
    }

    .race-search-body .example-avatar-wrapper {
        width: 90px;
        height: 90px;
    }

    .race-search-body .example-avatar .avatar-emoji {
        font-size: 2.5rem;
    }

    .race-search-body .example-preview {
        padding: 0 16px 32px;
    }

    .race-search-body .example-pb-card {
        padding: 14px 12px;
    }

    .race-search-body .example-pb-card .pb-time {
        font-size: 1.3rem;
    }

    .race-search-body .example-race-card {
        padding: 14px 16px;
        gap: 12px;
    }

    .race-search-body .example-race-card .race-date {
        width: 48px;
        height: 48px;
    }

    .race-search-body .example-race-card .date-day {
        font-size: 1.2rem;
    }

    .race-search-body .cta-buttons {
        flex-direction: column;
    }

    .race-search-body .btn-cta-primary,
    .race-search-body .btn-cta-secondary {
        width: 100%;
        justify-content: center;
    }

    .race-search-body .cta-features {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================================
   STATE INTRO SECTION - Only shown on state landing pages
   Clean, minimal bridge from hero to filters
   ============================================================ */
.race-search-intro.state-intro {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 24px 20px;
    text-align: center;
    background: var(--rs-bg);
    border: none;
    border-bottom: 1px solid var(--rs-border-light);
}

.race-search-intro p {
    color: var(--rs-text-muted);
    font-family: var(--font-body);
    font-size: 0.92rem;
    line-height: 1.6;
    margin: 0 0 16px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* State page heading */
.race-search-intro .state-heading {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--rs-text);
    margin: 0 0 8px;
}

/* State Quick Links - Compact inline style */
.state-quick-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 12px;
}

.state-quick-links a {
    display: inline-block;
    padding: 4px 8px;
    background: transparent;
    color: var(--rs-text-secondary);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: none;
    transition: color 0.2s ease;
}

.state-quick-links a:hover {
    color: var(--rs-accent-hover);
}

/* "Other states:" label */
.state-quick-links .label {
    color: var(--rs-text-muted);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@media (max-width: 768px) {
    .race-search-intro.state-intro {
        padding: 20px 16px 16px;
    }

    .race-search-intro p {
        font-size: 0.88rem;
        margin-bottom: 12px;
    }

    .race-search-intro .state-heading {
        font-size: 1.15rem;
    }

    .state-quick-links {
        gap: 2px 8px;
    }

    .state-quick-links a {
        padding: 3px 6px;
        font-size: 0.8rem;
    }

    .state-quick-links .label {
        width: 100%;
        text-align: center;
        margin-bottom: 6px;
    }
}

/* ============================================================
   BREADCRUMB NAVIGATION (SEO + UX)
   ============================================================ */
.breadcrumb-nav {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 8px 20px;
    background: transparent;
    border-bottom: none;
    font-family: var(--font-body);
    font-size: 0.85rem;
}

.breadcrumb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.breadcrumb-list li {
    display: flex;
    align-items: center;
}

.breadcrumb-list li:not(:last-child)::after {
    content: "›";
    margin-left: 8px;
    color: var(--rs-text-muted);
}

.breadcrumb-list li:not(:last-child)::after {
    color: rgba(255,255,255,0.6);
}

.breadcrumb-list a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.15s ease;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.breadcrumb-list a:hover {
    color: #fff;
    text-decoration: underline;
}

.breadcrumb-list span[aria-current="page"] {
    color: #fff;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
    .breadcrumb-nav {
        top: 68px;
        padding: 6px 16px;
        font-size: 0.8rem;
    }
}

/* ============================================================
   AD CONTAINERS
   ============================================================ */
.ad-container {
    text-align: center;
    overflow: hidden;
}

.ad-in-list {
    padding: 0;
    margin: 0;
}

.ad-in-list:empty,
.ad-in-list ins[data-ad-status="unfilled"] {
    display: none;
}

.ad-row:has(ins[data-ad-status="unfilled"]) {
    display: none;
}

.ad-row td {
    padding: 0;
    border: none;
}
