/* Scorecard - shared popup styles for the Tournament Leaderboard scorecard.
 *
 * The overlay / icon inherits the active tournament theme via the --t-*
 * variables already set by index.html / pool-standings-public.html. The
 * scorecard itself is deliberately styled as a traditional paper course
 * scorecard - cream stock, dark green ink, heavy borders, circled birdies
 * and squared bogeys - so it stands out from the dark tournament chrome.
 */
:root {
    /* Overlay + icon vars (inherit tournament theme) */
    --sc-accent:       var(--t-secondary, #e6c757);
    --sc-border-strong:rgba(255, 255, 255, 0.22);
    --sc-text-dim-on-dark: rgba(232, 236, 239, 0.75);

    /* Paper scorecard vars */
    --sc-paper:        #f5ecd6;              /* cream card stock */
    --sc-paper-alt:    #ebe0c2;              /* slightly darker cream for par/total strips */
    --sc-paper-edge:   #d9ce9f;              /* edge shadow on paper */
    --sc-ink:          #1c3a27;              /* dark forest green "ink" */
    --sc-ink-soft:     #4a5e4f;
    --sc-rule:         #2a4b36;              /* ruled line on the card */
    --sc-rule-soft:    rgba(42, 75, 54, 0.35);
    --sc-red:          #a4281f;              /* traditional red accents on scorecards */
    --sc-red-dim:      rgba(164, 40, 31, 0.55);
}

/* ============================================================
 * Inline icon in the leaderboard row (sits on the dark chrome,
 * inherits tournament theme colors)
 * ============================================================ */
.sc-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 0 0 0 8px;
    padding: 0;
    border: 1px solid var(--sc-border-strong);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--sc-text-dim-on-dark);
    cursor: pointer;
    vertical-align: middle;
    opacity: 0.85;
    transition: opacity 0.12s ease, color 0.12s ease, border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
    line-height: 0;
    flex-shrink: 0;
}
.sc-icon-btn:hover {
    opacity: 1;
    color: var(--sc-accent);
    border-color: var(--sc-accent);
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}
.sc-icon-btn svg {
    width: 15px;
    height: 15px;
    display: block;
}

/* ============================================================
 * Leaderboard round-trigger cells (R1/R2/R3/R4 + Total) - tagged
 * by the pool page so clicking opens the scorecard on that round.
 * Hover mirrors the golfer-name hover: just color + underline.
 * ============================================================ */
.sc-round-trigger {
    cursor: pointer;
    transition: color 0.12s ease, text-decoration-color 0.12s ease;
}
.sc-round-trigger:hover {
    color: var(--sc-accent);
    text-decoration: underline;
}

/* ============================================================
 * Overlay / modal frame
 * ============================================================ */
.sc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 10001;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 40px 12px;
    backdrop-filter: blur(4px);
    animation: sc-fade-in 0.18s ease-out;
}
.sc-overlay.sc-hidden { display: none; }

@keyframes sc-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sc-card-in {
    from { transform: translateY(12px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* ============================================================
 * The paper scorecard itself
 * ============================================================ */
.sc-card {
    width: 100%;
    max-width: 780px;
    background: var(--sc-paper);
    color: var(--sc-ink);
    font-family: "Georgia", "Times New Roman", "Source Serif Pro", serif;
    border: 3px solid var(--sc-rule);
    border-radius: 4px;
    box-shadow:
        0 0 0 1px var(--sc-paper-edge),
        0 20px 60px rgba(0, 0, 0, 0.55),
        inset 0 0 36px rgba(169, 139, 66, 0.12);   /* subtle paper vignette */
    overflow: hidden;
    animation: sc-card-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
    position: relative;
}

/* Subtle paper grain via layered gradients */
.sc-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 12% 18%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.05) 60%, rgba(0,0,0,0.08) 100%),
        repeating-linear-gradient(0deg, rgba(28, 58, 39, 0.015) 0 2px, rgba(28, 58, 39, 0) 2px 4px);
    mix-blend-mode: multiply;
    z-index: 0;
}
.sc-card > * { position: relative; z-index: 1; }

/* Header masthead (like the course name banner at the top of a real card) */
.sc-header {
    padding: 16px 22px 12px;
    border-bottom: 2px solid var(--sc-rule);
    background:
        linear-gradient(180deg, rgba(42, 75, 54, 0.05) 0%, rgba(42, 75, 54, 0.00) 100%);
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.sc-header-text { flex: 1; min-width: 0; }
.sc-eyebrow {
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--sc-red);
    font-weight: 700;
    margin-bottom: 4px;
}
.sc-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--sc-ink);
    margin: 0;
    line-height: 1.15;
    font-variant: small-caps;
}
.sc-subline {
    margin-top: 5px;
    font-size: 12px;
    color: var(--sc-ink-soft);
    letter-spacing: 0.4px;
    text-transform: uppercase;
    font-family: "Helvetica Neue", Arial, sans-serif;
}
.sc-close {
    width: 30px;
    height: 30px;
    border: 1.5px solid var(--sc-rule);
    background: var(--sc-paper);
    color: var(--sc-ink);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
    font-family: Arial, sans-serif;
}
.sc-close:hover { color: var(--sc-red); border-color: var(--sc-red); background: #fff; }

/* Round tabs */
.sc-tabs {
    display: flex;
    gap: 0;
    padding: 10px 20px 0;
    border-bottom: 2px solid var(--sc-rule);
    background: rgba(0, 0, 0, 0.02);
    flex-wrap: wrap;
}
.sc-tab {
    padding: 8px 18px;
    background: transparent;
    border: 1.5px solid var(--sc-rule-soft);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    color: var(--sc-ink-soft);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    cursor: pointer;
    text-transform: uppercase;
    transition: color 0.12s, background 0.12s, border-color 0.12s;
    margin-bottom: -2px;
    margin-right: 4px;
    font-family: "Helvetica Neue", Arial, sans-serif;
}
.sc-tab:hover:not(:disabled) {
    color: var(--sc-ink);
    background: rgba(42, 75, 54, 0.06);
}
.sc-tab.sc-tab-active {
    color: var(--sc-paper);
    background: var(--sc-rule);
    border-color: var(--sc-rule);
}
.sc-tab:disabled { opacity: 0.4; cursor: not-allowed; }

/* Round summary strip */
.sc-round-summary {
    display: flex;
    gap: 26px;
    padding: 12px 22px;
    border-bottom: 1px solid var(--sc-rule-soft);
    background: var(--sc-paper-alt);
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 11px;
    color: var(--sc-ink-soft);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
    flex-wrap: wrap;
}
.sc-round-summary strong {
    display: block;
    margin-top: 3px;
    color: var(--sc-ink);
    font-size: 18px;
    font-family: "Georgia", serif;
    letter-spacing: 0.2px;
    font-weight: 700;
    text-transform: none;
}
.sc-round-summary .sc-sum-val-minus { color: var(--sc-red); }
.sc-round-summary .sc-sum-val-plus  { color: var(--sc-ink); }

/* ============================================================
 * Scorecard table
 * ============================================================ */
.sc-body {
    padding: 18px 18px 10px;
    overflow-x: auto;
}
.sc-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    min-width: 560px;
    font-family: "Helvetica Neue", Arial, sans-serif;
    border: 2px solid var(--sc-rule);
    background: var(--sc-paper);
}
.sc-table th, .sc-table td {
    padding: 8px 2px;
    text-align: center;
    border: 1px solid var(--sc-rule-soft);
    color: var(--sc-ink);
    height: 36px;
    box-sizing: border-box;
}
.sc-table thead th {
    background: var(--sc-rule);
    color: var(--sc-paper);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-color: var(--sc-rule);
    font-family: "Helvetica Neue", Arial, sans-serif;
    height: 32px;
}

/* Left-side row label ("Hole" / "Par" / "Score") - the classic scorecard
 * strip down the left edge. */
.sc-table .sc-row-label {
    width: 66px;
    background: var(--sc-rule);
    color: var(--sc-paper);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-align: left;
    padding-left: 12px;
    border-color: var(--sc-rule);
}

/* Total columns (OUT / IN / TOT) are visually emphasized. */
.sc-table thead th.sc-total-col {
    background: var(--sc-red);
    color: #fff1e6;
    border-color: var(--sc-red);
    letter-spacing: 1.5px;
}
.sc-table td.sc-total-cell {
    background: var(--sc-paper-alt);
    font-weight: 700;
    font-size: 15px;
    color: var(--sc-ink);
    font-family: "Georgia", serif;
}

/* Par row: slightly shaded stripe and smaller number weight */
.sc-table .sc-par-row td { background: var(--sc-paper-alt); color: var(--sc-ink-soft); font-weight: 700; }
.sc-table .sc-par-row .sc-total-cell { background: #e1d49f; color: var(--sc-ink); }

/* Score row */
.sc-table .sc-score-row td { font-weight: 700; font-size: 15px; color: var(--sc-ink); font-family: "Georgia", serif; }

/* Mark wrappers - circled birdie, double-circled eagle, squared bogey,
 * double-squared double+. These match traditional hand-marked scorecards. */
.sc-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    box-sizing: border-box;
    line-height: 1;
    position: relative;
    font-weight: 700;
    /* Georgia's baseline sits low inside the em box, so a flex-centered
       numeral lands ~1px below the geometric center of the shape. Adding
       padding-bottom with border-box shrinks the content area from below
       and nudges the digit up by half the padding (1px). Keeps the outer
       box 26x26 so circles stay round and squares stay square. */
    padding-bottom: 2px;
}
.sc-mark-birdie  { border: 1.8px solid var(--sc-red);      border-radius: 50%; color: var(--sc-red); }
.sc-mark-eagle   { border: 1.8px solid var(--sc-red);      border-radius: 50%; color: var(--sc-red); box-shadow: inset 0 0 0 2.5px var(--sc-paper), inset 0 0 0 4.2px var(--sc-red); }
.sc-mark-bogey   { border: 1.8px solid var(--sc-ink);      border-radius: 2px; color: var(--sc-ink); }
.sc-mark-double  { border: 1.8px solid var(--sc-ink);      border-radius: 2px; color: var(--sc-ink); box-shadow: inset 0 0 0 2.5px var(--sc-paper), inset 0 0 0 4.2px var(--sc-ink); }

/* Unplayed / blank cells */
.sc-table .sc-empty-cell { color: rgba(28, 58, 39, 0.25); font-weight: 400; }

/* Nine-hole separator - a heavier ruled line between hole 9 and OUT */
.sc-table .sc-group-sep { border-right: 2px solid var(--sc-rule); }

/* Empty state */
.sc-empty-state {
    padding: 42px 24px;
    text-align: center;
    color: var(--sc-ink-soft);
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    letter-spacing: 0.6px;
    background: var(--sc-paper-alt);
}

/* Legend - mimics the little "KEY" block on a real scorecard */
.sc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
    padding: 12px 22px 16px;
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 10px;
    color: var(--sc-ink-soft);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 700;
    border-top: 2px solid var(--sc-rule);
    background: var(--sc-paper-alt);
}
.sc-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.sc-legend-sample {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    box-sizing: border-box;
    line-height: 1;
    font-weight: 700;
    font-size: 12px;
    font-family: "Georgia", serif;
}

/* ============================================================
 * Mobile
 * ============================================================ */
@media (max-width: 560px) {
    .sc-card { max-width: 100%; border-radius: 3px; border-width: 2px; }
    .sc-header { padding: 14px 16px 10px; }
    .sc-name { font-size: 18px; }
    .sc-eyebrow { font-size: 9px; letter-spacing: 2.5px; }
    .sc-body { padding: 12px 10px 8px; }
    .sc-table { font-size: 12px; min-width: 540px; }
    .sc-table th, .sc-table td { padding: 6px 2px; height: 32px; }
    .sc-table .sc-row-label { width: 54px; font-size: 10px; padding-left: 8px; letter-spacing: 1px; }
    .sc-table thead th { font-size: 11px; height: 28px; }
    .sc-table td.sc-total-cell { font-size: 13px; }
    .sc-table .sc-score-row td { font-size: 13px; }
    .sc-mark { width: 22px; height: 22px; font-size: 12px; padding-bottom: 2px; }
    .sc-tabs { padding: 8px 12px 0; }
    .sc-tab { padding: 6px 12px; font-size: 10px; letter-spacing: 1px; margin-right: 3px; }
    .sc-round-summary { gap: 16px; padding: 10px 14px; font-size: 10px; }
    .sc-round-summary strong { font-size: 15px; }
    .sc-legend { padding: 10px 14px 14px; gap: 10px 14px; font-size: 9px; letter-spacing: 1.2px; }
}
