/* ===== Global ===== */
body {
    background: #f0f2f5;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ===== Header ===== */
.header-band {
    background: linear-gradient(135deg, #003087 0%, #c8102e 100%);
    color: #fff;
    box-shadow: 0 3px 12px rgba(0,0,0,0.25);
}

.flag-emoji {
    font-size: 2.5rem;
    line-height: 1;
}

.header-title {
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-sub {
    font-size: 0.9rem;
    opacity: 0.85;
    letter-spacing: 0.5px;
}

/* ===== Stats bar ===== */
.stat-card {
    border-radius: 12px;
    padding: 10px 8px;
    border: 2px solid transparent;
}

.stat-num {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.stat-finished { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.stat-running  { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.stat-awaiting { background: #f3f4f6; color: #374151; border-color: #d1d5db; }
.stat-dnf      { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

/* ===== Runner card ===== */
.runner-card {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 5px solid #d1d5db;
    transition: box-shadow 0.2s, transform 0.2s;
    height: 100%;
}

.runner-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.13);
    transform: translateY(-2px);
}

.runner-card.status-finished { border-left-color: #10b981; }
.runner-card.status-running  { border-left-color: #3b82f6; }
.runner-card.status-dnf      { border-left-color: #ef4444; }
.runner-card.status-dns      { border-left-color: #f97316; }
.runner-card.status-awaiting { border-left-color: #9ca3af; }
.runner-card.status-notfound { border-left-color: #6b7280; }

/* ===== Card header ===== */
.card-header-custom {
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 8px;
}

.bib-badge {
    font-size: 0.78rem;
    font-weight: 700;
    background: #1e3a8a;
    color: #fff;
    border-radius: 6px;
    padding: 2px 8px;
    letter-spacing: 0.5px;
}

/* ===== Status pill ===== */
.status-pill {
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    padding: 3px 10px;
    white-space: nowrap;
}

.status-pill.status-finished { background: #d1fae5; color: #065f46; }
.status-pill.status-running  { background: #dbeafe; color: #1e40af; }
.status-pill.status-dnf      { background: #fee2e2; color: #991b1b; }
.status-pill.status-dns      { background: #ffedd5; color: #9a3412; }
.status-pill.status-awaiting { background: #f3f4f6; color: #6b7280; }
.status-pill.status-notfound { background: #f9fafb; color: #9ca3af; }

/* ===== Runner name ===== */
.runner-name {
    line-height: 1.2;
}

.name-first {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
}

.name-last {
    font-size: 0.88rem;
    color: #6b7280;
}

/* ===== Progress bar ===== */
.progress-race {
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
}

/* ===== Finish time ===== */
.finish-time-box {
    background: #f0fdf4;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.88rem;
    color: #065f46;
}

/* ===== Splits ===== */
.splits-details {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.splits-summary {
    padding: 6px 10px;
    font-size: 0.82rem;
    cursor: pointer;
    background: #f9fafb;
    color: #374151;
    user-select: none;
}

.splits-summary:hover {
    background: #f3f4f6;
}

.splits-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}

.splits-table th, .splits-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f3f4f6;
    text-align: left;
}

.splits-table th {
    background: #f9fafb;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}

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

/* ===== Card footer ===== */
.card-footer-custom {
    border-top: 1px solid #f3f4f6;
    padding-top: 8px;
    font-size: 0.78rem;
}

.baa-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.baa-link:hover {
    text-decoration: underline;
}

.updated-time {
    color: #9ca3af;
}

/* ===== Wave badges ===== */
.wave-badge {
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 5px;
    padding: 2px 6px;
    white-space: nowrap;
}

.wave-wave-1 { background: #fef3c7; color: #92400e; }
.wave-wave-2 { background: #dbeafe; color: #1e3a8a; }
.wave-wave-3 { background: #d1fae5; color: #064e3b; }
.wave-wave-4 { background: #ede9fe; color: #4c1d95; }
.wave-wave-5 { background: #fce7f3; color: #831843; }
.wave-wave-6 { background: #ffedd5; color: #7c2d12; }

/* ===== Wave badge (from actual BAA data) ===== */
.wave-actual-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 6px;
    padding: 2px 8px;
}

/* ===== Estimated finish ===== */
.estimated-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.85rem;
    color: #92400e;
}

/* ===== Wave start info ===== */
.wave-info {
    font-size: 0.78rem;
    color: #6b7280;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 8px;
}

/* ===== Race Schedule panel ===== */
.schedule-panel {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.schedule-header h5 {
    color: #111827;
    font-weight: 700;
}

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

.schedule-row {
    display: grid;
    grid-template-columns: 28px 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.schedule-row.upcoming {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.schedule-row.started {
    background: #f0fdf4;
    border: 1px solid #a7f3d0;
}

.schedule-row.has-thai {
    border-width: 2px;
}

.schedule-row.upcoming.has-thai {
    border-color: #3b82f6;
    background: #eff6ff;
}

.schedule-row.started.has-thai {
    border-color: #10b981;
    background: #ecfdf5;
}

.schedule-icon {
    font-size: 1.1rem;
    text-align: center;
}

.schedule-name {
    font-weight: 600;
    color: #111827;
}

.schedule-time {
    font-size: 0.78rem;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.et-time {
    color: #6b7280;
}

.et-time::before { content: "🇺🇸 "; }

.thai-time {
    color: #dc2626;
    font-weight: 600;
}

.thai-time::before { content: "🇹🇭 "; }

.schedule-countdown {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
}

.thai-badge {
    font-size: 0.85rem;
}

/* ===== Running pulse animation ===== */
@keyframes pulse-border {
    0%, 100% { border-left-color: #3b82f6; }
    50%       { border-left-color: #93c5fd; }
}

.runner-card.status-running {
    animation: pulse-border 2s ease-in-out infinite;
}
