/* ============================================
   pairings-next-round.css
   Styles specific to the next-round predictor.
   Inherits pairing-card, player-block, my-game,
   meta, king, table-title from pairings.css
   via .cr-pilot wrapper in HTML.
============================================ */

/* ---- Page subtitle under H1 (SEO descriptor) ---- */
.page-subtitle {
    margin: 4px 0 0 0;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    letter-spacing: 0.2px;
}

[data-theme="dark"] .page-subtitle {
    color: #94a3b8;
}

/* ---- Info banner (accuracy notice) ---- */
.pnr-accuracy-notice {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 24px;
    font-size: 13px;
    color: #1e40af;
    line-height: 1.6;
}

.pnr-accuracy-notice strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.pnr-accuracy-notice ul {
    margin: 6px 0 0 16px;
    padding: 0;
}

.pnr-accuracy-notice ul li {
    margin-bottom: 2px;
}

/* ---- Help text under label ---- */
.pnr-help {
    font-size: 12px;
    color: #6b7280;
    margin: 4px 0 14px;
    line-height: 1.5;
}

/* ---- File upload row ---- */
.pnr-upload-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.pnr-file-label {
    display: inline-block;
    padding: 12px 18px;
    background: #e5e7eb;
    color: #374151;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.2s;
}

.pnr-file-label:hover {
    background: #d1d5db;
}

/* Full reset row — discrete, right-aligned */
.pnr-reset-row {
    justify-content: flex-end;
    margin-top: 0;
    margin-bottom: 8px;
}

.pnr-reset-row button {
    font-size: 13px;
    padding: 8px 14px;
}

input[type="file"]#crosstableFile {
    display: none;
}

.pnr-file-name {
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
}

/* ---- Optional label tag ---- */
.pnr-opt {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 400;
}

/* ---- Format hint block ---- */
.pnr-format-hint {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 16px;
    font-size: 12px;
    color: #374151;
    line-height: 1.6;
}

.pnr-format-hint strong {
    color: #111827;
}

.pnr-format-hint code {
    background: #e5e7eb;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
    color: #1f2937;
}

.pnr-template-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
}

/* ---- Tournament info bar ---- */
.pnr-info-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pnr-badge {
    background: #2563eb;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.pnr-tournament {
    font-size: 13px;
    font-weight: 600;
    color: #1e3a5f;
    flex: 1;
}

.pnr-count {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

/* ---- Score group header ---- */
.pnr-group-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    padding: 18px 4px 6px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 4px;
}

/* ---- Meta row below players ---- */
.pnr-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* ---- Color estimate tags ---- */
.pnr-color-reliable {
    font-size: 11px;
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    padding: 2px 8px;
    border-radius: 4px;
}

.pnr-color-predicted {
    font-size: 11px;
    color: #1e40af;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    padding: 2px 8px;
    border-radius: 4px;
}

/* ---- Floater tags ---- */
.pnr-float-note {
    font-size: 11px;
    color: #92400e;
}

.pnr-float-tag {
    font-size: 10px;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
}

/* ---- Rematch warning ---- */
.pnr-warning {
    font-size: 12px;
    color: #92400e;
    margin-top: 6px;
    padding: 6px 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 4px;
}

/* ---- YOU tag ---- */
.pnr-me-tag {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

/* ---- Score group candidate list ---- */
.pnr-group-candidates {
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
    font-style: italic;
}

/* ---- BYE card ---- */
.pnr-bye {
    opacity: 0.55;
}

.pnr-bye-label {
    font-size: 12px;
    color: #9ca3af;
    padding: 8px 0;
    font-style: italic;
}

/* ---- OR divider ---- */
.pnr-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 16px;
    color: #9ca3af;
    font-size: 12px;
}

.pnr-divider::before,
.pnr-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* ---- Source tag in info bar ---- */
.pnr-source-tag {
    font-size: 11px;
    font-weight: 600;
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.pnr-source-file {
    color: #1e40af;
    background: #dbeafe;
    border-color: #bfdbfe;
}

/* ---- Mode tag (real vs predicted) in info bar ---- */
.pnr-mode-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.pnr-mode-real {
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
}

.pnr-mode-predicted {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
}

[data-theme="dark"] .pnr-mode-real {
    color: #86efac;
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.35);
}

[data-theme="dark"] .pnr-mode-predicted {
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
}

/* ---- In-card refresh button for the user's match ---- */
.pnr-card-refresh {
    margin-left: 10px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #1e3a8a;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.pnr-card-refresh:hover {
    background: #bfdbfe;
    border-color: #60a5fa;
}

[data-theme="dark"] .pnr-card-refresh {
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
}

[data-theme="dark"] .pnr-card-refresh:hover {
    background: rgba(59, 130, 246, 0.25);
}

.pnr-card-updated {
    margin-left: 8px;
    font-size: 11px;
    color: #64748b;
    font-style: italic;
}

[data-theme="dark"] .pnr-card-updated {
    color: #94a3b8;
}

/* ---- TPR (Tournament Performance Rating) for the user ---- */
.pnr-tpr {
    margin-top: 6px;
    padding: 6px 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 13px;
    color: #1e3a8a;
    display: inline-block;
}

.pnr-tpr strong {
    font-weight: 700;
    font-size: 14px;
}

.pnr-tpr-diff {
    font-weight: 600;
    margin-left: 2px;
}

.pnr-tpr-diff.pos {
    color: #166534;
}

.pnr-tpr-diff.neg {
    color: #b91c1c;
}

[data-theme="dark"] .pnr-tpr {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.35);
    color: #93c5fd;
}

[data-theme="dark"] .pnr-tpr-diff.pos {
    color: #86efac;
}

[data-theme="dark"] .pnr-tpr-diff.neg {
    color: #fca5a5;
}

/* ---- Live result tag in pairing card ---- */
.pnr-result-tag {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 6px;
    white-space: nowrap;
}

.pnr-result-done {
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
}

.pnr-result-live {
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fde68a;
}

[data-theme="dark"] .pnr-result-done {
    color: #86efac;
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.35);
}

[data-theme="dark"] .pnr-result-live {
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
}

/* ---- What-if scenario tabs in my card ---- */
.pnr-whatif {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #cbd5e1;
}

.pnr-whatif-label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.pnr-whatif-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.pnr-whatif-tab {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.pnr-whatif-tab:hover {
    background: #e2e8f0;
}

.pnr-whatif-tab.active {
    background: #3b82f6;
    color: white;
    border-color: #2563eb;
}

.pnr-whatif-tab.pnr-whatif-tab-confirmed.active {
    background: #10b981;
    border-color: #059669;
}

.pnr-whatif-result-confirmed {
    background: #ecfdf5 !important;
    border-color: #6ee7b7 !important;
}

[data-theme="dark"] .pnr-whatif-tab.pnr-whatif-tab-confirmed.active {
    background: #059669;
    border-color: #047857;
}

[data-theme="dark"] .pnr-whatif-result-confirmed {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

.pnr-whatif-prob {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.75;
    margin-left: 3px;
}

.pnr-whatif-panel:empty {
    display: none;
}

.pnr-whatif-result {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
}

.pnr-whatif-line {
    margin-bottom: 4px;
}

.pnr-whatif-line:last-of-type {
    margin-bottom: 0;
}

.pnr-whatif-alts {
    color: #475569;
    font-size: 12px;
    margin-top: 6px;
}

.pnr-whatif-disclaimer {
    color: #64748b;
    font-size: 11px;
    margin-top: 8px;
    font-style: italic;
}

.pnr-whatif-empty {
    color: #64748b;
    font-size: 12px;
    font-style: italic;
    padding: 8px 0;
}

[data-theme="dark"] .pnr-whatif {
    border-top-color: #475569;
}

[data-theme="dark"] .pnr-whatif-label {
    color: #cbd5e1;
}

[data-theme="dark"] .pnr-whatif-tab {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #475569;
}

[data-theme="dark"] .pnr-whatif-tab:hover {
    background: #334155;
}

[data-theme="dark"] .pnr-whatif-tab.active {
    background: #2563eb;
    border-color: #1d4ed8;
}

[data-theme="dark"] .pnr-whatif-result {
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.3);
    color: #e2e8f0;
}

[data-theme="dark"] .pnr-whatif-alts,
[data-theme="dark"] .pnr-whatif-disclaimer {
    color: #94a3b8;
}

/* ===================================================
   DARK MODE
=================================================== */

[data-theme="dark"] .pnr-accuracy-notice {
    background: #1a2744;
    border-color: #3b5299;
    border-left-color: #60a5fa;
    color: #93c5fd;
}

[data-theme="dark"] .pnr-help {
    color: var(--text-secondary);
}

[data-theme="dark"] .pnr-file-label {
    background: var(--bg-surface);
    color: var(--primary);
}

[data-theme="dark"] .pnr-file-label:hover {
    background: var(--bg-surface-2);
}

[data-theme="dark"] .pnr-file-name {
    color: var(--text-muted);
}

[data-theme="dark"] .pnr-opt {
    color: var(--text-muted);
}

[data-theme="dark"] .pnr-format-hint {
    background: var(--bg-surface);
    border-color: var(--border);
    color: var(--text-secondary);
}

[data-theme="dark"] .pnr-format-hint strong {
    color: var(--primary);
}

[data-theme="dark"] .pnr-format-hint code {
    background: var(--bg-surface-2);
    color: var(--primary);
}

[data-theme="dark"] .pnr-template-link {
    color: var(--link-color);
}

[data-theme="dark"] .pnr-info-bar {
    background: #1a2744;
    border-color: #3b5299;
}

[data-theme="dark"] .pnr-tournament {
    color: #93c5fd;
}

[data-theme="dark"] .pnr-count {
    color: var(--text-secondary);
}

[data-theme="dark"] .pnr-group-header {
    color: var(--text-muted);
    border-bottom-color: var(--border);
}

[data-theme="dark"] .pnr-color-reliable {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.25);
}

[data-theme="dark"] .pnr-color-predicted {
    color: #93c5fd;
    background: rgba(147, 197, 253, 0.12);
    border-color: rgba(147, 197, 253, 0.25);
}

[data-theme="dark"] .pnr-float-note {
    color: #fbbf24;
}

[data-theme="dark"] .pnr-float-tag {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.25);
}

[data-theme="dark"] .pnr-warning {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.06);
    border-color: rgba(251, 191, 36, 0.25);
}

[data-theme="dark"] .pnr-group-candidates {
    color: var(--text-secondary);
}

[data-theme="dark"] .pnr-bye-label {
    color: var(--text-muted);
}

[data-theme="dark"] .pnr-divider {
    color: var(--text-muted);
}

[data-theme="dark"] .pnr-divider::before,
[data-theme="dark"] .pnr-divider::after {
    background: var(--border);
}

[data-theme="dark"] .pnr-source-tag {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.25);
}

[data-theme="dark"] .pnr-source-file {
    color: #93c5fd;
    background: rgba(147, 197, 253, 0.12);
    border-color: rgba(147, 197, 253, 0.25);
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
    .pnr-upload-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .pnr-info-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}
