/* ============================================================
   NASCAR PREDICTIONS – Frontend Styles
   Palette: asphalt #1a1a1a, race-red #e8001d, checkered white,
            gold #f5a623, green-flag #22c55e
   ============================================================ */

:root {
    --nrp-dark:    #1a1a1a;
    --nrp-red:     #e8001d;
    --nrp-gold:    #f5a623;
    --nrp-green:   #22c55e;
    --nrp-light:   #f5f5f5;
    --nrp-border:  #e0e0e0;
    --nrp-radius:  8px;
    --nrp-shadow:  0 2px 12px rgba(0,0,0,.10);
}

/* ── Wrapper ── */
.nrp-wrapper { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--nrp-dark); }

/* ── Race Card ── */
.nrp-race-card {
    background: #fff;
    border: 1px solid var(--nrp-border);
    border-radius: var(--nrp-radius);
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--nrp-shadow);
    transition: box-shadow .2s;
}
.nrp-race-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.14); }

.nrp-race-header {
    padding: 20px 24px 16px;
    border-left: 5px solid var(--nrp-red);
    background: linear-gradient(135deg, #fafafa 0%, #fff 100%);
}
.nrp-race-card.nrp-closed .nrp-race-header { border-left-color: #999; }

.nrp-race-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.nrp-race-date { font-size: 13px; color: #666; }
.nrp-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    padding: 2px 8px;
    border-radius: 20px;
}
.nrp-badge-open   { background: #dcfce7; color: #15803d; }
.nrp-badge-closed { background: #f1f1f1; color: #666; }

.nrp-race-name  { margin: 0 0 4px; font-size: 22px; font-weight: 800; line-height: 1.2; }
.nrp-race-track { margin: 0 0 6px; color: #555; font-size: 14px; }
.nrp-pick-count { margin: 0; font-size: 12px; color: #999; }

/* ── Driver Grid ── */
.nrp-prediction-form { padding: 20px 24px; }

.nrp-driver-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.nrp-driver-grid.nrp-hidden { display: none; }

.nrp-driver-btn {
    background: var(--nrp-light);
    border: 2px solid var(--nrp-border);
    border-radius: var(--nrp-radius);
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all .15s;
    line-height: 1.3;
}
.nrp-driver-btn:hover  { border-color: var(--nrp-red); background: #fff5f5; color: var(--nrp-red); }
.nrp-driver-btn.nrp-selected {
    border-color: var(--nrp-red);
    background: var(--nrp-red);
    color: #fff;
}

/* ── Text fallback ── */
.nrp-driver-text { width: calc(100% - 120px); padding: 8px 12px; border: 1px solid var(--nrp-border); border-radius: var(--nrp-radius); font-size: 14px; }
.nrp-submit-text-btn { padding: 9px 18px; background: var(--nrp-red); color: #fff; border: none; border-radius: var(--nrp-radius); font-weight: 700; cursor: pointer; margin-left: 8px; }

/* ── Current pick ── */
.nrp-current-pick {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--nrp-radius);
    padding: 12px 16px;
    font-size: 15px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nrp-checkmark { color: var(--nrp-green); font-weight: bold; font-size: 18px; }
.nrp-change-link { font-size: 13px; color: var(--nrp-red); cursor: pointer; text-decoration: underline; margin-left: auto; }

/* ── Locked state ── */
.nrp-locked-pick {
    padding: 14px 24px;
    font-size: 15px;
    color: #555;
    background: #f9f9f9;
    border-top: 1px solid var(--nrp-border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.nrp-no-pick { color: #999; }
.nrp-lock-icon { font-size: 16px; }

/* ── Form messages ── */
.nrp-form-msg { margin-top: 10px; font-size: 14px; min-height: 20px; }
.nrp-form-msg.success { color: var(--nrp-green); font-weight: 600; }
.nrp-form-msg.error   { color: var(--nrp-red);   font-weight: 600; }

/* ── Login / Empty notices ── */
.nrp-login-notice, .nrp-empty {
    text-align: center;
    padding: 40px 24px;
    background: var(--nrp-light);
    border-radius: var(--nrp-radius);
    border: 1px dashed var(--nrp-border);
}
.nrp-icon { font-size: 40px; display: block; margin-bottom: 10px; }
.nrp-login-notice p, .nrp-empty p { font-size: 16px; margin: 0; }
.nrp-login-notice a { color: var(--nrp-red); font-weight: 700; }

/* ── Leaderboard ── */
.nrp-leaderboard {
    border: 1px solid var(--nrp-border);
    border-radius: var(--nrp-radius);
    overflow: hidden;
    box-shadow: var(--nrp-shadow);
}

.nrp-lb-header {
    display: grid;
    grid-template-columns: 60px 1fr 130px 110px 150px;
    padding: 12px 16px;
    background: var(--nrp-dark);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    gap: 8px;
}

.nrp-lb-row {
    display: grid;
    grid-template-columns: 60px 1fr 130px 110px 150px;
    padding: 14px 16px;
    gap: 8px;
    align-items: center;
    border-bottom: 1px solid var(--nrp-border);
    font-size: 15px;
    transition: background .15s;
}
.nrp-lb-row:last-child { border-bottom: none; }
.nrp-lb-row:hover { background: #fafafa; }

.nrp-lb-top3.nrp-lb-row:nth-child(1) { background: #fffbeb; }
.nrp-lb-top3.nrp-lb-row:nth-child(2) { background: #f8fafc; }
.nrp-lb-top3.nrp-lb-row:nth-child(3) { background: #fdf4e8; }

.nrp-lb-me { background: #fff5f5 !important; font-weight: 600; }
.nrp-lb-me em { font-weight: 400; font-size: 13px; color: #999; }

.nrp-lb-rank { font-size: 20px; text-align: center; }
.nrp-lb-correct { font-weight: 700; color: var(--nrp-green); }

.nrp-accuracy-bar {
    display: inline-flex;
    align-items: center;
    background: #f0f0f0;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 700;
    position: relative;
    overflow: hidden;
    min-width: 80px;
}
.nrp-accuracy-bar::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: var(--pct, 0%);
    background: rgba(232, 0, 29, .12);
    z-index: 0;
}
.nrp-accuracy-bar { position: relative; z-index: 1; }

.nrp-my-rank {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: var(--nrp-radius);
    font-size: 14px;
}

/* ── My Stats ── */
.nrp-my-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.nrp-stat-box {
    background: #fff;
    border: 1px solid var(--nrp-border);
    border-radius: var(--nrp-radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--nrp-shadow);
}
.nrp-stat-num { display: block; font-size: 32px; font-weight: 900; color: var(--nrp-red); line-height: 1; }
.nrp-stat-label { display: block; font-size: 12px; color: #888; text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }

/* ── History ── */
.nrp-history { display: flex; flex-direction: column; gap: 10px; }

.nrp-history-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--nrp-border);
    border-left: 4px solid var(--nrp-border);
    border-radius: var(--nrp-radius);
    font-size: 14px;
}
.nrp-history-row.nrp-correct { border-left-color: var(--nrp-green); }
.nrp-history-row.nrp-wrong   { border-left-color: var(--nrp-red); }
.nrp-history-race strong { display: block; font-size: 15px; }
.nrp-history-race span   { color: #888; font-size: 12px; }

.nrp-history-result { font-weight: 700; font-size: 13px; white-space: nowrap; }
.nrp-history-result.nrp-correct { color: var(--nrp-green); }
.nrp-history-result.nrp-wrong   { color: var(--nrp-red); }
.nrp-history-result.nrp-pending { color: #999; }

/* ── Past Races ── */
.nrp-past-races { display: flex; flex-direction: column; gap: 12px; }
.nrp-past-race {
    padding: 16px 20px;
    background: #fff;
    border: 1px solid var(--nrp-border);
    border-radius: var(--nrp-radius);
    box-shadow: var(--nrp-shadow);
}
.nrp-past-race-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.nrp-past-race-header h4 { margin: 0; font-size: 17px; }
.nrp-past-race-header span { font-size: 13px; color: #888; }
.nrp-past-winner { font-size: 15px; margin-bottom: 4px; }
.nrp-past-stats  { font-size: 13px; color: #666; }

/* ── Responsive ── */
@media (max-width: 640px) {
    .nrp-lb-header, .nrp-lb-row { grid-template-columns: 44px 1fr 80px; }
    .nrp-lb-total, .nrp-lb-accuracy { display: none; }
    .nrp-history-row { grid-template-columns: 1fr auto; }
    .nrp-history-pick, .nrp-history-winner { display: none; }
    .nrp-driver-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
