/* ===== Light Theme Design System ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --bg-body: #f5f5f5;
    --bg-card: #ffffff;
    --bg-sidebar: #fafafa;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;

    --color-orange: #e95420;
    --color-green: #16a34a;
    --color-blue: #2563eb;
    --color-red: #dc2626;
    --color-yellow: #ca8a04;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html.dark-theme, body.dark-theme, .dark-theme {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --bg-sidebar: #181818;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --border-color: #374151;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 300px;
    min-width: 300px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 24px;
}

.sidebar-header h2 {
    color: var(--color-orange);
    font-size: 20px;
    font-weight: 700;
}

.sidebar-header .subtitle {
    color: var(--text-secondary);
    font-size: 11px;
}

.sidebar h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.profiles-section {
    flex-grow: 1;
    margin-bottom: 20px;
}

.profiles-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.profile-item:hover {
    background-color: #f0f0f0;
}

.profile-item.active {
    background-color: #fff3ed;
    border-color: var(--color-orange);
}

.profile-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-item-info {
    display: flex;
    flex-direction: column;
}

.profile-item-name {
    font-size: 13px;
    font-weight: 600;
}

.profile-item-sport {
    font-size: 11px;
    color: var(--text-secondary);
}

.loading-text {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    padding: 16px 0;
}

/* ===== Inputs & Buttons ===== */
.import-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.import-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

input[type="text"] {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 7px 10px;
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--color-orange);
}

button {
    background-color: var(--color-orange);
    color: white;
    border: none;
    padding: 7px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

button:hover {
    opacity: 0.9;
}

.file-upload-container {
    text-align: center;
}

.file-upload-label {
    display: block;
    border: 1px dashed var(--border-color);
    padding: 14px 8px;
    border-radius: 6px;
    cursor: pointer;
    background-color: #fff;
}

.file-upload-label:hover {
    background-color: #f9f9f9;
}

.file-upload-label span {
    font-size: 11px;
    color: var(--text-secondary);
}

.file-upload-label input[type="file"] {
    display: none;
}

/* ===== Main Content Panel ===== */
.main-content {
    flex-grow: 1;
    background-color: var(--bg-body);
    padding: 20px 24px;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.empty-message {
    text-align: center;
    max-width: 360px;
}

.empty-message h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.empty-message p {
    font-size: 13px;
    color: var(--text-secondary);
}

.hidden {
    display: none !important;
}

/* ===== Import Success Banner ===== */
.import-banner {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.import-banner p {
    font-size: 13px;
    color: #166534;
    font-weight: 500;
}

.import-banner .close-banner {
    background: transparent;
    color: #166534;
    font-size: 16px;
    padding: 0 4px;
    cursor: pointer;
}

/* ===== Athlete Header ===== */
.athlete-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.athlete-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-orange);
}

.athlete-info {
    flex-grow: 1;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.athlete-info h1 {
    font-size: 20px;
    font-weight: 700;
}

.athlete-location {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.athlete-badges {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.badge {
    background-color: #f3f4f6;
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.delete-btn {
    background-color: transparent;
    border: 1px solid var(--color-red);
    color: var(--color-red);
    padding: 4px 8px;
    font-size: 11px;
}

.delete-btn:hover {
    background-color: var(--color-red);
    color: white;
}

/* ===== Tabs ===== */
.tabs-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    background-color: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 0;
    font-weight: 500;
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: transparent;
}

.tab-btn.active {
    color: var(--color-orange);
    border-bottom-color: var(--color-orange);
    font-weight: 600;
}

.tab-panel {
    display: none;
}

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

/* ===== Last Run Card ===== */
.last-run-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--color-orange);
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.last-run-card h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.last-run-card .run-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.last-run-card .run-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.last-run-stats {
    display: flex;
    gap: 32px;
}

.last-run-stat {
    display: flex;
    flex-direction: column;
}

.last-run-stat .label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.last-run-stat .value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.last-run-stat .unit {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

/* ===== Stats Widgets ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 6px;
}

.stat-card h4 {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.stat-value .unit {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

.progress-bar-container {
    height: 5px;
    background-color: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-bar {
    height: 100%;
    background-color: var(--color-orange);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.stat-caption {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
}

/* ===== Charts ===== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 6px;
}

.chart-card h3 {
    font-size: 13px;
    margin-bottom: 12px;
    font-weight: 600;
}

.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

/* ===== Activity Table ===== */
.activity-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.activity-filters input[type="text"] {
    max-width: 280px;
}

.activity-filters select {
    background-color: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 7px 10px;
    border-radius: 4px;
    font-size: 13px;
}

.table-container {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow-x: auto;
    background-color: var(--bg-card);
}

.activities-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.activities-table th,
.activities-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}

.activities-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
}

.activities-table tbody tr:hover {
    background-color: #f9fafb;
}

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


/* ===== Mobile Responsiveness ===== */
@media (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
    }
    .app-container {
        flex-direction: column;
        height: auto;
    }
    .sidebar {
        width: 100%;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 35vh; /* Keep it relatively compact */
        overflow-y: auto;
    }
    .main-content {
        padding: 16px;
        overflow-y: visible;
    }
    .athlete-header {
        align-items: center;
        text-align: center;
        flex-direction: column;
    }
    .header-row {
        width: 100%;
        justify-content: center;
        flex-direction: column;
        gap: 8px;
    }
    .athlete-badges {
        justify-content: center;
    }
    .last-run-stats {
        flex-wrap: wrap;
        gap: 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .activity-filters {
        flex-direction: column;
    }
    .activity-filters input[type="text"] {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}



/* ===== 3-Column Layout Overrides ===== */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 0;
    height: calc(100vh - 60px);
}

.top-nav {
    height: 60px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}

.top-nav .brand h2 {
    color: var(--color-orange);
    font-size: 18px;
    margin: 0;
}

.top-nav .subtitle {
    font-size: 11px;
    color: var(--text-secondary);
}

.admin-badge {
    background-color: var(--color-green);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.leaderboard-panel {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
}

.leaderboard-panel h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.panel-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 8px;
}
.leaderboard-item .rank {
    font-size: 16px;
    font-weight: bold;
    color: var(--color-orange);
    min-width: 20px;
}
.leaderboard-item img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}
.leaderboard-item-info {
    flex-grow: 1;
}
.leaderboard-item-info h4 {
    font-size: 13px;
    margin: 0;
}
.leaderboard-item-info span {
    font-size: 11px;
    color: var(--text-secondary);
}
.leaderboard-item .score {
    font-weight: bold;
    font-size: 14px;
}

.feed-panel {
    background-color: var(--bg-body);
    padding: 24px;
    overflow-y: auto;
    position: relative;
}

.challenge-section {
    margin-bottom: 24px;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.challenge-card {
    background: linear-gradient(135deg, var(--color-orange), #ff7e5f);
    color: white;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.challenge-card h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
}
.challenge-card p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}
.challenge-del-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.challenge-del-btn:hover {
    background: rgba(255,255,255,0.4);
}

.global-feed-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feed-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 6px;
    display: flex;
    gap: 16px;
}
.feed-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f1f5f9;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}
.feed-item-content {
    flex-grow: 1;
}
.feed-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.feed-athlete {
    font-weight: 600;
    font-size: 13px;
}
.feed-time {
    font-size: 11px;
    color: var(--text-secondary);
}
.feed-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}
.feed-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}
.feed-stats span strong {
    color: var(--text-primary);
}

.athlete-dashboard-overlay {
    position: absolute;
    top: 0; left: 0; right: 0;
    min-height: 100%;
    background-color: var(--bg-body);
    padding: 24px;
    z-index: 10;
}

.close-dashboard-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 16px;
    padding: 0;
}
.close-dashboard-btn:hover {
    color: var(--color-orange);
}

.form-box {
    background: white;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.add-btn {
    background: transparent;
    border: 1px solid var(--color-orange);
    color: var(--color-orange);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}
.add-btn:hover {
    background: var(--color-orange);
    color: white;
}

/* Mobile Overrides Update */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .leaderboard-panel, .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .feed-panel {
        order: -1; /* Show feed first on mobile */
    }
}



/* ===== CHAMPION LAYOUT STYLES (LIGHT THEME) ===== */
.app-container {
    display: block; /* Override the old 3-column grid */
    height: 100vh;
    overflow-y: auto;
    background-color: var(--bg-body);
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    height: 70px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand {
    display: flex;
    flex-direction: column;
}

.brand h2 {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.5px;
}

.brand .subtitle {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.main-nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 24px 0;
    border-bottom: 3px solid transparent;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--color-orange);
    border-bottom-color: var(--color-orange);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dashboard-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}

.title-area .live-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.title-area h1 {
    font-size: 32px;
    font-weight: 900;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.time-filters {
    display: flex;
    gap: 8px;
}







/* Champion Banner */
.champion-banner {
    background: linear-gradient(100deg, #fff 0%, #fff3ed 100%);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.champion-banner::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 0; width: 4px;
    background-color: var(--color-orange);
}

.champion-content {
    display: flex;
    align-items: center;
    gap: 32px;
    z-index: 2;
}

.champion-avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.champion-avatar-container img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
    border: 3px solid var(--color-orange);
}

.medal-badge {
    position: absolute;
    bottom: -10px;
    right: -10px;
    background-color: var(--color-orange);
    color: white;
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    border: 2px solid white;
}

.champion-info .champion-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-orange);
    letter-spacing: 2px;
    margin-bottom: 8px;
    display: block;
}

.champion-info h2 {
    font-size: 42px;
    font-weight: 900;
    margin: 0 0 16px 0;
    text-transform: uppercase;
    line-height: 1;
}

.champion-stats {
    display: flex;
    gap: 32px;
}

.champion-stats .stat {
    display: flex;
    flex-direction: column;
}

.champion-stats .label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.champion-stats .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.champion-stats .unit {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.champion-rank {
    font-size: 160px;
    font-weight: 900;
    color: rgba(233, 84, 32, 0.1);
    line-height: 1;
    z-index: 1;
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
}

/* Two-Column Layout */
.dashboard-columns {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.section-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.section-subtitle {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.view-all-link {
    font-size: 11px;
    color: var(--color-orange);
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 1px;
}

/* Leaderboard Table */
.leaderboard-table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: #fafafa;
    text-align: left;
    font-weight: 600;
}

.leaderboard-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
    cursor: pointer;
}

.leaderboard-table tbody tr:hover {
    background-color: #f9fafb;
}

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

.leaderboard-table td {
    padding: 16px 20px;
    vertical-align: middle;
}

.rank-cell {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-secondary);
    width: 60px;
}

.rank-cell.top-rank {
    color: var(--color-orange);
}

.athlete-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.athlete-cell img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.athlete-cell-info {
    display: flex;
    flex-direction: column;
}

.athlete-cell-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.athlete-cell-status {
    font-size: 11px;
    color: var(--text-secondary);
}

.acts-cell {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: right;
    font-weight: 500;
}

.value-cell {
    font-size: 16px;
    font-weight: 700;
    text-align: right;
    color: var(--text-primary);
}

/* Activity Feed Overrides */
.global-feed-list {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    max-height: 800px;
    overflow-y: auto;
}

.feed-item {
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    padding: 16px 20px;
    background-color: transparent;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.feed-item:hover {
    background-color: rgba(233, 84, 32, 0.04) !important;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-columns {
        grid-template-columns: 1fr;
    }
    
    .champion-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: 24px;
    }
    
    .champion-rank {
        top: 24px;
        transform: none;
        font-size: 80px;
    }
}
@media (max-width: 768px) {
    .main-nav {
        display: none;
    }
}



/* ===== Ticker and Smooth Scroll ===== */
html {
    scroll-behavior: smooth;
}







@keyframes ticker-scroll {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0); /* Assuming we duplicate content to create seamless loop */
    }
}

/* ===== Athlete Dashboard Theme Layout ===== */
.athlete-profile-container {
    display: flex;
    gap: 32px;
    max-width: 1400px;
    margin: 0 auto;
}
.athlete-sidebar {
    width: 300px;
    flex-shrink: 0;
}
.athlete-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 8px;
    text-align: center;
}
.athlete-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    object-fit: cover;
    margin-bottom: 16px;
}
.athlete-card h1 {
    font-size: 24px;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    color: var(--text-primary);
}
.athlete-role {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.athlete-status {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 16px;
}
.athlete-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    font-size: 13px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}
.summary-row span:last-child {
    color: var(--text-primary);
    font-weight: 600;
}
.summary-row.highlight span:last-child {
    color: var(--color-green);
}
.athlete-main {
    flex-grow: 1;
}
.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.profile-stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 8px;
}
.stat-header {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: 1px;
    margin-bottom: 12px;
}
.profile-stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}
.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.profile-chart-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 8px;
}
.athlete-feed-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
}
.athlete-feed-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
    border-bottom: 1px solid var(--border-color);
}
.athlete-feed-item:hover {
    background-color: rgba(233, 84, 32, 0.04);
}
.athlete-feed-item:last-child {
    border-bottom: 1px solid transparent;
}

/* ===== Activity Feed Filters ===== */
.feed-filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex-wrap: nowrap;
}

.feed-select {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
    height: 38px;
    flex-grow: 1;
}

.feed-select:focus {
    outline: none;
    border-color: var(--color-orange);
    box-shadow: 0 0 0 2px rgba(233, 84, 32, 0.1);
}

.feed-apply-btn {
    background-color: var(--color-orange);
    color: white;
    border: none;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    height: 38px;
    box-shadow: 0 2px 4px rgba(233, 84, 32, 0.2);
    white-space: nowrap;
}

.feed-apply-btn:hover {
    background-color: #d14917;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(233, 84, 32, 0.3);
}

.feed-apply-btn:active {
    transform: translateY(0);
}

.feed-reset-btn {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    height: 38px;
    white-space: nowrap;
}

.feed-reset-btn:hover {
    background-color: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    border-color: #d1d5db;
}

.active-filters-display {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 15px;
    padding: 8px 12px;
    background: rgba(233, 84, 32, 0.05);
    border-left: 3px solid var(--color-orange);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.active-filters-display span {
    font-weight: 600;
    color: var(--color-orange);
}

/* Responsive filter bar */
@media (max-width: 768px) {
    .feed-filters-bar {
        flex-wrap: wrap;
    }
    .feed-select {
        flex: 1 1 calc(50% - 6px);
    }
    .feed-apply-btn, .feed-reset-btn {
        flex: 1 1 calc(50% - 6px);
    }
}

@media (max-width: 480px) {
    .feed-filters-bar {
        flex-direction: column;
    }
    .feed-select, .feed-apply-btn, .feed-reset-btn {
        width: 100%;
        flex: 1 1 100%;
    }
}


@media (max-width: 768px) {
    .hidden-mobile {
        display: none !important;
    }
}




.athlete-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 8px;
    text-align: center;
}
.athlete-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    object-fit: cover;
    margin-bottom: 16px;
}
.athlete-card h1 {
    font-size: 24px;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    color: var(--text-primary);
}
.athlete-role {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.athlete-status {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 16px;
}
.athlete-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    font-size: 13px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}
.summary-row span:last-child {
    color: var(--text-primary);
    font-weight: 600;
}
.summary-row.highlight span:last-child {
    color: var(--color-green);
}
.athlete-main {
    flex-grow: 1;
}
.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.profile-stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 8px;
}
.stat-header {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: 1px;
    margin-bottom: 12px;
}
.profile-stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}
.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.profile-chart-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 8px;
}
.athlete-feed-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
}
.athlete-feed-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
    border-bottom: 1px solid var(--border-color);
}
.athlete-feed-item:hover {
    background-color: rgba(233, 84, 32, 0.04);
}
.athlete-feed-item:last-child {
    border-bottom: 1px solid transparent;
}

/* ===== Activity Feed Filters ===== */
.feed-filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex-wrap: nowrap;
}

.feed-select {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
    height: 38px;
    flex-grow: 1;
}

.feed-select:focus {
    outline: none;
    border-color: var(--color-orange);
    box-shadow: 0 0 0 2px rgba(233, 84, 32, 0.1);
}

.feed-apply-btn {
    background-color: var(--color-orange);
    color: white;
    border: none;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    height: 38px;
    box-shadow: 0 2px 4px rgba(233, 84, 32, 0.2);
    white-space: nowrap;
}

.feed-apply-btn:hover {
    background-color: #d14917;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(233, 84, 32, 0.3);
}

.feed-apply-btn:active {
    transform: translateY(0);
}

.feed-reset-btn {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    height: 38px;
    white-space: nowrap;
}

.feed-reset-btn:hover {
    background-color: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    border-color: #d1d5db;
}

.active-filters-display {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 15px;
    padding: 8px 12px;
    background: rgba(233, 84, 32, 0.05);
    border-left: 3px solid var(--color-orange);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.active-filters-display span {
    font-weight: 600;
    color: var(--color-orange);
}

/* Responsive filter bar */
@media (max-width: 768px) {
    .feed-filters-bar {
        flex-wrap: wrap;
    }
    .feed-select {
        flex: 1 1 calc(50% - 6px);
    }
    .feed-apply-btn, .feed-reset-btn {
        flex: 1 1 calc(50% - 6px);
    }
}

@media (max-width: 480px) {
    .feed-filters-bar {
        flex-direction: column;
    }
    .feed-select, .feed-apply-btn, .feed-reset-btn {
        width: 100%;
        flex: 1 1 100%;
    }
}


@media (max-width: 768px) {
    .hidden-mobile {
        display: none !important;
    }
}



/* ===== CHAMPS SECTION (LOCAL FIX) ===== */
.champs-section {
    margin-bottom: 30px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.5));
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.champs-header h2 {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 4px 0;
    color: var(--text-color);
}

.champs-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 20px 0;
}

.champs-cards-container {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 12px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(233, 84, 32, 0.5) transparent;
}

.champs-cards-container::-webkit-scrollbar {
    height: 6px;
}

.champs-cards-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
}

.champs-cards-container::-webkit-scrollbar-thumb {
    background-color: rgba(233, 84, 32, 0.5);
    border-radius: 10px;
}

.champ-card {
    flex: 0 0 240px; /* Fixed compact width */
    background: white;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.champ-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(233, 84, 32, 0.12);
    border-color: rgba(233, 84, 32, 0.3);
}

.champ-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #f8fafc;
    box-shadow: 0 0 0 2px var(--color-orange);
    margin-bottom: 12px;
}

.champ-info {
    width: 100%;
}

.champ-title-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(233, 84, 32, 0.1);
    color: var(--color-orange);
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.champ-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.champ-metric {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Skeleton animation */
.champ-card.skeleton {
    min-height: 160px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.champs-empty-state {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    background: rgba(255,255,255,0.5);
    border-radius: 8px;
    width: 100%;
}

/* ===== Modern Challenge Cards ===== */
.modern-challenge-card {
    display: flex;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.cc-left {
    flex: 0 0 300px;
    position: relative;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: white;
    background-size: cover;
    background-position: center;
}

.cc-left::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 100%);
    z-index: 1;
}

.cc-left-content {
    position: relative;
    z-index: 2;
}

.cc-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    backdrop-filter: blur(4px);
}

.cc-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.2;
}

.cc-desc {
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.5;
}

.cc-middle {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--border-color);
}

.cc-timeline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.cc-timeline-item {
    display: flex;
    gap: 12px;
}

.cc-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background-color: #fff7ed;
    color: var(--color-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.cc-info {
    display: flex;
    flex-direction: column;
}

.cc-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 2px;
}

.cc-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.cc-stats-row {
    display: flex;
    gap: 24px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-color);
}

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

.cc-right {
    flex: 0 0 240px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: #f8fafc;
}

.cc-reg-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 16px;
}

.cc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.btn-participate {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    transition: all 0.2s;
}

.btn-participate.active {
    background-color: var(--color-orange);
    color: white;
}

.btn-participate.active:hover {
    background-color: #d04719;
}

.btn-participate.leave {
    background-color: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-participate.leave:hover {
    background-color: #f1f5f9;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .modern-challenge-card {
        flex-direction: column;
    }
    .cc-left {
        flex: 0 0 200px;
    }
    .cc-middle {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .cc-right {
        flex: 0 0 auto;
        padding: 20px;
    }
}

@media (max-width: 640px) {
    .cc-timeline {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .cc-stats-row {
        flex-direction: column;
        gap: 16px;
    }
}



/* ==========================================================================
   MOBILE UI FIXES: DASHBOARD HEADER & TIME FILTERS
   ========================================================================== */

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px;
        margin-bottom: 24px;
        width: 100%;
        overflow: hidden; /* Prevent horizontal overflow */
    }
    
    .dashboard-header .title-area {
        width: 100%;
    }
    
    .dashboard-header .time-filters {
        width: 100%;
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px; /* Room for scrollbar */
        gap: 8px !important;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none;  /* IE and Edge */
    }
    
    /* Hide scrollbar for Chrome, Safari and Opera */
    .dashboard-header .time-filters::-webkit-scrollbar {
        display: none;
    }
    
    .dashboard-header .time-filters .filter-btn {
        flex: 0 0 auto !important; /* Prevent shrinking */
        white-space: nowrap !important; /* Keep text on one line */
        background-color: var(--bg-body, #f5f5f5) !important;
        border: 1px solid var(--border-color, #e5e7eb) !important;
        border-radius: 20px !important; /* Pill shape chip */
        padding: 8px 16px !important;
        font-size: 11px !important;
        color: var(--text-secondary, #6b7280) !important;
    }
    
    .dashboard-header .time-filters .filter-btn.active {
        background-color: var(--color-orange, #e95420) !important;
        border-color: var(--color-orange, #e95420) !important;
        color: #ffffff !important;
    }
}


/* ==========================================================================
   MOBILE UI REDESIGN OVERRIDES
   ========================================================================== */

/* --- Global Overrides --- */
:root {
    --border-radius-card: 16px;
    --border-radius-btn: 12px;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 24px rgba(233, 84, 32, 0.15);
}

body {
    -webkit-tap-highlight-color: transparent;
    padding-bottom: 0; /* Updated in media query */
}

/* Upgrade existing cards to look more premium */
.stat-card, .chart-card, .last-run-card, .feed-item, .leaderboard-item, .modern-challenge-card {
    border-radius: var(--border-radius-card) !important;
    box-shadow: var(--shadow-soft) !important;
    border: 1px solid rgba(0, 0, 0, 0.03) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover, .chart-card:hover, .feed-item:hover, .modern-challenge-card:hover {
    box-shadow: var(--shadow-hover) !important;
    transform: translateY(-2px);
}

/* Enhance Buttons */
button, .btn-participate, .view-all {
    border-radius: var(--border-radius-btn) !important;
    transition: all 0.2s ease;
}

button:active {
    transform: scale(0.98);
}

/* --- Bottom Navigation --- */
.bottom-nav {
    display: none; /* Hidden on desktop */
}

/* --- Mobile Specific Overrides --- */
@media (max-width: 768px) {
    body {
        padding-bottom: 70px; /* Space for bottom nav */
    }

    .app-container {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
    }

    .top-nav {
        position: sticky;
        top: 0;
        z-index: 50;
        padding: 0 16px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }
    
    .top-nav .main-nav {
        display: none !important; /* Hide desktop nav links */
    }

    .top-nav .brand h2 {
        font-size: 16px;
    }
    
    .top-nav .subtitle {
        display: none; /* Hide subtitle on mobile for cleaner look */
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65px;
        background-color: var(--bg-card);
        border-top: 1px solid var(--border-color);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        padding: 0 10px;
        box-shadow: 0 -2px 15px rgba(0,0,0,0.05);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .bnav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #94a3b8;
        font-size: 11px;
        font-weight: 500;
        gap: 4px;
        width: 20%;
        height: 100%;
        position: relative;
        transition: color 0.2s ease;
    }

    .bnav-link i, .bnav-link svg {
        width: 22px;
        height: 22px;
        color: #94a3b8;
        transition: transform 0.2s ease, stroke-width 0.2s ease, color 0.2s ease;
    }

    .bnav-link.active {
        color: var(--color-orange);
        font-weight: 600;
    }
    
    .bnav-link.active i, .bnav-link.active svg {
        color: var(--color-orange);
        transform: translateY(-2px);
        stroke-width: 2.5px;
    }

    .bnav-link.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 3px;
        background-color: var(--color-orange);
        border-bottom-left-radius: 3px;
        border-bottom-right-radius: 3px;
    }


    /* Stack 3-column layout panels */
    .sidebar, .leaderboard-panel, .feed-panel {
        width: 100% !important;
        max-width: 100% !important;
        border-right: none !important;
        border-bottom: none !important;
        padding: 16px !important;
        overflow-y: visible !important;
        height: auto !important;
    }

    .main-content, .dashboard-main {
        padding: 16px !important;
        overflow-y: visible !important;
    }

    /* Convert Tables to stacked cards on mobile if possible */
    .activities-table, .activities-table tbody, .activities-table tr, .activities-table td {
        display: block;
        width: 100%;
    }
    .activities-table thead {
        display: none; /* Hide table headers on mobile */
    }
    .activities-table tr {
        margin-bottom: 12px;
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-card);
        padding: 12px;
        background: var(--bg-card);
        box-shadow: var(--shadow-soft);
    }
    .activities-table td {
        border-bottom: none;
        padding: 4px 0;
        text-align: left !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Buttons touch targets */
    button, .btn-participate, input[type="text"], select, .tab-btn {
        min-height: 44px;
    }

    /* Dashboard specific */
    .dashboard-columns {
        display: flex !important;
        flex-direction: column !important;
        gap: 24px;
    }
    
    .leaderboard-table, .leaderboard-table tbody, .leaderboard-table tr, .leaderboard-table td {
         display: block;
         width: 100%;
    }
    .leaderboard-table thead { display: none; }
    .leaderboard-table tr {
         margin-bottom: 8px;
         background: var(--bg-card);
         border-radius: var(--border-radius-card);
         padding: 12px;
         display: flex;
         flex-wrap: wrap;
         align-items: center;
         justify-content: space-between;
         box-shadow: var(--shadow-soft);
    }
    .leaderboard-table td { padding: 4px 0; border: none; }
    .leaderboard-table td.acts-cell { display: none; } /* hide activities count on mobile to save space */
    .rank-cell { font-size: 20px; font-weight: bold; color: var(--color-orange); margin-right: 12px;}
    
    /* Fix global feed list spacing */
    .global-feed-list {
        padding-bottom: 20px;
    }
}


/* --- Challenges Redesign --- */
.modern-challenge-card {
    display: flex;
    flex-direction: row;
    background: var(--bg-card);
    border-radius: var(--border-radius-card);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.cc-left {
    flex: 1;
    min-width: 250px;
    padding: 24px;
    color: white;
    position: relative;
    background-size: cover;
    background-position: center;
}

.cc-left::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.8), rgba(0,0,0,0.4));
    z-index: 1;
}

.cc-left-content {
    position: relative;
    z-index: 2;
}

.cc-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.cc-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.2;
}

.cc-desc {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

.cc-middle {
    flex: 2;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cc-timeline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.cc-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cc-icon {
    font-size: 16px;
}

.cc-info {
    display: flex;
    flex-direction: column;
}

.cc-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

.cc-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.cc-stats-row {
    display: flex;
    gap: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

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

.cc-right {
    flex: 0.8;
    padding: 24px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border-color);
    text-align: center;
}

.btn-participate {
    width: 100%;
    max-width: 200px;
    padding: 12px 20px;
    border-radius: var(--border-radius-btn);
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}

.btn-participate.active {
    background: var(--color-orange);
    color: white;
}

.btn-participate.leave {
    background: transparent;
    color: var(--color-red);
    border: 1px solid var(--color-red);
}

.cc-reg-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}

.cc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

@media (max-width: 900px) {
    .modern-challenge-card {
        flex-direction: column;
    }
    .cc-left::before {
        background: linear-gradient(to bottom, rgba(0,0,0,0.4), rgba(0,0,0,0.8));
    }
    .cc-left {
        padding: 30px 20px 20px;
    }
    .cc-middle {
        padding: 20px;
    }
    .cc-timeline {
        grid-template-columns: 1fr;
    }
    .cc-right {
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding: 20px;
    }
    .btn-participate {
        max-width: 100%;
    }
}


/* --- Profile Redesign Overrides --- */

.athlete-avatar-large {
    border-radius: 50% !important; /* Circular avatar */
    border: 3px solid var(--color-orange);
    box-shadow: var(--shadow-soft);
}

.athlete-card {
    border-radius: var(--border-radius-card) !important;
    box-shadow: var(--shadow-soft) !important;
    border: none !important;
}

@media (max-width: 900px) {
    .athlete-profile-container {
        flex-direction: column !important;
        gap: 20px !important;
    }
    
    .athlete-sidebar {
        width: 100% !important;
    }
    
    .split-layout {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .profile-stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
}
@media (max-width: 480px) {
    .profile-stats {
        grid-template-columns: 1fr !important;
    }
}


/* ==========================================================================
   MOBILE UI FIXES (HOME FEED, DASHBOARD SCROLL, CHAMPION OVERFLOW)
   ========================================================================== */

/* Fix 2: Dashboard/Global Horizontal Scrolling */
body, html {
    max-width: 100%;
    overflow-x: hidden;
}

.app-container {
    width: 100% !important; /* Override 100vw to prevent horizontal scrollbar overlap */
    max-width: 100% !important;
    overflow-x: hidden;
}

.chart-card, .stat-card, .last-run-card, .dashboard-main, .feed-section, .leaderboard-section {
    max-width: 100%;
    box-sizing: border-box;
}

.chart-container {
    max-width: 100%;
    overflow: hidden; /* Prevent canvas from breaking layout */
}

/* Fix 3 & 1: Mobile-specific tweaks */
@media (max-width: 768px) {
    /* Fix 3: Champion Banner Overflow */
    .champion-banner {
        padding: 20px !important; /* reduce padding */
        width: 100%;
        box-sizing: border-box;
    }
    
    .champion-content {
        gap: 16px !important; /* reduce gap between avatar and text */
        width: 100%;
    }
    
    .champion-avatar-container {
        width: 80px !important; /* shrink avatar slightly */
        height: 80px !important;
        flex-shrink: 0;
    }
    
    .champion-info {
        min-width: 0; /* allow flex items to shrink below their content size */
        flex-grow: 1;
    }
    
    .champion-info h2 {
        font-size: 26px !important; /* smaller font */
        margin-bottom: 10px !important;
        word-wrap: break-word;
        hyphens: auto;
    }
    
    .champion-stats {
        gap: 12px !important; /* reduce gap between stats */
        flex-wrap: wrap; /* allow wrapping if it still overflows */
    }
    
    .champion-stats .value {
        font-size: 16px !important; /* smaller stat values */
    }
    
    /* Fix 1: Compact Activity Feed on Home Page */
    #feed-section #global-feed-list {
        max-height: 400px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
        overscroll-behavior-y: contain; /* prevent scrolling the whole page when reaching the end */
        padding-right: 8px; /* space for scrollbar */
        padding-bottom: 10px;
    }
    
    /* Custom scrollbar for the feed container for a cleaner look */
    #feed-section #global-feed-list::-webkit-scrollbar {
        width: 4px;
    }
    #feed-section #global-feed-list::-webkit-scrollbar-track {
        background: transparent;
    }
    #feed-section #global-feed-list::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }
    
    /* Ensure filters don't overflow */
    .feed-filters-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .feed-filters-bar select {
        flex: 1 1 calc(50% - 4px);
        min-width: 120px;
    }
    
    /* Extra padding for charts to prevent overflow */
    .profile-chart-card canvas {
        max-width: 100% !important;
        height: auto !important;
    }
}


/* ==========================================================================
   MOBILE UI FIXES: DASHBOARD HEADER & TIME FILTERS
   ========================================================================== */

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px;
        margin-bottom: 24px;
        width: 100%;
        overflow: hidden; /* Prevent horizontal overflow */
    }
    
    .dashboard-header .title-area {
        width: 100%;
    }
    
    .dashboard-header .time-filters {
        width: 100%;
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px; /* Room for scrollbar */
        gap: 8px !important;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none;  /* IE and Edge */
    }
    
    /* Hide scrollbar for Chrome, Safari and Opera */
    .dashboard-header .time-filters::-webkit-scrollbar {
        display: none;
    }
    
    .dashboard-header .time-filters .filter-btn {
        flex: 0 0 auto !important; /* Prevent shrinking */
        white-space: nowrap !important; /* Keep text on one line */
        background-color: var(--bg-body, #f5f5f5) !important;
        border: 1px solid var(--border-color, #e5e7eb) !important;
        border-radius: 20px !important; /* Pill shape chip */
        padding: 8px 16px !important;
        font-size: 11px !important;
        color: var(--text-secondary, #6b7280) !important;
    }
    
    .dashboard-header .time-filters .filter-btn.active {
        background-color: var(--color-orange, #e95420) !important;
        border-color: var(--color-orange, #e95420) !important;
        color: #ffffff !important;
    }
    }
}

/* Dark Theme Overrides */
html.dark-theme input[type="text"], 
html.dark-theme select,
html.dark-theme textarea {
    background-color: var(--bg-card);
    color: var(--text-primary);
}
html.dark-theme .file-upload-label {
    background-color: var(--bg-body);
}
html.dark-theme .badge, 
html.dark-theme .activities-table th,
html.dark-theme .activities-table tbody tr:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}
html.dark-theme .profile-item:hover,
html.dark-theme .leaderboard-item {
    background-color: var(--bg-body);
}
html.dark-theme .profile-item.active {
    background-color: rgba(233, 84, 32, 0.15);
}


/* ===== Modern Challenge Cards ===== */
.challenge-preview-card {
    display: flex;
    flex-direction: row; /* Two-column layout */
    align-items: stretch;
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    min-height: 180px; /* Consistent height */
}

.challenge-preview-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* LEFT PANEL (Banner) */
.challenge-card-banner {
    position: relative;
    flex: 0 0 32%; /* 32% width */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #f1f5f9; /* fallback bg */
}

/* Ensure banner fills the left panel completely */
.challenge-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.challenge-card-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 0.3s ease;
}

.challenge-preview-card:hover .challenge-card-img,
.challenge-preview-card:hover .challenge-card-fallback {
    transform: scale(1.05);
}

.challenge-card-fallback .fallback-icon {
    font-size: 40px;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.challenge-card-fallback .fallback-type {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Status Badge inside Banner */
.challenge-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: white;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    z-index: 10;
}

.status-active {
    background-color: rgba(34, 197, 94, 0.9);
}

.status-upcoming {
    background-color: rgba(249, 115, 22, 0.9);
}

/* RIGHT PANEL (Details) */
.challenge-card-content {
    flex: 1; /* 68% width */
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.challenge-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.challenge-card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.3;
}

.challenge-card-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

/* Meta Grid (Middle) */
.challenge-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    padding: 14px 0;
    margin: 12px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.challenge-card-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.challenge-card-meta .meta-item i {
    width: 16px;
    height: 16px;
    color: var(--primary-color);
}

/* Footer (Bottom) */
.challenge-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.challenge-time-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}

.challenge-time-info i {
    width: 14px;
    height: 14px;
}

.text-urgent {
    color: #ef4444;
}

.text-upcoming {
    color: #f59e0b;
}

.challenge-cta {
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.challenge-preview-card:hover .challenge-cta {
    background-color: var(--primary-color-dark);
}

.btn-disabled {
    background-color: #cbd5e1 !important;
    color: #64748b !important;
    cursor: not-allowed !important;
    border: none !important;
    opacity: 0.8;
}

.challenge-preview-card:hover .btn-disabled {
    background-color: #cbd5e1 !important;
}

/* Empty States */
.challenge-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background: var(--bg-color);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.challenge-empty-state h4 {
    margin: 0 0 8px 0;
    color: var(--text-color);
}

.challenge-empty-state p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.challenge-empty-state-mini {
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 16px;
}

/* Responsive Stacking */
@media (max-width: 768px) {
    .challenge-preview-card {
        flex-direction: column; /* Stack on mobile */
        min-height: auto;
    }
    
    .challenge-card-banner {
        flex: none;
        height: 140px;
        width: 100%;
        border-radius: 12px 12px 0 0;
    }
    
    .challenge-card-meta {
        grid-template-columns: 1fr; /* Stack meta items vertically on mobile */
    }
}

/* CTA State Buttons */
.btn-success { background-color: #10b981 !important; color: white !important; border-color: #10b981 !important; }
.btn-success:hover { background-color: #059669 !important; }
.btn-disabled-blue { background-color: #bfdbfe !important; color: #1e3a8a !important; cursor: not-allowed !important; border: none !important; }
.status-ended { background-color: rgba(71, 85, 105, 0.9); }


/* ===== Activity Feed Architecture Fix ===== */
.dashboard-columns {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    align-items: start; /* Decouple columns: they no longer force each other's height */
}

.feed-section {
    position: sticky;
    top: 90px; /* Offset for fixed navbar */
    height: calc(100vh - 110px); /* Use remaining viewport height independently */
    display: flex;
    flex-direction: column;
}

.global-feed-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    max-height: none !important;
}

/* Modern thin scrollbar */
.global-feed-list::-webkit-scrollbar {
    width: 6px;
}
.global-feed-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}
.global-feed-list::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}
.global-feed-list::-webkit-scrollbar-thumb:hover {
    background-color: rgba(233, 84, 32, 0.5);
}

@media (max-width: 1024px) {
    .dashboard-columns {
        grid-template-columns: 1fr;
    }
    .feed-section {
        position: static;
        height: 70vh;
        min-height: 400px;
    }
}

/* Category Filter & Loading Skeletons */
.modern-select {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.modern-select:hover {
    border-color: var(--color-orange);
}

.modern-select:focus {
    border-color: var(--color-orange);
    box-shadow: 0 0 0 2px rgba(233, 84, 32, 0.2);
}

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

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .category-filter {
        width: 100%;
        margin-top: 10px;
    }
    .modern-select {
        width: 100%;
    }
}
