/* Base colors */
:root {
    --grit-red: #BF1A2F;
    --grit-blue: #4D7EA8;
    --grit-black: #000000;
    --grit-green: #018E42;
    --grit-gold: #F7D002;
    --grit-orange: #fd7e14;
    --grit-bg: #f7f7f7;
    --grit-white: #ffffff;
    --grit-light-gray: #f8f9fa;
    --grit-gray: #6c757d;
    --grit-dark-gray: #343a40;
    --shadow-light: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-medium: 0 4px 20px rgba(0,0,0,0.12);
    --shadow-heavy: 0 8px 30px rgba(0,0,0,0.16);
    --border-radius: 12px;
    --border-radius-small: 8px;
    --transition: all 0.3s ease;
}

/* General body and backgrounds */
body {
    background: linear-gradient(135deg, var(--grit-bg) 0%, #f0f2f5 100%);
    color: var(--grit-black);
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Center all text for now, including tables */
body, main, .grit-container, section, h1, h2, h3, h4, h5, h6, p, label, #progressStats, #streaks, form, nav, table, th, td {
    text-align: center;
}

/* Header and nav */
header {
    background: linear-gradient(135deg, var(--grit-blue) 0%, #3a6b94 100%);
    color: #fff;
    padding: 15px 0 10px 0;
    border-bottom: 4px solid var(--grit-red);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: visible;
    min-height: auto;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    left: 0;
    right: 0;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.05) 50%, transparent 70%);
    pointer-events: none;
}

nav {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    z-index: 1;
    order: 2;
    margin-top: 15px;
}

nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.5em;
    transition: var(--transition);
    position: relative;
    padding: 12px 16px;
    border-radius: var(--border-radius-small);
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}

nav a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

nav a:hover::before {
    left: 100%;
}

nav a:hover {
    color: var(--grit-gold);
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

nav a.active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--grit-gold);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

nav a i {
    font-size: 0.9em;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--grit-gold);
    transition: var(--transition);
    transform: translateX(-50%);
}

nav a:hover::after {
    width: 80%;
}

/* Logo */
.grit-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    width: 518px;
    height: 420px;
    overflow: visible;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    transition: var(--transition);
    order: 1;
}

.grit-logo:hover {
    transform: scale(1.02);
}

.grit-logo-img {
    width: 400px;   /* Even bigger logo image */
    height: 320px;  /* Even bigger logo image */
    object-fit: contain; /* Maintain aspect ratio and show full logo */
    display: block;
    margin: 0 auto;
    transition: var(--transition);
}
.grit-logo img, .grit-logo-img {
    width: 400px;   /* Even bigger logo image */
    height: 320px;  /* Even bigger logo image */
    object-fit: contain; /* Maintain aspect ratio and show full logo */
    display: block;
    margin: 0 auto;
}

/* Main headings */
h1, h2 {
    color: var(--grit-blue);
    text-align: center;
    margin-top: 16px;
}
h1 {
    font-size: 2.5em;
    letter-spacing: 2px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 32px 0 24px 0;
}
h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    font-weight: 600;
}
h3 {
    font-size: 1.4em;
    margin: 20px 0 16px 0;
    font-weight: 600;
    color: var(--grit-blue);
}

/* Section cards */
section {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    margin-bottom: 24px;
    padding: 24px;
    transition: var(--transition);
    border: 1px solid rgba(77,126,168,0.1);
}

section:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

/* Modern card styles */
.card {
    background: var(--grit-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    margin-bottom: 24px;
    padding: 24px;
    transition: var(--transition);
    border: 1px solid rgba(77,126,168,0.1);
}

.card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    color: white;
    background: linear-gradient(135deg, var(--grit-blue), var(--grit-red));
}

.card-title {
    font-size: 1.4em;
    font-weight: 600;
    color: var(--grit-blue);
    margin: 0;
}

/* Grid layouts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-card {
    background: var(--grit-white);
    border-radius: var(--border-radius-small);
    padding: 20px;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    border: 1px solid rgba(77,126,168,0.1);
    text-align: center;
}

.stat-card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Utility classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.d-flex { display: flex; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

/* Animation classes */
.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buttons */
button, input[type="submit"] {
    background: var(--grit-red);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-small);
    padding: 14px 28px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    margin: 18px 0;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
    text-transform: none;
    position: relative;
    overflow: hidden;
}

button:hover, input[type="submit"]:hover {
    background: var(--grit-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

button:active, input[type="submit"]:active {
    transform: translateY(0);
    box-shadow: var(--shadow-light);
}

/* Button variants */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--grit-red);
    color: white;
    border: none;
    border-radius: var(--border-radius-small);
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: var(--shadow-light);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Button click effects - red flash when clicked */
.btn:active {
    background: var(--grit-red) !important;
    border-color: var(--grit-red) !important;
    color: white !important;
    transform: scale(0.98) !important;
    box-shadow: var(--shadow-light) !important;
}

.btn-primary {
    background: var(--grit-red);
    color: white;
}

.btn-primary:hover {
    background: var(--grit-blue);
}

.btn-secondary {
    background: var(--grit-gray);
    color: white;
}

.btn-secondary:hover {
    background: var(--grit-blue);
}

.btn-success {
    background: var(--grit-green);
    color: white;
}

.btn-warning {
    background: var(--grit-gold);
    color: var(--grit-black);
}

.btn-warning:hover {
    background: #e6c100;
}

.btn-outline {
    background: transparent;
    color: var(--grit-blue);
    border: 2px solid var(--grit-blue);
}

.btn-outline:hover {
    background: var(--grit-blue);
    color: white;
}

.btn-outline:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Inputs and forms */
input, select, textarea {
    width: 95%;
    max-width: 400px;
    margin: 6px 0 12px 0;
    padding: 12px 16px;
    border: 2px solid rgba(77,126,168,0.2);
    border-radius: var(--border-radius-small);
    font-size: 1em;
    background: var(--grit-white);
    color: var(--grit-black);
    box-sizing: border-box;
    transition: var(--transition);
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--grit-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(77,126,168,0.1);
    transform: translateY(-1px);
}

input::placeholder {
    color: var(--grit-gray);
}

/* Form groups */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--grit-blue);
}

/* Enhanced form layout */
.form-section {
    margin-bottom: 32px;
    padding: 24px;
    background: rgba(77,126,168,0.05);
    border-radius: var(--border-radius);
    border: 1px solid rgba(77,126,168,0.1);
}

.form-section h3 {
    margin: 0 0 20px 0;
    color: var(--grit-blue);
    font-size: 1.1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 0;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--grit-blue);
    font-size: 0.95em;
}

.form-group input,
.form-group select {
    width: 100%;
    margin: 0;
    padding: 12px 16px;
    border: 2px solid rgba(77,126,168,0.2);
    border-radius: var(--border-radius-small);
    font-size: 1em;
    background: var(--grit-white);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--grit-blue);
    box-shadow: 0 0 0 3px rgba(77,126,168,0.1);
}

/* Select dropdown options styling */
select option {
    background: var(--grit-white) !important;
    color: var(--grit-black) !important;
    padding: 8px 12px;
    font-size: 1em;
    border: none;
}

select option:hover,
select option:focus {
    background: var(--grit-blue) !important;
    color: var(--grit-white) !important;
}

select option:checked,
select option[selected] {
    background: var(--grit-blue) !important;
    color: var(--grit-white) !important;
    font-weight: 600;
}

/* Ensure dropdown visibility */
select {
    background: var(--grit-white) !important;
    color: var(--grit-black) !important;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
}

/* Force dropdown text visibility */
select:not([multiple]) {
    background-color: var(--grit-white) !important;
    color: var(--grit-black) !important;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .form-section {
        padding: 16px;
        margin-bottom: 24px;
    }
}

/* Search input styling */
input[type="search"], input[type="text"] {
    background: var(--grit-white);
    border: 2px solid rgba(77,126,168,0.2);
    border-radius: var(--border-radius-small);
    padding: 12px 16px;
    font-size: 1em;
    transition: var(--transition);
}

input[type="search"]:focus, input[type="text"]:focus {
    border-color: var(--grit-blue);
    box-shadow: 0 0 0 3px rgba(77,126,168,0.1);
}

/* Stats and highlights */
#progressStats, #streaks {
    background: var(--grit-white);
    color: var(--grit-blue);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 18px;
}
#progressStats b, #streaks b {
    color: var(--grit-black);
}
#currentStreak, #longestStreak {
    color: var(--grit-green);
    font-weight: bold;
}

/* Leaderboard highlights */
.leaderboard-gold {
    color: var(--grit-gold);
    font-weight: bold;
}
.leaderboard-green {
    color: var(--grit-green);
    font-weight: bold;
}

/* Success and error messages */
.success {
    color: var(--grit-green);
    font-weight: bold;
}
.error {
    color: var(--grit-red);
    font-weight: bold;
}

/* Modern leaderboard styles */
.leaderboard-table {
    margin: 24px auto;
    border-collapse: collapse;
    min-width: 340px;
    width: 100%;
    max-width: 800px;
    background: var(--grit-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    overflow: hidden;
    font-size: 1em;
}

.leaderboard-table th, .leaderboard-table td {
    padding: 16px;
    border: none;
    text-align: left;
}

.leaderboard-table th:first-child,
.leaderboard-table td:first-child {
    width: 80px;
    text-align: center;
}

.leaderboard-table th:last-child,
.leaderboard-table td:last-child {
    width: 120px;
    text-align: right;
}

.leaderboard-table th {
    background: linear-gradient(135deg, var(--grit-blue), #3a6b94);
    color: white;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 0.95em;
    text-transform: uppercase;
    position: relative;
}

.leaderboard-table th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--grit-red);
}

/* Modern row styling */
.leaderboard-table tbody tr {
    background: var(--grit-white);
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(77,126,168,0.08);
}

.leaderboard-table tbody tr:hover {
    background: linear-gradient(135deg, rgba(77,126,168,0.05), rgba(77,126,168,0.02));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.leaderboard-table tbody tr:last-child {
    border-bottom: none;
}

.leaderboard-table td {
    color: var(--grit-black);
    font-weight: 500;
    vertical-align: middle;
}

/* Enhanced position highlighting */
.leaderboard-table tbody tr:nth-child(1) {
    background: linear-gradient(135deg, #FFF9C4, #FFECB3) !important;
    border-left: 4px solid #FFD700;
}

.leaderboard-table tbody tr:nth-child(1) td:first-child {
    background: #FFD700;
    color: #1a1a1a;
    font-weight: 800;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(255,215,0,0.3);
}

.leaderboard-table tbody tr:nth-child(2) {
    background: linear-gradient(135deg, #F5F5F5, #EEEEEE) !important;
    border-left: 4px solid #C0C0C0;
}

.leaderboard-table tbody tr:nth-child(2) td:first-child {
    background: #C0C0C0;
    color: #2d2d2d;
    font-weight: 700;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(192,192,192,0.3);
}

.leaderboard-table tbody tr:nth-child(3) {
    background: linear-gradient(135deg, #FFECB3, #FFE0B2) !important;
    border-left: 4px solid #CD7F32;
}

.leaderboard-table tbody tr:nth-child(3) td:first-child {
    background: #CD7F32;
    color: #1a1a1a;
    font-weight: 700;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(205,127,50,0.3);
}

/* Regular position numbers */
.leaderboard-table tbody tr:nth-child(n+4) td:first-child {
    font-weight: 600;
    color: var(--grit-dark);
    background: var(--grit-light-gray);
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

/* Ensure ALL rank cells are properly styled */
.leaderboard-table td:first-child {
    text-align: center;
    font-weight: 700;
    min-width: 40px;
}

.leaderboard-table .rank-cell {
    text-align: center;
    font-weight: 700;
    color: var(--grit-dark) !important;
    font-size: 1em !important;
    display: table-cell !important;
    visibility: visible !important;
}

/* Ensure rank numbers are never hidden */
.leaderboard-table tbody tr td:first-child {
    opacity: 1 !important;
    visibility: visible !important;
    display: table-cell !important;
}

/* Profile name and badge container */
.leaderboard-table .athlete-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.leaderboard-table .athlete-name {
    font-weight: 600;
    color: var(--grit-dark);
}

.leaderboard-table .badge {
    background: var(--grit-red);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

/* GRIT score styling */
.leaderboard-table .grit-score {
    font-weight: 700;
    color: var(--grit-green);
    font-size: 1.1em;
}

/* Crew total section styling */
.crew-total-section {
    background: linear-gradient(135deg, var(--grit-green), #059669);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    text-align: center;
    box-shadow: var(--shadow-medium);
}

.crew-total-section h3 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    font-weight: 600;
}

.crew-total-section .total-grit {
    font-size: 2.5em;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Current user highlighting for table rows */
.leaderboard-table tbody tr.current-user {
    background: linear-gradient(135deg, rgba(77,126,168,0.15), rgba(77,126,168,0.25)) !important;
    border-left: 4px solid var(--grit-blue) !important;
    box-shadow: 0 2px 8px rgba(77,126,168,0.2) !important;
}

.leaderboard-table tbody tr.current-user td {
    font-weight: 600 !important;
    color: var(--grit-blue) !important;
}

.leaderboard-table tbody tr.current-user td:first-child {
    color: white !important;
    background: var(--grit-blue) !important;
}

/* Loading and error states */
.loading-container, .error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--grit-gray);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(77,126,168,0.2);
    border-left: 4px solid var(--grit-blue);
    border-radius: 4px;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-container i {
    font-size: 2em;
    color: var(--grit-red);
    margin-bottom: 16px;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .leaderboard-table {
        font-size: 0.9em;
    }
    
    .leaderboard-table th, .leaderboard-table td {
        padding: 12px 8px;
    }
    
    .leaderboard-table tbody tr:nth-child(-n+3) td:first-child {
        border-radius: 6px;
        margin: 2px;
    }
}

/* Footer style */
footer {
    background: var(--grit-blue);
    color: #fff;
    padding: 28px 20px 18px 20px; /* Added horizontal padding */
    text-align: center;
    border-top: 3px solid var(--grit-red);
    font-size: 1em;
    letter-spacing: 1px;
    width: 100%;
    margin: 0;
    box-sizing: border-box; /* Ensure padding doesn't cause overflow */
    box-shadow: 0 -2px 8px rgba(77,126,168,0.07);
    margin-top: auto; /* Push footer to bottom */
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
    font-weight: 500;
    letter-spacing: 1px;
    opacity: 0.95;
}

/* Footer navigation styling */
footer nav {
    margin-bottom: 18px;
    text-align: center;
}

footer nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0 8px;
}

footer nav a:hover {
    color: var(--grit-gold);
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Remove list markers everywhere */
ul, ol {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}

/* Weekly Power-Ups section */
#weeklyPowerUps {
    background: #f8fafc;
    border-radius: 14px;
    padding: 24px 18px 18px 18px;
    margin: 32px auto 0 auto;
    max-width: 480px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
#weeklyPowerUps h2 {
    text-align: center;
    color: #2d3a4a;
    margin-bottom: 18px;
    font-size: 1.5em;
    letter-spacing: 1px;
}
.powerup-card {
    margin-bottom: 18px;
}
#getPowerUpsBtn {
    display: block;
    margin: 24px auto 0 auto;
    background: #b71c1c;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 36px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: background 0.2s;
}
#getPowerUpsBtn:hover:enabled {
    background: #d32f2f;
}

/* Responsive */
@media (max-width: 600px) {
    main {
        padding: 0 4px;
    }
    section {
        padding: 10px 4px;
    }
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Make every input adjust width to its content */
input,
select,
textarea {
    width: auto;
    min-width: 50px;    /* Optional: prevent too small */
    max-width: 400px;   /* Optional: prevent too large */
    box-sizing: border-box;
    padding: 4px;
    font-family: inherit;
    font-size: inherit;
}

/* Add at the end of your CSS file */

html, body {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

* {
    box-sizing: border-box;
}

main {
    margin-bottom: 28px; /* Ensures at least 20px space above the footer */
    flex: 1; /* Takes up remaining space, pushing footer to bottom */
}

#profileBadges img, #profileBadges svg {
  width: 164px;
  height: 164px;
}

.tagline {
  font-size: 1.2em;
  font-weight: 500;
  color: var(--grit-blue);
  margin-bottom: 24px;
}

.main-section ul {
  text-align: left;
  max-width: 480px;
  margin: 0 auto;
  padding-left: 20px;
}

.main-section ul li {
  margin-bottom: 12px;
  line-height: 1.5em;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
}

.modal-content {
    background-color: var(--grit-white);
    margin: 10% auto;
    padding: 32px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: 2px solid var(--grit-blue);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced responsive design */
@media (max-width: 768px) {
    /* Header optimizations for tablet */
    header {
        padding: 4px 0 4px 0;
        min-height: 120px; /* Much smaller header on tablet */
    }
    
    .grit-logo {
        width: 200px;
        height: 160px;
        margin: 0 auto 4px auto;
    }
    
    .grit-logo-img, .grit-logo img {
        width: 180px;
        height: 140px;
    }
    
    nav {
        gap: 1px;
        padding: 0 5px;
        margin-top: 2px;
        flex-wrap: wrap;
    }
    
    nav a {
        font-size: 0.8em;
        padding: 6px 8px;
        gap: 2px;
        margin: 1px;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    h1 {
        font-size: 1.8em;
        margin: 16px 0 12px 0;
    }
    
    h2 {
        font-size: 1.4em;
        margin-bottom: 12px;
    }
    
    h3 {
        font-size: 1.2em;
        margin: 12px 0 8px 0;
    }
}

@media (max-width: 480px) {
    /* Reset and force full width mobile header */
    header {
        padding: 8px 0;
        margin: 0;
        min-height: auto;
        background: var(--grit-blue);
        width: 100vw;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    .grit-logo {
        display: block;
        order: 0;
        margin-bottom: 8px;
    }
    
    .grit-logo-img, .grit-logo img {
        display: block;
        max-width: 120px;
        height: auto;
    }
    
    nav {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 2px;
        padding: 2px 4px;
        margin: 0;
        justify-content: space-around;
        align-items: center;
        min-height: 18px;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        order: 1;
    }
    
    nav a {
        font-size: 0.65em;
        padding: 3px 4px;
        width: auto;
        text-align: center;
        min-width: 22px;
        margin: 0;
        line-height: 1.0;
        white-space: nowrap;
        flex: 1;
        max-width: 16%;
        overflow: hidden;
        text-overflow: ellipsis;
        border-radius: 2px;
        font-weight: 700;
        background: rgba(255,255,255,0.1);
    }
    
    nav a i {
        display: none; /* Hide icons to save space */
    }
    
    /* Use shorter text for mobile navigation */
    nav a[href="index.html"]:after { content: "Home"; }
    nav a[href="dashboard.html"]:after { content: "Dash"; }
    nav a[href="leaderboard.html"]:after { content: "Board"; }
    nav a[href="crews.html"]:after { content: "Crews"; }
    nav a[href="profile.html"]:after { content: "Profile"; }
    nav a[href="setting.html"]:after { content: "Set"; }
    
    nav a[href="index.html"],
    nav a[href="dashboard.html"],
    nav a[href="leaderboard.html"],
    nav a[href="crews.html"],
    nav a[href="profile.html"],
    nav a[href="setting.html"] {
        font-size: 0;
    }
    
    .card {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
        max-width: 350px;
    }
    
    h1 {
        font-size: 1.5em;
        margin: 12px 0 8px 0;
    }
    
    h2 {
        font-size: 1.2em;
        margin-bottom: 8px;
    }
    
    h3 {
        font-size: 1.1em;
        margin: 8px 0 6px 0;
    }
    
    /* Reduce spacing on mobile */
    section {
        margin-bottom: 12px;
    }
}

/* Extra small mobile devices */
@media (max-width: 320px) {
    header {
        padding: 6px 0;
        margin: 0;
        min-height: auto;
        width: 100vw;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    .grit-logo {
        display: block;
        order: 0;
        margin-bottom: 6px;
    }
    
    .grit-logo-img, .grit-logo img {
        display: block;
        max-width: 100px;
        height: auto;
    }
    
    nav {
        order: 1;
        min-height: 16px;
        gap: 1px;
        padding: 2px 2px;
        width: 100%;
    }
    
    nav a {
        font-size: 0.6em;
        padding: 2px 2px;
        min-width: 20px;
        max-width: 16%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 700;
        background: rgba(255,255,255,0.1);
    }
    
    nav a i {
        display: none; /* Hide icons on smallest screens */
    }
    
    h1 {
        font-size: 1.3em;
    }
    
    h2 {
        font-size: 1.1em;
    }
}

/* Statistics Page Enhanced Styles */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-label {
    font-weight: 500;
    color: var(--grit-gray);
    font-size: 0.95em;
}

.metric-value {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--grit-blue);
    display: flex;
    align-items: center;
    gap: 8px;
}

.metric-change {
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.metric-change.positive {
    background: rgba(1, 142, 66, 0.1);
    color: var(--grit-green);
}

.metric-change.negative {
    background: rgba(191, 26, 47, 0.1);
    color: var(--grit-red);
}

.readiness-indicator {
    text-align: center;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-weight: 600;
    font-size: 1.1em;
}

.readiness-excellent {
    background: linear-gradient(135deg, rgba(1, 142, 66, 0.1), rgba(1, 142, 66, 0.05));
    color: var(--grit-green);
    border: 2px solid rgba(1, 142, 66, 0.2);
}

.readiness-good {
    background: linear-gradient(135deg, rgba(247, 208, 2, 0.1), rgba(247, 208, 2, 0.05));
    color: #DAA520;
    border: 2px solid rgba(247, 208, 2, 0.2);
}

.readiness-poor {
    background: linear-gradient(135deg, rgba(191, 26, 47, 0.1), rgba(191, 26, 47, 0.05));
    color: var(--grit-red);
    border: 2px solid rgba(191, 26, 47, 0.2);
}

.periodBtn {
    min-width: 120px;
    transition: all 0.3s ease;
}

.periodBtn.active {
    background: var(--grit-blue);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(77, 126, 168, 0.3);
}

/* Enhanced Leaderboard Colors - Only for main leaderboards, not profile */
.modern-table .position-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    border-left: 4px solid #FFD700;
}

.modern-table .position-2 {
    background: linear-gradient(90deg, rgba(106, 90, 205, 0.15), rgba(106, 90, 205, 0.05));
    border-left: 4px solid #6A5ACD;
}

.modern-table .position-3 {
    background: linear-gradient(90deg, rgba(255, 127, 80, 0.15), rgba(255, 127, 80, 0.05));
    border-left: 4px solid #FF7F50;
}

/* Profile leaderboard - remove medal colors */
.leaderboard-table tr {
    background: none !important;
    border-left: none !important;
}

.leaderboard-table tr:nth-child(even) {
    background: var(--grit-light-gray) !important;
}

.leaderboard-table tr:nth-child(odd) {
    background: white !important;
}

/* ===============================
   VUELTA GRIT CHALLENGE STYLES
   =============================== */

/* Vuelta Stage Card */
.vuelta-stage-card {
    background: linear-gradient(135deg, rgba(191, 26, 47, 0.03), rgba(247, 208, 2, 0.03));
    border: 2px solid rgba(191, 26, 47, 0.2);
    position: relative;
    overflow: hidden;
}

.vuelta-stage-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--grit-red), var(--grit-gold));
}

.limited-time-badge {
    background: linear-gradient(135deg, var(--grit-red), #ff4757);
    color: white;
    font-size: 0.7em;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Vuelta Official Link Styling */
.vuelta-official-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 15px;
    background: linear-gradient(135deg, #ff6b35, #d32f2f);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.vuelta-official-link:hover {
    background: linear-gradient(135deg, #e55a30, #b71c1c);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
    text-decoration: none;
    color: white;
}

.vuelta-official-link i {
    margin-right: 5px;
}

.challenge-links {
    text-align: center;
    margin-top: 15px;
}

/* Position separator for leaderboard tables */
.separator-row {
    background: transparent !important;
}

.position-separator {
    text-align: center;
    color: var(--grit-gold);
    font-weight: 600;
    font-size: 0.9em;
    padding: 10px 0;
    border-top: 2px solid var(--grit-light-gray);
    border-bottom: 2px solid var(--grit-light-gray);
    background: rgba(255, 215, 0, 0.1);
}

/* Challenge Status Card */
.challenge-status-card {
    background: linear-gradient(135deg, rgba(52, 168, 83, 0.1), rgba(52, 168, 83, 0.05));
    border: 2px solid rgba(52, 168, 83, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 15px;
}

.status-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.status-header i {
    font-size: 1.2em;
}

.challenge-actions {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.challenge-actions .btn {
    flex: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 15px 0;
    flex-wrap: wrap;
    gap: 10px;
}

.stage-header h3 {
    margin: 0;
    color: var(--grit-dark-gray);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stage-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--grit-blue);
    color: var(--grit-blue);
    padding: 8px 16px;
    border-radius: var(--border-radius-small);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-outline:hover {
    background: var(--grit-blue);
    color: white;
    transform: translateY(-1px);
}

.btn-outline.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Stage Content */
.stage-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 15px 0;
    box-shadow: var(--shadow-light);
}

.stage-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stage-stat {
    text-align: center;
    padding: 15px;
    background: var(--grit-light-gray);
    border-radius: var(--border-radius-small);
}

.stage-stat-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--grit-blue);
    display: block;
}

.stage-stat-label {
    font-size: 0.9em;
    color: var(--grit-gray);
    margin-top: 5px;
}

.stage-description {
    background: rgba(77, 126, 168, 0.05);
    border-left: 4px solid var(--grit-blue);
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0;
}

.stage-challenge {
    background: rgba(191, 26, 47, 0.05);
    border: 1px solid rgba(191, 26, 47, 0.2);
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.stage-challenge h4 {
    color: var(--grit-red);
    margin-bottom: 10px;
}

.stage-progress {
    margin: 20px 0;
}

.progress-container {
    background: #e9ecef;
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-bar-vuelta {
    height: 100%;
    background: linear-gradient(90deg, var(--grit-red), var(--grit-gold));
    border-radius: 20px;
    transition: width 0.8s ease;
}

/* Mobile Responsiveness for Vuelta */
@media (max-width: 768px) {
    .stage-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stage-links {
        width: 100%;
        justify-content: center;
    }
    
    .stage-info {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .btn-outline {
        flex: 1;
        justify-content: center;
    }
    
    /* Dashboard mobile optimizations */
    .vuelta-stage-card {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .limited-time-badge {
        font-size: 0.6em;
        padding: 3px 6px;
    }
    
    /* Compact form elements */
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group label {
        font-size: 0.9em;
        margin-bottom: 4px;
    }
    
    input, select, textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 8px 12px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    /* Ultra-compact mobile dashboard */
    .vuelta-stage-card {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .limited-time-badge {
        font-size: 0.55em;
        padding: 2px 4px;
    }
    
    .stage-info {
        gap: 8px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 0.8em;
    }
    
    .form-group {
        margin-bottom: 8px;
    }
    
    input, select, textarea {
        padding: 6px 10px;
        font-size: 16px;
    }
    
    /* Reduce text sizes for better fit */
    .stage-card h4 {
        font-size: 1.1em;
    }
    
    .stage-card p {
        font-size: 0.85em;
        line-height: 1.3;
    }
}

/* ===============================
   VUELTA CHALLENGE STYLES (DASHBOARD)
   =============================== */

/* Vuelta Stage Card */
.vuelta-stage-card {
    border: 2px solid var(--grit-gold);
    background: linear-gradient(135deg, rgba(247, 208, 2, 0.05), rgba(191, 26, 47, 0.05));
    position: relative;
    overflow: hidden;
}

.vuelta-stage-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--grit-red), var(--grit-gold), var(--grit-red));
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.limited-time-badge {
    background: linear-gradient(135deg, var(--grit-red), #e91e63);
    color: white;
    font-size: 0.7em;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
    box-shadow: 0 2px 8px rgba(191, 26, 47, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.stage-header h3 {
    margin: 0;
    color: var(--grit-dark-gray);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stage-links {
    display: flex;
    gap: 8px;
}

.btn-sm {
    font-size: 0.8em;
    padding: 6px 12px;
}

/* Stage content area */
#stageContent {
    min-height: 120px;
    background: white;
    border-radius: var(--border-radius-small);
    padding: 15px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Today's Stage Display */
.todays-stage {
    text-align: left;
}

.stage-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.stage-number {
    background: linear-gradient(135deg, var(--grit-red), var(--grit-gold));
    color: white;
    font-weight: 700;
    font-size: 1.2em;
    padding: 12px 16px;
    border-radius: 50%;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(191, 26, 47, 0.3);
}

.stage-details h4 {
    margin: 0 0 8px 0;
    color: var(--grit-dark-gray);
    font-weight: 600;
}

.stage-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stage-type {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.stage-type.flat { background: #28a745; color: white; }
.stage-type.hilly { background: #ffc107; color: black; }
.stage-type.mountain { background: #dc3545; color: white; }
.stage-type.time.trial { background: #6f42c1; color: white; }

.stage-distance, .stage-elevation {
    font-size: 0.9em;
    color: var(--grit-gray);
    font-weight: 500;
}

.stage-progress {
    margin: 20px 0;
}

.progress-section {
    margin: 15px 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: var(--grit-dark-gray);
    font-weight: 500;
}

.stage-complete {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 15px;
    border-radius: var(--border-radius-small);
    text-align: center;
    font-weight: 600;
    margin-top: 15px;
}

.stage-complete i {
    font-size: 1.2em;
    margin-right: 8px;
}

.stage-motivation {
    background: var(--grit-light-gray);
    padding: 15px;
    border-radius: var(--border-radius-small);
    margin-top: 15px;
    text-align: center;
}

.stage-motivation p {
    margin: 5px 0;
    color: var(--grit-dark-gray);
}

.countdown-content, .completion-content {
    text-align: center;
    padding: 20px;
}

.countdown-content h4, .completion-content h4 {
    color: var(--grit-dark-gray);
    margin: 15px 0 10px 0;
}

.countdown-text {
    font-size: 1.1em;
    color: var(--grit-blue);
    margin: 10px 0;
}

.countdown-subtitle {
    color: var(--grit-gray);
    font-style: italic;
}

/* First Stage Preview */
.first-stage-preview {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(77,126,168,0.05), rgba(77,126,168,0.1));
    border-radius: 12px;
    border: 1px solid rgba(77,126,168,0.2);
}

.first-stage-preview h4 {
    color: var(--grit-blue);
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-card {
    background: white;
    border: 2px solid rgba(77,126,168,0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.preview-text {
    text-align: center;
    color: var(--grit-gray);
    font-style: italic;
    margin: 15px 0 0 0;
}

.stage-date {
    color: var(--grit-blue);
    font-weight: 500;
    margin: 10px 0 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Mobile responsiveness for Vuelta section */
@media (max-width: 768px) {
    .stage-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .stage-links {
        width: 100%;
        justify-content: center;
    }
    
    .limited-time-badge {
        display: block;
        text-align: center;
        margin: 5px 0;
    }
}

/* ===============================
   CREWS PAGE STYLES
   =============================== */

/* Crew Cards Grid */
.crews-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.crew-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.1);
}

.crew-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.crew-card.current-crew {
    border: 2px solid var(--grit-blue);
    background: linear-gradient(135deg, rgba(77, 126, 168, 0.05), rgba(77, 126, 168, 0.02));
}

.crew-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.crew-card-header h4 {
    margin: 0;
    color: var(--grit-dark-gray);
    font-weight: 600;
    flex: 1;
    text-align: left;
}

.crew-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.75em;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

.badge.general { background: #6c757d; color: white; }
.badge.running { background: var(--grit-red); color: white; }
.badge.cycling { background: var(--grit-blue); color: white; }
.badge.swimming { background: #17a2b8; color: white; }
.badge.triathlon { background: var(--grit-green); color: white; }
.badge.strength { background: #fd7e14; color: white; }
.badge.open { background: var(--grit-green); color: white; }
.badge.invite { background: var(--grit-gold); color: var(--grit-black); }
.badge.admin { 
    background: linear-gradient(135deg, var(--grit-red), #a01626); 
    color: white; 
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(191, 26, 47, 0.4);
    padding: 4px 12px;
    font-size: 0.85em;
}

.crew-card-description {
    color: var(--grit-gray);
    margin: 10px 0;
    font-size: 0.9em;
    text-align: left;
    line-height: 1.4;
}

.crew-card-stats {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    padding: 10px;
    background: var(--grit-light-gray);
    border-radius: var(--border-radius-small);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    color: var(--grit-gray);
}

.stat-item i {
    color: var(--grit-blue);
}

.crew-card-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 15px;
}

.current-crew-badge, .member-badge {
    font-size: 0.8em;
    font-weight: 600;
    color: var(--grit-blue);
    padding: 6px 12px;
    background: rgba(77, 126, 168, 0.1);
    border-radius: 20px;
    border: 1px solid var(--grit-blue);
}

/* My Crew Details */
.crew-details {
    text-align: left;
}

.crew-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.crew-header h3 {
    margin: 0;
    color: var(--grit-dark-gray);
    font-weight: 600;
}

.crew-description {
    color: var(--grit-gray);
    margin: 10px 0 20px 0;
    font-style: italic;
}

.crew-stats {
    display: flex;
    gap: 30px;
    margin: 20px 0;
    padding: 15px;
    background: var(--grit-light-gray);
    border-radius: var(--border-radius-small);
}

.crew-members {
    margin: 25px 0;
}

.crew-members h4 {
    margin-bottom: 15px;
    color: var(--grit-dark-gray);
    display: flex;
    align-items: center;
    gap: 8px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin: 8px 0;
    background: white;
    border-radius: var(--border-radius-small);
    border: 1px solid rgba(0,0,0,0.1);
    transition: var(--transition);
}

.member-item:hover {
    background: var(--grit-light-gray);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-stats {
    font-size: 0.85em;
    color: var(--grit-gray);
}

.crew-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Crew Trials */
.crew-trials-section {
    margin: 25px 0;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border-left: 4px solid var(--grit-red);
}

.crew-trials-section h4 {
    color: var(--grit-dark-gray);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.trials-empty {
    text-align: center;
    padding: 30px;
    color: var(--grit-gray);
}

.active-trials {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.trial-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 2px solid transparent;
    transition: var(--transition);
}

.trial-card:hover {
    border-color: var(--grit-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.trial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 10px;
}

.trial-header h5 {
    margin: 0;
    color: var(--grit-dark-gray);
    font-weight: 600;
}

.trial-type {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.trial-type.spark {
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
    color: white;
}

.trial-type.surge {
    background: linear-gradient(135deg, #ffa726, #ff9800);
    color: white;
}

.trial-type.storm {
    background: linear-gradient(135deg, #ab47bc, #9c27b0);
    color: white;
}

.trial-type.overload {
    background: linear-gradient(135deg, #5c6bc0, #3f51b5);
    color: white;
}

.trial-vs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: var(--border-radius-small);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.crew-side {
    flex: 1;
    text-align: center;
}

.crew-side strong {
    display: block;
    color: var(--grit-dark-gray);
    font-size: 1.1em;
    margin-bottom: 5px;
}

.crew-score {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--grit-blue);
}

.vs-divider {
    font-size: 1.2em;
    font-weight: 800;
    color: var(--grit-red);
    margin: 0 20px;
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--grit-red), #a01626);
    color: white;
    border-radius: 4px;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trial-stats {
    display: flex;
    justify-content: space-around;
    margin: 15px 0;
    padding: 10px;
    background: rgba(77, 126, 168, 0.1);
    border-radius: var(--border-radius-small);
}

.trial-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.trial-stats .stat-item i {
    color: var(--grit-blue);
    font-size: 1.2em;
}

.trial-participants {
    margin: 15px 0;
}

.trial-participants h6 {
    color: var(--grit-dark-gray);
    margin-bottom: 10px;
    font-weight: 600;
}

.participant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin: 8px 0;
    background: linear-gradient(135deg, var(--grit-white), #f9f9f9);
    border-radius: var(--border-radius-small);
    border-left: 4px solid var(--grit-blue);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid rgba(77,126,168,0.1);
}

.participant-name {
    font-weight: 600;
    color: var(--grit-dark-gray);
    font-size: 1em;
}

.participant-specialist {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.participant-specialist.cyclist {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: white;
}

.participant-specialist.runner {
    background: linear-gradient(135deg, #ff9800, #e65100);
    color: white;
}

.participant-specialist.swimmer {
    background: linear-gradient(135deg, #2196f3, #0d47a1);
    color: white;
}

.participant-specialist.climber {
    background: linear-gradient(135deg, #795548, #3e2723);
    color: white;
}

.participant-specialist.warrior {
    background: linear-gradient(135deg, #f44336, #b71c1c);
    color: white;
}

.participant-specialist.endurance {
    background: linear-gradient(135deg, #9c27b0, #4a148c);
    color: white;
}

.participant-specialist.none {
    background: #e0e0e0;
    color: var(--grit-gray);
}

.trial-admin-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.trial-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    margin-top: 20px;
    box-shadow: var(--shadow-light);
}

/* Trial Scoring Display */
.trial-scoring-details {
    background: linear-gradient(135deg, #f0f8ff, #e6f3ff);
    border: 2px solid var(--grit-blue);
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 15px 0;
}

.trial-scoring-details h6 {
    color: var(--grit-blue);
    margin-bottom: 15px;
    font-weight: 700;
}

.scoring-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.scoring-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-light);
}

.stat-label {
    font-weight: 600;
    color: var(--grit-dark-gray);
}

.stat-value {
    font-weight: 700;
    color: var(--grit-blue);
}

.stat-value.trial-score {
    color: var(--grit-orange);
    font-size: 1.1em;
    background: linear-gradient(135deg, var(--grit-orange), #e55100);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-value.participation-bonus {
    color: var(--grit-green);
}

.scoring-note {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: var(--border-radius-small);
    padding: 10px;
    margin-top: 10px;
}

.scoring-note small {
    color: #856404;
    font-weight: 500;
}

.scoring-note i {
    color: var(--grit-gold);
    margin-right: 5px;
}

/* Archetype Bonus Display */
.archetype-breakdown {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #ffeeba;
    border-radius: var(--border-radius-small);
    padding: 15px;
    margin-top: 15px;
}

.archetype-breakdown h6 {
    color: #856404;
    margin-bottom: 10px;
}

.archetype-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.archetype-badge {
    background: var(--grit-orange);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
}

/* Crew Tabs */
.crew-tabs {
    display: flex;
    margin: 20px 0 0 0;
    border-bottom: 2px solid #e9ecef;
}

.crew-tab {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    color: var(--grit-gray);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.crew-tab:hover {
    color: var(--grit-blue);
    background: rgba(77, 126, 168, 0.1);
}

.crew-tab.active {
    color: var(--grit-blue);
    border-bottom-color: var(--grit-blue);
    background: rgba(77, 126, 168, 0.1);
}

.crew-tabs-section {
    margin-top: 20px;
}

.crew-tab-content {
    display: none;
    padding: 20px;
}

.crew-tab-content.active {
    display: block;
}

/* Trials Section */
.trials-section {
    padding: 20px 0;
}

.trials-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: var(--border-radius);
}

.trials-icon {
    font-size: 3rem;
    color: var(--grit-blue);
    margin-right: 20px;
}

.trials-title h3 {
    margin: 0 0 10px 0;
    color: var(--grit-blue);
    font-size: 1.5rem;
}

.trials-title p {
    margin: 0;
    color: var(--grit-gray);
    font-size: 1.1rem;
    line-height: 1.4;
}

.trials-info {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    color: var(--grit-gray);
}

.trial-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.trial-type-card {
    padding: 25px;
    border-radius: var(--border-radius);
    color: white;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.trial-type-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.1);
    opacity: 0;
    transition: var(--transition);
}

.trial-type-card:hover::before {
    opacity: 1;
}

.trial-type-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.trial-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.trial-type-card h5 {
    margin: 0 0 10px 0;
    font-size: 1.3em;
    font-weight: 700;
}

.trial-type-card p {
    margin: 0 0 15px 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.trial-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    font-size: 0.9rem;
}

.trial-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0.8;
}

.trial-type-card.spark {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
}

.trial-type-card.surge {
    background: linear-gradient(135deg, #00bfff, #1e90ff);
}

.trial-type-card.storm {
    background: linear-gradient(135deg, #9932cc, #8b00ff);
}

.trial-type-card.overload {
    background: linear-gradient(135deg, #ff4500, #dc143c);
}

.trial-type-card.selected {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
    border: 3px solid #fff;
}

.trial-type-card {
    cursor: pointer;
    user-select: none;
}

.trials-actions {
    margin: 20px 0;
    text-align: center;
}

.trials-actions .btn {
    margin: 0 10px;
}

/* Trial Cards */
.current-trials {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid #e9ecef;
}

.current-trials h5 {
    margin: 0 0 15px 0;
    color: var(--grit-blue);
    display: flex;
    align-items: center;
    gap: 10px;
}

.trials-list {
    display: grid;
    gap: 15px;
}

.trial-card {
    padding: 20px;
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
    transition: var(--transition);
}

.trial-card.spark {
    border-left-color: #ffd700;
}

.trial-card.surge {
    border-left-color: #00bfff;
}

.trial-card.storm {
    border-left-color: #9932cc;
}

.trial-card.overload {
    border-left-color: #ff4500;
}

.trial-card.expired {
    opacity: 0.7;
    background: #f8f9fa;
}

.trial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.trial-header h6 {
    margin: 0;
    color: var(--grit-blue);
    font-size: 1.1em;
}

.trial-type-badge {
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
    font-size: 0.8em;
    font-weight: bold;
}

.trial-type-badge.spark {
    background: #ffd700;
    color: #333;
}

.trial-type-badge.surge {
    background: #00bfff;
}

.trial-type-badge.storm {
    background: #9932cc;
}

.trial-type-badge.overload {
    background: #ff4500;
}

.trial-info {
    margin-bottom: 15px;
}

.trial-info p {
    margin: 5px 0;
    color: var(--grit-gray);
}

.trial-actions {
    display: flex;
    gap: 10px;
}

.no-trials {
    text-align: center;
    padding: 30px;
    color: var(--grit-gray);
}

/* Create Trial Modal */
.trial-config-info {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
}

.trial-config-info h4 {
    margin: 0 0 15px 0;
    color: var(--grit-blue);
}

.config-grid {
    display: grid;
    gap: 10px;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--grit-gray);
}

.config-item i {
    color: var(--grit-blue);
    width: 20px;
}

/* Join Trial Modal */
.modal-content.large {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.available-trials-list {
    max-height: 400px;
    overflow-y: auto;
}

.trial-join-card {
    padding: 20px;
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
    margin-bottom: 15px;
    transition: var(--transition);
}

.trial-join-card:hover {
    border-color: var(--grit-blue);
    transform: translateY(-2px);
}

.trial-join-card.spark {
    border-left-color: #ffd700;
    border-left-width: 5px;
}

.trial-join-card.surge {
    border-left-color: #00bfff;
    border-left-width: 5px;
}

.trial-join-card.storm {
    border-left-color: #9932cc;
    border-left-width: 5px;
}

.trial-join-card.overload {
    border-left-color: #ff4500;
    border-left-width: 5px;
}

.trial-join-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.trial-join-header h5 {
    margin: 0;
    color: var(--grit-blue);
}

.trial-join-info p {
    margin: 8px 0;
    color: var(--grit-gray);
}

.trial-join-actions {
    margin-top: 15px;
    text-align: right;
}

.no-trials-available {
    text-align: center;
    padding: 40px;
    color: var(--grit-gray);
}

.available-trials {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid #e9ecef;
}

.available-trials h5 {
    margin: 0 0 15px 0;
    color: var(--grit-blue);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Crew Leaderboard Styling */
.crew-info {
    display: flex;
    flex-direction: column;
}

.crew-name {
    font-weight: 600;
    color: var(--grit-blue);
}

.focus-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: capitalize;
}

.focus-badge.general {
    background: #e3f2fd;
    color: #1976d2;
}

.focus-badge.running {
    background: #ffebee;
    color: #d32f2f;
}

.focus-badge.cycling {
    background: #f3e5f5;
    color: #7b1fa2;
}

.focus-badge.swimming {
    background: #e0f2f1;
    color: #00796b;
}

.focus-badge.triathlon {
    background: #fff3e0;
    color: #f57c00;
}

.focus-badge.strength {
    background: #fce4ec;
    color: #c2185b;
}

.members-cell {
    text-align: center;
}

.member-count {
    color: var(--grit-gray);
    font-size: 0.9em;
}

/* Crew Leaderboard */
.crew-leaderboard-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 20px 0;
}

.leaderboard-period-tabs {
    display: flex;
    gap: 10px;
    margin: 15px 0 20px 0;
    justify-content: center;
}

.period-tab {
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    color: var(--grit-gray);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.period-tab:hover {
    background: var(--grit-blue);
    color: white;
    border-color: var(--grit-blue);
}

.period-tab.active {
    background: var(--grit-blue);
    color: white;
    border-color: var(--grit-blue);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--border-radius-small);
    transition: var(--transition);
}

.leaderboard-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.leaderboard-item.gold {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: var(--grit-black);
}

.leaderboard-item.silver {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: var(--grit-black);
}

.leaderboard-item.bronze {
    background: linear-gradient(135deg, #cd7f32, #daa055);
    color: var(--grit-black);
}

.leaderboard-item .rank {
    font-size: 1.2em;
    font-weight: 700;
    margin-right: 15px;
    min-width: 40px;
    text-align: center;
}

.leaderboard-item .user-info {
    flex: 1;
}

.leaderboard-item .username {
    font-weight: 600;
    color: var(--grit-dark-gray);
}

.admin-badge {
    background: linear-gradient(135deg, var(--grit-red), #a01626);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 8px;
    display: inline-block;
}

.leaderboard-item .grit-score {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--grit-blue);
}

.crew-total {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, var(--grit-blue), var(--grit-green));
    color: white;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.crew-total .total-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
}

.crew-total .total-score {
    font-size: 1.3em;
    font-weight: 700;
}

/* Filter Section */
.filter-section {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(0,0,0,0.1);
}

/* Vuelta Challenge Styles */
.vuelta-progress {
    margin: 20px 0;
}

.progress-section {
    margin: 20px 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-header h4 {
    margin: 0;
    color: var(--grit-dark-gray);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-text {
    font-weight: 600;
    color: var(--grit-blue);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e9ecef;
    border-radius: 20px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--grit-blue), var(--grit-green));
    border-radius: 20px;
    transition: width 0.5s ease;
}

.progress-remaining {
    font-size: 0.85em;
    color: var(--grit-gray);
    margin: 5px 0 0 0;
    text-align: left;
}

.completion-badge {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--grit-gold), #ffed4e);
    color: var(--grit-black);
    border-radius: var(--border-radius);
    font-size: 1.2em;
    font-weight: 600;
    margin: 20px 0;
}

.completion-badge i {
    font-size: 1.5em;
    margin-right: 10px;
    color: var(--grit-red);
}

/* Vuelta Leaderboard */
.vuelta-leaderboard {
    margin: 30px 0;
}

.vuelta-leaderboard h4 {
    color: var(--grit-dark-gray);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.leaderboard-list {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    transition: var(--transition);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item:hover {
    background: var(--grit-light-gray);
}

.leaderboard-item.current-user {
    background: rgba(77, 126, 168, 0.1);
    border-left: 4px solid var(--grit-blue);
}

.leaderboard-item.rank-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    border-left: 4px solid #FFD700;
}

.leaderboard-item.rank-2 {
    background: linear-gradient(90deg, rgba(106, 90, 205, 0.15), rgba(106, 90, 205, 0.05));
    border-left: 4px solid #6A5ACD;
}

.leaderboard-item.rank-3 {
    background: linear-gradient(90deg, rgba(255, 127, 80, 0.15), rgba(255, 127, 80, 0.05));
    border-left: 4px solid #FF7F50;
}

.leaderboard-item .rank {
    font-weight: 700;
    font-size: 1.2em;
    color: var(--grit-blue);
    width: 40px;
    text-align: center;
}

.participant-info {
    flex: 1;
    text-align: left;
    margin-left: 15px;
}

.participant-info strong {
    color: var(--grit-dark-gray);
}

.participant-stats {
    font-size: 0.85em;
    color: var(--grit-gray);
    margin-top: 2px;
}

.completion-percent {
    font-weight: 600;
    color: var(--grit-blue);
    font-size: 1.1em;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--grit-gray);
}

.empty-state i {
    font-size: 3em;
    color: var(--grit-gray);
    margin-bottom: 15px;
    opacity: 0.5;
}

.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--grit-gray);
}

.loading-state i {
    font-size: 2em;
    color: var(--grit-blue);
    margin-bottom: 10px;
}

/* Message Styles */
.message {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .crews-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .crew-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .crew-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .progress-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .crew-actions {
        justify-content: center;
    }
    
    .filter-section .form-row {
        flex-direction: column;
    }
}

/* ==========================================================================
   VUELTA LEADERBOARD STYLES
   ========================================================================== */

/* Challenge Section */
.challenge-section {
    margin: 30px 0;
    padding: 25px;
    background: linear-gradient(135deg, #ff6b35 0%, #ff8e53 50%, #ffa726 100%);
    border-radius: var(--border-radius);
    color: white;
    position: relative;
    overflow: hidden;
}

.challenge-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="vuelta-pattern" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23vuelta-pattern)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

.challenge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.challenge-header h4 {
    margin: 0;
    font-size: 1.4em;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.challenge-badge.limited-time {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
    animation: vuelta-pulse 2s ease-in-out infinite;
}

.challenge-description {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 20px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

.vuelta-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.vuelta-dates, .vuelta-rewards {
    background: rgba(255,255,255,0.15);
    padding: 12px 15px;
    border-radius: var(--border-radius-small);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 0.95em;
}

/* Vuelta Leaderboard Specific Styles */
.vuelta-leaderboard-container {
    background: var(--grit-white);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 20px;
    box-shadow: var(--shadow-medium);
    position: relative;
    z-index: 1;
}

.vuelta-leaderboard-header {
    text-align: center;
    margin-bottom: 20px;
}

.vuelta-leaderboard-header h5 {
    color: var(--grit-red);
    margin: 0 0 10px 0;
    font-size: 1.3em;
    font-weight: bold;
}

.vuelta-stats {
    color: var(--grit-gray);
    font-size: 0.9em;
}

.participant-count {
    background: var(--grit-light-gray);
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 500;
}

.vuelta-table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius-small);
    margin-top: 15px;
}

.vuelta-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.vuelta-table thead th {
    background: linear-gradient(135deg, var(--grit-red) 0%, #d41c3a 100%);
    color: white;
    padding: 12px 8px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.5px;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.vuelta-table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.vuelta-table tbody tr:hover {
    background: linear-gradient(90deg, #ffeaa7 0%, #fab1a0 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.vuelta-table tbody tr.top-three {
    background: linear-gradient(90deg, #fff8e1 0%, #ffecb3 100%);
    font-weight: 500;
}

.vuelta-table td {
    padding: 12px 8px;
    border: none;
    vertical-align: middle;
    color: var(--grit-dark-gray);
}

.rank-cell {
    text-align: center;
    font-weight: bold;
    min-width: 80px;
}

.rank-badge {
    font-size: 1.2em;
    margin-right: 5px;
    display: inline-block;
}

.rank-number {
    font-size: 1.1em;
    color: var(--grit-red);
}

.rider-cell {
    min-width: 200px;
}

.rider-info strong {
    display: block;
    margin-bottom: 5px;
    color: var(--grit-black);
    font-size: 1.05em;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--grit-red) 0%, #ff6b35 100%);
    border-radius: 3px;
    transition: width 0.8s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: vuelta-shimmer 2s ease-in-out infinite;
}

.location-cell {
    color: var(--grit-gray);
    font-size: 0.9em;
    min-width: 150px;
}

.stages-cell {
    text-align: center;
    font-weight: bold;
    color: var(--grit-red);
    min-width: 80px;
}

.distance-cell {
    text-align: center;
    font-weight: 500;
    color: var(--grit-blue);
    min-width: 100px;
}

.current-stage-cell {
    text-align: center;
    font-weight: 500;
    color: var(--grit-green);
    min-width: 100px;
}

.no-data-message, .error-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--grit-gray);
    font-size: 1.1em;
    line-height: 1.6;
}

.error-message {
    color: var(--grit-red);
}

/* Vuelta Animations */
@keyframes vuelta-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255,255,255,0.4);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255,255,255,0);
    }
}

@keyframes vuelta-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Mobile Responsiveness for Vuelta Leaderboard */
@media (max-width: 768px) {
    .challenge-header {
        text-align: center;
    }
    
    .challenge-header h4 {
        font-size: 1.2em;
    }
    
    .vuelta-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .vuelta-dates, .vuelta-rewards {
        padding: 10px 12px;
        font-size: 0.9em;
    }
    
    .vuelta-table {
        font-size: 0.85em;
    }
    
    .vuelta-table th,
    .vuelta-table td {
        padding: 8px 4px;
    }
    
    .rider-cell {
        min-width: 140px;
    }
    
    .location-cell {
        min-width: 120px;
        font-size: 0.8em;
    }
    
    .rank-cell,
    .stages-cell,
    .distance-cell,
    .current-stage-cell {
        min-width: 60px;
    }
}

/* ==========================================================================
   VUELTA STATISTICS STYLES
   ========================================================================== */

/* Vuelta Stats Grid */
.vuelta-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.vuelta-stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 50%, #ffe082 100%);
    border-radius: var(--border-radius-small);
    border-left: 4px solid var(--grit-red);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.vuelta-stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.vuelta-stat-item:hover::before {
    transform: translateX(100%);
}

.vuelta-stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,107,53,0.2);
}

.vuelta-stat-icon {
    font-size: 1.8em;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--grit-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

.vuelta-stat-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.vuelta-stat-label {
    display: block;
    font-size: 0.85em;
    color: var(--grit-gray);
    font-weight: 500;
    margin-bottom: 2px;
}

.vuelta-stat-value {
    display: block;
    font-size: 1.3em;
    font-weight: bold;
    color: var(--grit-red);
}

/* Vuelta Progress Section */
.vuelta-progress-section {
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius-small);
    border: 1px solid #dee2e6;
}

.vuelta-overall-progress {
    margin-top: 15px;
}

.progress-bar-vuelta {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill-vuelta {
    height: 100%;
    background: linear-gradient(90deg, var(--grit-red) 0%, #ff6b35 50%, #ffa726 100%);
    border-radius: 6px;
    transition: width 1s ease-out;
    position: relative;
}

.progress-fill-vuelta::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
    animation: vuelta-shimmer 2s ease-in-out infinite;
}

.progress-text {
    text-align: center;
    margin-top: 8px;
    font-size: 0.9em;
    color: var(--grit-gray);
    font-weight: 500;
}

/* Stage Breakdown */
.vuelta-stages-grid {
    display: grid;
    gap: 10px;
    margin-top: 15px;
}

.vuelta-stage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: var(--grit-white);
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius-small);
    transition: all 0.2s ease;
    position: relative;
}

.vuelta-stage-item:hover {
    background: linear-gradient(90deg, #fff8e1 0%, #ffecb3 100%);
    border-color: var(--grit-red);
    transform: translateX(5px);
}

.stage-number {
    background: var(--grit-red);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.85em;
    min-width: 70px;
    text-align: center;
}

.stage-details {
    flex: 1;
}

.stage-name {
    font-weight: 600;
    color: var(--grit-black);
    margin-bottom: 3px;
    font-size: 0.95em;
}

.stage-stats {
    display: flex;
    gap: 15px;
    font-size: 0.8em;
    color: var(--grit-gray);
}

.stage-distance {
    font-weight: 500;
}

.stage-completed {
    color: var(--grit-green);
    font-size: 1.2em;
}

/* Achievements */
.vuelta-achievements-grid {
    display: grid;
    gap: 8px;
    margin-top: 15px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: var(--grit-white);
    border-radius: var(--border-radius-small);
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.achievement-item:hover {
    background: #f8f9fa;
    transform: translateX(3px);
}

.achievement-icon {
    font-size: 1.3em;
    min-width: 30px;
    text-align: center;
}

.achievement-text {
    font-weight: 500;
    color: var(--grit-black);
    font-size: 0.95em;
}

/* No data states */
.no-stages-completed,
.no-achievements {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: var(--border-radius-small);
    border: 2px dashed #dee2e6;
}

/* Mobile Responsiveness for Vuelta Stats */
@media (max-width: 768px) {
    .vuelta-stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .vuelta-stat-item {
        padding: 12px;
        gap: 10px;
    }
    
    .vuelta-stat-icon {
        font-size: 1.5em;
        width: 35px;
        height: 35px;
    }
    
    .vuelta-stat-value {
        font-size: 1.1em;
    }
    
    .vuelta-stage-item {
        padding: 10px 12px;
        gap: 8px;
    }
    
    .stage-number {
        padding: 4px 8px;
        min-width: 60px;
        font-size: 0.8em;
    }
    
    .stage-name {
        font-size: 0.9em;
    }
    
    .stage-stats {
        gap: 10px;
        font-size: 0.75em;
    }
    
    .achievement-item {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .achievement-icon {
        font-size: 1.1em;
        min-width: 25px;
    }
    
    .achievement-text {
        font-size: 0.9em;
    }
}

/* Vuelta Three-Category Leaderboards */
.vuelta-challenge-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, var(--grit-red), var(--grit-gold));
    border-radius: var(--border-radius);
    color: white;
    box-shadow: var(--shadow-light);
}

.vuelta-challenge-header h3 {
    margin: 0 0 8px 0;
    font-size: 1.4em;
    font-weight: 700;
}

.stage-info {
    margin: 0;
    font-size: 0.95em;
    opacity: 0.95;
    font-weight: 500;
}

.vuelta-leaderboards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.vuelta-leaderboard-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-light);
    border: 1px solid #e9ecef;
}

.vuelta-leaderboard-section h4 {
    margin: 0 0 15px 0;
    color: var(--grit-dark-gray);
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vuelta-leaderboard-section h4 i {
    color: var(--grit-red);
}

.mini-leaderboard {
    background: #f8f9fa;
    border-radius: var(--border-radius-small);
    padding: 10px;
}

.mini-leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-leaderboard-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: var(--border-radius-small);
    border: 1px solid #e9ecef;
    transition: var(--transition);
    gap: 12px;
}

.mini-leaderboard-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

.mini-leaderboard-item.current-user {
    border: 2px solid var(--grit-blue);
    background: linear-gradient(135deg, #f8f9ff, white);
    font-weight: 600;
}

.mini-leaderboard-item .rank {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--grit-red);
    min-width: 30px;
    text-align: center;
}

.mini-leaderboard-item .user-info {
    flex: 1;
    text-align: left;
}

.mini-leaderboard-item .user-info .name {
    font-weight: 600;
    color: var(--grit-dark-gray);
    font-size: 0.95em;
}

.mini-leaderboard-item .user-info .location {
    font-size: 0.8em;
    color: var(--grit-gray);
    margin-top: 2px;
}

.mini-leaderboard-item .score {
    font-weight: 700;
    color: var(--grit-blue);
    font-size: 1em;
    text-align: right;
}

.separator {
    display: flex;
    align-items: center;
    margin: 15px 0 10px 0;
    gap: 10px;
    color: var(--grit-gray);
    font-size: 0.85em;
    font-weight: 500;
}

.separator-line {
    flex: 1;
    height: 1px;
    background: #dee2e6;
}

.rank-badge {
    font-size: 1.2em;
    margin-left: 5px;
}

.rank-badge.gold { color: #ffd700; }
.rank-badge.silver { color: #c0c0c0; }
.rank-badge.bronze { color: #cd7f32; }

/* Mobile Responsiveness for Vuelta Leaderboards */
@media (max-width: 768px) {
    .vuelta-leaderboards-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .vuelta-leaderboard-section {
        padding: 15px;
    }
    
    .vuelta-challenge-header {
        padding: 12px;
    }
    
    .vuelta-challenge-header h3 {
        font-size: 1.2em;
    }
    
    .stage-info {
        font-size: 0.85em;
    }
    
    .mini-leaderboard-item {
        padding: 10px;
        gap: 10px;
    }
    
    .mini-leaderboard-item .rank {
        min-width: 25px;
        font-size: 1em;
    }
    
    .mini-leaderboard-item .user-info .name {
        font-size: 0.9em;
    }
    
    .mini-leaderboard-item .user-info .location {
        font-size: 0.75em;
    }
    
    .mini-leaderboard-item .score {
        font-size: 0.9em;
    }
}

/* Modern Leaderboard Design (All Categories) */
.period-leaderboard-section {
    margin-bottom: 30px;
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-light);
    border: 1px solid #e9ecef;
}

.period-leaderboard-section h3 {
    margin: 0 0 20px 0;
    color: var(--grit-dark-gray);
    font-size: 1.3em;
    font-weight: 700;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--grit-red);
}

.modern-leaderboard {
    background: #f8f9fa;
    border-radius: var(--border-radius-small);
    padding: 15px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: var(--border-radius-small);
    border: 1px solid #e9ecef;
    margin-bottom: 10px;
    transition: var(--transition);
    gap: 15px;
}

.leaderboard-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.leaderboard-item:last-child {
    margin-bottom: 0;
}

.leaderboard-item.current-user {
    border: 2px solid var(--grit-blue);
    background: linear-gradient(135deg, #f8f9ff, white);
    font-weight: 600;
    box-shadow: var(--shadow-light);
}

.leaderboard-item .rank {
    font-weight: 700;
    font-size: 1.2em;
    color: var(--grit-red);
    min-width: 40px;
    text-align: center;
    background: linear-gradient(135deg, var(--grit-red), #d01e36);
    color: white;
    border-radius: 4px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
}

.leaderboard-item .user-info {
    flex: 1;
    text-align: left;
}

.leaderboard-item .user-info .name {
    font-weight: 600;
    color: var(--grit-dark-gray);
    font-size: 1em;
    margin-bottom: 3px;
}

.leaderboard-item .user-info .name a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

.leaderboard-item .user-info .name a:hover {
    color: var(--grit-blue);
}

.leaderboard-item .user-info .location {
    font-size: 0.85em;
    color: var(--grit-gray);
}

.leaderboard-item .score {
    font-weight: 700;
    color: var(--grit-blue);
    font-size: 1.1em;
    text-align: right;
    background: linear-gradient(135deg, var(--grit-blue), #3a6b94);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Mobile Responsiveness for Modern Leaderboards */
@media (max-width: 768px) {
    .period-leaderboard-section {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .period-leaderboard-section h3 {
        font-size: 1.1em;
        margin-bottom: 15px;
    }
    
    .modern-leaderboard {
        padding: 10px;
    }
    
    .leaderboard-item {
        padding: 12px;
        gap: 12px;
    }
    
    .leaderboard-item .rank {
        width: 30px;
        height: 30px;
        font-size: 0.8em;
        min-width: 30px;
    }
    
    .leaderboard-item .user-info .name {
        font-size: 0.9em;
    }
    
    .leaderboard-item .user-info .location {
        font-size: 0.75em;
    }
    
    .leaderboard-item .score {
        font-size: 1em;
    }
}

/* Custom Scrollbar Styles - Blue Theme */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--grit-light-gray);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--grit-blue), #3a6b94);
    border-radius: 6px;
    border: 2px solid var(--grit-light-gray);
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #3a6b94, var(--grit-blue));
}

::-webkit-scrollbar-corner {
    background: var(--grit-light-gray);
}

/* Firefox scrollbar styles */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--grit-blue) var(--grit-light-gray);
}

/* Enhanced Manage Participants Modal */
.participants-modal-content {
    width: auto;
    max-width: 800px;
    min-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--grit-white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 2px solid var(--grit-light-gray);
    margin-bottom: 0;
}

.modal-header h3 {
    margin: 0;
    color: var(--grit-black);
    font-size: 1.4em;
    font-weight: 700;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--grit-gray);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: var(--grit-light-gray);
    color: var(--grit-red);
    transform: scale(1.1);
}

.trial-info-section {
    padding: 20px 24px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid var(--grit-light-gray);
}

.trial-name {
    margin: 0 0 8px 0;
    color: var(--grit-blue);
    font-size: 1.3em;
    font-weight: 600;
}

.trial-description {
    margin: 0 0 16px 0;
    color: var(--grit-gray);
    font-size: 1em;
}

.participants-counter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--grit-white);
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.counter-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 1.2em;
}

.count-number {
    font-size: 2em;
    font-weight: 700;
    color: var(--grit-blue);
}

.count-separator {
    font-size: 1.5em;
    color: var(--grit-gray);
    margin: 0 4px;
}

.count-total {
    font-size: 1.8em;
    font-weight: 600;
    color: var(--grit-gray);
}

.count-label {
    color: var(--grit-gray);
    font-weight: 500;
    margin-left: 8px;
}

.counter-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.counter-status.full {
    background: linear-gradient(135deg, var(--grit-green), #28a745);
    color: white;
}

.counter-status.partial {
    background: linear-gradient(135deg, var(--grit-orange), #fd7e14);
    color: white;
}

.counter-status.empty {
    background: linear-gradient(135deg, var(--grit-red), #dc3545);
    color: white;
}

.participants-selection-area {
    padding: 24px;
}

.section-title {
    margin: 0 0 20px 0;
    color: var(--grit-black);
    font-size: 1.1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.participants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.participant-card {
    position: relative;
    background: var(--grit-white);
    border: 2px solid var(--grit-light-gray);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.participant-card:hover {
    border-color: var(--grit-blue);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    cursor: pointer;
}

.participant-card.selected {
    border-color: var(--grit-green);
    background: linear-gradient(135deg, #f8fff8, #e8f5e8);
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.2);
    animation: cardSelected 0.3s ease;
}

@keyframes cardSelected {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.participant-card.unselected {
    animation: cardUnselected 0.2s ease;
}

@keyframes cardUnselected {
    0% { transform: scale(1); }
    50% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

.participant-card.disabled {
    background: #f8f9fa;
    border-color: #dee2e6;
    cursor: not-allowed;
    opacity: 0.6;
}

.card-checkbox {
    position: absolute;
    top: 12px;
    right: 12px;
}

.card-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--grit-gray);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--grit-white);
}

.card-checkbox input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--grit-green);
    border-color: var(--grit-green);
}

.card-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
    content: "✓";
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.card-content {
    padding-right: 40px;
}

.member-identity {
    margin-bottom: 12px;
}

.member-name {
    margin: 0 0 4px 0;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--grit-black);
    display: flex;
    align-items: center;
    gap: 8px;
}

.anchor-icon {
    color: var(--grit-blue);
    font-size: 0.9em;
}

.member-role {
    background: var(--grit-blue);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.member-stats-grid {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

.stat-item i {
    color: var(--grit-orange);
    margin-bottom: 4px;
}

.stat-value {
    font-weight: 700;
    color: var(--grit-black);
    font-size: 1.1em;
}

.stat-label {
    font-size: 0.8em;
    color: var(--grit-gray);
    font-weight: 500;
    margin-top: 2px;
}

.specialist-badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.selection-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--grit-green), #28a745);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9em;
}

.disabled-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--grit-gray);
    font-weight: 600;
}

.modal-actions {
    padding: 20px 24px;
    border-top: 2px solid var(--grit-light-gray);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Enhanced Archetype Selection */
.archetype-selection-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid var(--grit-light-gray);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.archetype-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.archetype-icon {
    color: var(--grit-blue);
    font-size: 1.2em;
}

.archetype-title {
    margin: 0;
    color: var(--grit-black);
    font-size: 1.1em;
    font-weight: 600;
}

.archetype-form-group {
    position: relative;
    margin-bottom: 16px;
}

.archetype-select-enhanced {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--grit-light-gray);
    border-radius: 8px;
    background: var(--grit-white);
    font-size: 1em;
    font-weight: 500;
    color: var(--grit-black);
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    padding-right: 48px;
}

.archetype-select-enhanced:focus {
    outline: none;
    border-color: var(--grit-blue);
    box-shadow: 0 0 0 3px rgba(52, 144, 220, 0.1);
}

.select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--grit-gray);
}

.archetype-preview {
    background: var(--grit-white);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--grit-light-gray);
}

.archetype-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 12px;
}

.archetype-description {
    margin: 0;
    color: var(--grit-gray);
    font-size: 0.9em;
    line-height: 1.4;
}

.archetype-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    color: #856404;
    font-weight: 500;
    font-size: 0.9em;
}

/* Loading states and animations */
.modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--grit-gray);
}

.modal-loading i {
    font-size: 2em;
    margin-right: 12px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Enhanced button interactions */
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}
.trial-participant-card {
    background: var(--grit-white);
    border: 2px solid var(--grit-light-gray);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.trial-participant-card.current-user-card {
    border-color: var(--grit-blue);
    background: linear-gradient(135deg, #f8fbff, #e3f2fd);
}

.participant-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.participant-info h6 {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--grit-black);
}

.you-badge {
    background: var(--grit-blue);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    margin-left: 8px;
}

.participant-grit {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--grit-orange);
    font-weight: 600;
    font-size: 0.9em;
}

.participant-badges {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

/* Victory Banner Styles */
.victory-banner {
    width: 280px;
    height: 450px;
    background: linear-gradient(135deg, var(--grit-blue), #3b82f6);
    position: relative;
    overflow: visible;
    clip-path: polygon(0% 0%, 100% 0%, 100% 80%, 75% 90%, 50% 100%, 25% 90%, 0% 80%);
    box-shadow: 0 8px 25px rgba(77, 126, 168, 0.4);
    border: 3px solid #ffffff;
    margin: 0 10px 60px 10px;
}

.victory-banner-header {
    text-align: center;
    padding: 20px 15px 15px 15px;
    color: white;
}

.victory-banner-title {
    font-weight: 900;
    font-size: 1.3em;
    margin-bottom: 8px;
    letter-spacing: 3px;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.5);
}

.victory-banner-subtitle {
    font-weight: 700;
    font-size: 1.0em;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.4);
}

.victory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    margin: 20px 25px 100px 25px;
    height: 180px;
    opacity: 1;
}

.victory-slot {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    transition: all 0.3s ease;
    min-height: 45px;
    cursor: default;
}

.victory-slot.filled {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #cbd5e1;
    color: #1e293b;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.9);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(203, 213, 225, 0.6);
    opacity: 1;
}

.victory-slot.current-winner {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    border: 3px solid #FF6B35;
    color: #1A1A1A;
    font-weight: 800;
    font-size: 0.7em;
    text-align: center;
    line-height: 1.2;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
    animation: pulse-gold 2s infinite;
    opacity: 1;
}

@keyframes pulse-gold {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
    }
    50% {
        box-shadow: 0 8px 25px rgba(255, 215, 0, 0.8);
        transform: scale(1.06);
    }
}