﻿/* =========================================================
   EVENTS PLAYER SCORECARD â€” MODAL LAYOUT & STRUCTURE
   - Uses core.css theme engine (html.theme-light / theme-dark)
   ========================================================= */

/* ---------------------------------------------------------
   1. SHELL & TRANSITION
   --------------------------------------------------------- */

#epsScoreModal {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    background: var(--eps-dark-bg); /* overridden in light mode */
    color: #fff;
    border-left: 1px solid rgba(0,0,0,0.35);
    box-shadow: -14px 0 40px rgba(0, 0, 0, 0.45);
    z-index: 2147483646;
}

#epsScoreModal.active {
    transform: translateX(0);
}

/* Modal content container */
#epsScoreModal .modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll from pushing header out */
    padding: 1.25rem 1.25rem 1.75rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Light mode: remove any opaque pane look; keep things transparent */
html.theme-light #epsScoreModal .modal-content{
    background: transparent !important;
}
/* Also ensure the direct modal-body wrapper remains transparent in light mode */
html.theme-light #epsScoreModal .modal-body{
    background: transparent !important;
}
html.theme-light #epsScoreModal .eps-hole-pane,
html.theme-light #epsScoreModal .eps-score-buttons,
html.theme-light #epsScoreModal .eps-score-input-group{
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ---------------------------------------------------------
   2. HEADER â€” Player left / Close right
   --------------------------------------------------------- */

#epsScoreModal .modal-header {
    position: sticky;
    top: -1.25rem; /* Counteract modal padding */
    z-index: 100;
    margin: 0 -1.25rem 0.8rem -1.25rem; /* Span full width */
    padding: 1.25rem 1.25rem 0.5rem; /* Restore padding */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

/* Sticky Header Backgrounds */
html.theme-light #epsScoreModal .modal-header {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

html.theme-dark #epsScoreModal .modal-header,
body.theme-dark #epsScoreModal .modal-header {
    background: rgba(31, 41, 55, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Hide â€œAdd Scoreâ€ title text */
#epsScoreModal .modal-header .modal-title {
    display: none !important;
}

/* Flex container for header content */
#epsScoreModal .eps-header-right {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
}

/* Player summary chip in header */
#epsScoreModal .eps-player-summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.9rem;
    border-radius: 12px;
    /* Sharper inset frosted surface */
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.22);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    
    /* Constraint for very small screens */
    max-width: calc(100% - 50px);
    overflow: hidden;
}

#epsScoreModal .eps-player-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.9);
}

#epsScoreModal .eps-player-label {
    font-weight: 700;
    font-size: 1rem;
}

/* Close button */
#epsScoreModal .eps-close-x {
    position: relative;
    right: auto;
    top: auto;
    flex-shrink: 0;
    margin-left: auto; /* Push to right if not justified */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--eps-site-green);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    transition: transform 0.2s ease;
}
#epsScoreModal .eps-close-x:hover {
    transform: scale(1.05);
}

/* ---------------------------------------------------------
   3. HOLE / PAR / TEE PANE
   --------------------------------------------------------- */

#epsScoreModal .eps-hole-pane {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    /* Sharper inset frosted surface */
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.22);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    
    /* Ensure wrapping on tiny screens to prevent overflow */
    flex-wrap: wrap;
    gap: 10px;
}

#epsScoreModal .eps-par-tee-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 100%; /* prevent overflow */
}

#epsScoreModal .eps-hole-label {
    font-size: 0.7rem;
    opacity: 0.8;
}

/* Hole number circle (double border) */
#epsScoreModal .eps-hole-circle {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    font-weight: 800;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #1b222c;
    flex-shrink: 0;
}
#epsScoreModal .eps-hole-circle::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.95); /* heavier outer ring */
}
#epsScoreModal .eps-hole-circle::after {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    border: 2px solid rgba(42,51,64,0.9);     /* inner darker ring */
}

/* Par / Tee pills */
#epsScoreModal .eps-par-indicator,
#epsScoreModal #eps-tee-note {
    border-radius: 999px;
    padding: 0.45rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    /* Truncation protection */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

#epsScoreModal #eps-tee-note {
    display: flex;
    align-items: center;
    gap: 6px;
}

#epsScoreModal #eps-tee-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------------------------------------------------------
   4. BUTTON GRID
   --------------------------------------------------------- */

#epsScoreModal .eps-score-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.1rem;
    margin: 1.25rem auto 1.75rem;
    max-width: 360px;
}

/* Base chip shape (colors come from scorecard-buttons.css) */
#epsScoreModal .eps-chip-btn {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0; /* border handled by ring system in scorecard-buttons.css */
    font-weight: 600; /* lighter label */
    font-size: 1.12rem; /* slightly larger */
    letter-spacing: 0.01em;
    transition: filter 0.18s ease, box-shadow 0.18s ease;
    color: #fff;
}
#epsScoreModal .eps-chip-btn:hover {
    filter: brightness(1.08);
}

/* Ensure PAR chip & save button use site green */
#epsScoreModal .eps-chip-btn[data-score="par"],
#epsScoreModal .btn-save {
    background: var(--eps-site-green) !important;
    color: #fff !important;
}

/* Header initials avatar fallback (matches grid styling, sized for modal) */
#epsScoreModal .eps-player-init{
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.9);
    display: none; /* hidden by default; shown when no/failed avatar */
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1;
    position: relative;
    z-index: 10;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#epsScoreModal .eps-chip-val {
    position: relative;
    z-index: 5;
    pointer-events: none;
}

/* Light mode variant for initials avatar */
:root[data-theme="light"] #epsScoreModal .eps-player-init,
html.theme-light #epsScoreModal .eps-player-init,
body.theme-light #epsScoreModal .eps-player-init {
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.12);
    color: #111827;
}

/* ---------------------------------------------------------
   5. INPUT / SAVE / CONCEDE SECTION
   --------------------------------------------------------- */

/* Use a stable 3-column grid -> Flexbox to tighten spacing */
#epsScoreModal .eps-score-input-group {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 1.25rem;
    margin-top: 1.25rem;
}

#epsScoreModal .eps-score-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

/* Score field */
#epsScoreModal #eps-score {
    width: 120px;
    text-align: center;
    border-radius: 999px;
    padding: 0.55rem 0;
    font-size: 1rem;
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.12);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

/* Save button (shape only, color handled above) */
#epsScoreModal .btn-save {
    width: 120px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 0.65rem 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.35),
    0 0 8px rgba(77,150,155,0.45);
    transition: transform 0.15s ease, filter 0.15s ease;
}
#epsScoreModal .btn-save:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

/* Concede toggle â€” stacked, checkbox above label (â€œConcedeâŽHole?â€) */
#epsScoreModal .eps-concede-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0;
    transform: none; /* keep centered; no left shift */
    line-height: 1.15;
    font-size: 0.82rem;
}

#epsScoreModal .eps-concede-wrap label {
    text-align: center;
    color: rgba(255,255,255,0.8);
}

#epsScoreModal #eps-concede {
    transform: scale(1.3);
    margin: 0;
    accent-color: var(--eps-site-green);
}

/* --- CTP inline expandable panel --- */
#epsScoreModal .eps-ctp-wrap{
    min-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-self: center; /* Keep centered in grid */
    position: relative; /* Context for positioning if needed */
}

/* CTP toggle stacked like concede */
#epsScoreModal .eps-ctp-toggle{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    line-height: 1.15;
    font-size: 0.82rem;
    cursor: pointer;
}
#epsScoreModal .eps-ctp-toggle input{
    transform: scale(1.3);
    margin: 0;
    accent-color: var(--eps-site-green);
    cursor: pointer;
}

/* Current distance block */
#epsScoreModal .eps-ctp-current{
    margin-top: 0.5rem;
    text-align: center;
}
#epsScoreModal .eps-ctp-current .btn-ctp-edit{
    margin-top: 0.25rem;
    display: inline-block;
    color: var(--eps-site-green); /* Link color */
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border-bottom: 1px dotted currentColor;
}

/* CTP Panel (Balloon) */
#epsScoreModal .eps-ctp-panel{
    display: none;
    position: fixed;
    top: 50%;
    /* Horizontal centering relative to 420px sidebar */
    right: 210px; /* Right edge at center of sidebar */
    margin-right: -140px; /* Shift right by half width (280/2) */
    left: auto;
    transform: translateY(-50%);
    width: 280px;
    max-width: 90vw;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.05);
    z-index: 10000;
    padding: 1rem;
    color: #333;
}
/* Dark Mode Panel */
html.theme-dark #epsScoreModal .eps-ctp-panel,
body.theme-dark #epsScoreModal .eps-ctp-panel {
    background: #1f2937;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
}

#epsScoreModal .eps-ctp-panel[aria-hidden="false"]{ display: block; animation: eps-pop-in 0.2s ease-out; }

@keyframes eps-pop-in {
    from { opacity: 0; transform: translateY(-45%) scale(0.95); }
    to { opacity: 1; transform: translateY(-50%) scale(1); }
}

/* Mobile Override */
@media (max-width: 480px) {
    #epsScoreModal .eps-ctp-panel {
        right: 50%;
        margin-right: -140px;
    }
}

#epsScoreModal .eps-ctp-head{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}
html.theme-dark #epsScoreModal .eps-ctp-head { border-bottom-color: rgba(255,255,255,0.1); }

#epsScoreModal .eps-ctp-title{
    font-weight: 700;
    font-size: 1rem;
}

#epsScoreModal .eps-ctp-close{
    /* Inherits visuals from .eps-close-x class added in HTML */
}
#epsScoreModal .eps-ctp-close:hover{
    /* Inherits hover */
}
/* Dark Mode - Inherits */
html.theme-dark #epsScoreModal .eps-ctp-close { }
html.theme-dark #epsScoreModal .eps-ctp-close:hover{ }

#epsScoreModal .eps-ctp-fields{
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

#epsScoreModal .eps-ctp-fields label{
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.8;
}

#epsScoreModal .eps-ctp-fields input{
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    background: #f9fafb;
    color: #111;
}
html.theme-dark #epsScoreModal .eps-ctp-fields input{
    background: rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
}

#epsScoreModal .btn-ctp-add{
    width: 100%;
    padding: 0.75rem;
    background: var(--eps-site-green);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: filter 0.2s;
}
#epsScoreModal .btn-ctp-add:hover{ filter: brightness(1.1); }

/* stacking context for row */
#epsScoreModal .eps-score-input-group{ position: relative; z-index: 1; }

/* Light theme tweaks */
/* Light mode variant for value fields */
html.theme-light #epsScoreModal #eps-score,
html.theme-light #epsScoreModal .eps-ctp-fields input[type="number"]{
    border: 1px solid rgba(0,0,0,0.18);
    background: #fff;
    color: #222;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
/* Light theme surface for the CTP panel itself */
html.theme-light #epsScoreModal .eps-ctp-panel{
    background: rgba(255,255,255,0.98);
    border-color: rgba(0,0,0,0.12);
}
html.theme-light #epsScoreModal .eps-ctp-title{ color:#111827; }
html.theme-light #epsScoreModal .eps-ctp-panel .eps-ctp-close{
    border-color: rgba(0,0,0,0.18);
    background: rgba(0,0,0,0.06);
    color: #111827;
    border-radius: 8px; /* keep square with medium radius in light mode too */
}

/* Dark mode placeholders */
#epsScoreModal #eps-score::placeholder,
#epsScoreModal .eps-ctp-fields input[type="number"]::placeholder{
    color: rgba(255,255,255,0.7);
}

/* Simple link style for CTP edit */
#epsScoreModal .link-ctp-edit{
    display: inline-block;
    margin-top: .25rem;
    color: var(--eps-site-green);
    text-decoration: underline;
    font-weight: 600;
}
html.theme-light #epsScoreModal .eps-ctp-fields label{ color: #111; }
/* Light theme surface for panel */
html.theme-light #epsScoreModal .eps-ctp-panel{
    background: #fff;
    border-color: rgba(0,0,0,0.12);
}

/* Deepen dark mode inputs for better contrast */
#epsScoreModal[data-theme="dark"] .eps-ctp-fields input[type="number"],
[data-theme="dark"] #epsScoreModal .eps-ctp-fields input[type="number"],
#epsScoreModal[data-theme="dark"] #eps-score,
[data-theme="dark"] #epsScoreModal #eps-score{
    background: rgba(17,24,39,0.55);
    border-color: rgba(255,255,255,0.18);
    color: #e5e7eb;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

/* ---------------------------------------------------------
   6. THEME HOOKS â€” Match core.css (html.theme-light/dark)
   --------------------------------------------------------- */

/* ----- DEFAULT (Dark-ish bias for safety) ----- */
#epsScoreModal {
    background: var(--eps-dark-bg);
    color: #fff;
}

#epsScoreModal .modal-content {
    background: rgba(35,45,60,0.90);
    color: #fff;
}

/* Default dark-ish hole pane & pills */
#epsScoreModal .eps-hole-pane {
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 8px rgba(255,255,255,0.12);
}
#epsScoreModal .eps-par-indicator,
#epsScoreModal #eps-tee-note {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* Default player summary */
#epsScoreModal .eps-player-summary {
    background: rgba(255,255,255,0.12);
    box-shadow: 0 0 10px rgba(255,255,255,0.25),
    0 2px 8px rgba(0,0,0,0.4);
    color: #fff;
}

/* ----- LIGHT MODE (html.theme-light) ----- */

html.theme-light #epsScoreModal {
    background: var(--eps-light-bg);
    color: var(--color-text);
}

html.theme-light #epsScoreModal .modal-content {
    background: linear-gradient(
            135deg,
            rgba(230,238,248,0.96) 0%,
            rgba(200,215,232,0.94) 100%
    ) !important;
    color: var(--color-text) !important;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}

/* Light-mode hole pane */
html.theme-light #epsScoreModal .eps-hole-pane {
    background: rgba(220,230,240,0.95);
    box-shadow: inset 0 0 6px rgba(0,0,0,0.08);
}

/* Light-mode pills */
html.theme-light #epsScoreModal .eps-par-indicator,
html.theme-light #epsScoreModal #eps-tee-note {
    background: rgba(180,190,205,0.85);
    color: #111;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.05);
}

/* Light-mode player summary */
html.theme-light #epsScoreModal .eps-player-summary {
    background: rgba(245,248,252,0.90);
    color: #1a1a1a;
    box-shadow: 0 3px 10px rgba(0,0,0,0.20);
    border: 1px solid rgba(0,0,0,0.08);
}

html.theme-light #epsScoreModal .eps-player-label {
    color: #1a1a1a;
    text-shadow: none;
}

/* Light-mode Concede label */
html.theme-light #epsScoreModal .eps-concede-wrap label {
    color: rgba(0,0,0,0.65);
}

/* ----- DARK MODE (support multiple toggles, not just html.theme-dark) ----- */

:is(html.theme-dark,
    body.theme-dark,
    html.dark,
    body.dark,
    html.dark-mode,
    body.dark-mode,
    html.is-dark-theme,
    body.is-dark-theme,
    [data-theme="dark"],
    html[data-bs-theme="dark"],
    :root[data-bs-theme="dark"]) #epsScoreModal {
    background: rgba(13, 20, 41, 0.96);
}

:is(html.theme-dark,
    body.theme-dark,
    html.dark,
    body.dark,
    html.dark-mode,
    body.dark-mode,
    html.is-dark-theme,
    body.is-dark-theme,
    [data-theme="dark"],
    html[data-bs-theme="dark"],
    :root[data-bs-theme="dark"]) #epsScoreModal .modal-content {
    background: radial-gradient(
            circle at 30% 20%,
            rgba(16, 30, 58, 0.96) 0%,
            rgba(13, 20, 41, 0.96) 70%
    ) !important;
    color: #F0F0F0 !important;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
            0 0 25px rgba(0,0,0,0.5),
            inset 0 0 8px rgba(255,255,255,0.05);
}

/* Dark-mode header chip */
:is(html.theme-dark,
    body.theme-dark,
    html.dark,
    body.dark,
    html.dark-mode,
    body.dark-mode,
    html.is-dark-theme,
    body.is-dark-theme,
    [data-theme="dark"],
    html[data-bs-theme="dark"],
    :root[data-bs-theme="dark"]) #epsScoreModal .eps-player-summary {
    background: rgba(255,255,255,0.10);
    color: #fff;
}

:is(html.theme-dark,
    body.theme-dark,
    html.dark,
    body.dark,
    html.dark-mode,
    body.dark-mode,
    html.is-dark-theme,
    body.is-dark-theme,
    [data-theme="dark"],
    html[data-bs-theme="dark"],
    :root[data-bs-theme="dark"]) #epsScoreModal .eps-player-label {
    color: #fff;
}

/* Dark-mode hole pane */
:is(html.theme-dark,
    body.theme-dark,
    html.dark,
    body.dark,
    html.dark-mode,
    body.dark-mode,
    html.is-dark-theme,
    body.is-dark-theme,
    [data-theme="dark"],
    html[data-bs-theme="dark"],
    :root[data-bs-theme="dark"]) #epsScoreModal .eps-hole-pane {
    background: rgba(255,255,255,0.08);
}

/* Dark-mode Concede label */
:is(html.theme-dark,
    body.theme-dark,
    html.dark,
    body.dark,
    html.dark-mode,
    body.dark-mode,
    html.is-dark-theme,
    body.is-dark-theme,
    [data-theme="dark"],
    html[data-bs-theme="dark"],
    :root[data-bs-theme="dark"]) #epsScoreModal .eps-concede-wrap label {
    color: rgba(255,255,255,0.8);
}
/* ============================================================
   FIX: Modal inner pane background for light/dark theme
   ============================================================ */

/* Light Mode */
html.theme-light #epsScoreModal .eps-panel-body,
html.theme-light #epsScoreModal .modal-body,
html.theme-light #epsScoreModal .eps-hole-par-row,
html.theme-light #epsScoreModal .eps-player-pane {
    background: transparent !important; /* soft bluish-grey */
    color: var(--color-text);
    border-color: rgba(0,0,0,0.1);
}

/* Light-mode frosted styling for the two panes */
html.theme-light #epsScoreModal .eps-player-summary,
html.theme-light #epsScoreModal .eps-hole-pane {
    background: rgba(230,235,243,0.92) !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65), 0 6px 18px rgba(0,0,0,0.15) !important;
}

/* Dark Mode */
:is(html.theme-dark,
    body.theme-dark,
    html.dark,
    body.dark,
    html.dark-mode,
    body.dark-mode,
    html.is-dark-theme,
    body.is-dark-theme,
    [data-theme="dark"],
    html[data-bs-theme="dark"],
    :root[data-bs-theme="dark"]) #epsScoreModal .eps-panel-body,
:is(html.theme-dark,
    body.theme-dark,
    html.dark,
    body.dark,
    html.dark-mode,
    body.dark-mode,
    html.is-dark-theme,
    body.is-dark-theme,
    [data-theme="dark"],
    html[data-bs-theme="dark"],
    :root[data-bs-theme="dark"]) #epsScoreModal .modal-body,
:is(html.theme-dark,
    body.theme-dark,
    html.dark,
    body.dark,
    html.dark-mode,
    body.dark-mode,
    html.is-dark-theme,
    body.is-dark-theme,
    [data-theme="dark"],
    html[data-bs-theme="dark"],
    :root[data-bs-theme="dark"]) #epsScoreModal .eps-hole-par-row,
:is(html.theme-dark,
    body.theme-dark,
    html.dark,
    body.dark,
    html.dark-mode,
    body.dark-mode,
    html.is-dark-theme,
    body.is-dark-theme,
    [data-theme="dark"],
    html[data-bs-theme="dark"],
    :root[data-bs-theme="dark"]) #epsScoreModal .eps-player-pane {
    background: transparent;
    color: var(--color-text);
    border-color: rgba(255,255,255,0.15);
}
.eps-hole-nav-wrap {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.eps-hole-nav {
    border: none;
    background: transparent;
    padding: 0 0.25rem;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text, #333);
}

.eps-hole-nav:disabled {
    opacity: 0.35;
    cursor: default;
}

.eps-hole-circle {
    transition: opacity 0.15s ease;
}
/* Stack Par + Tee neatly */
.eps-par-tee-stack {
    display: flex;
    flex-direction: column;
    align-items: center;      /* centered under the hole number */
    gap: 4px;
    margin-top: 4px;
}

.eps-par-indicator {
    font-size: 0.9rem;
    font-weight: 600;
}

#eps-tee-note {
    font-size: 0.8rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
    text-transform: capitalize;
}
/* Cancel global theme hover effect for modal buttons */
#epsScoreModal button:hover,
#epsScoreModal button:focus,
#epsScoreModal [type=button]:hover,
#epsScoreModal [type=button]:focus,
#epsScoreModal [type=submit]:hover,
#epsScoreModal [type=submit]:focus {
    background-color: inherit !important;
    color: inherit !important;
    text-decoration: none !important;
}
/* Hole selector glow on hover/active */
.eps-hole-circle:hover,
.eps-hole-circle.fade {
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 6px rgba(255,255,255,0.25);
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

/* --- Props Panel (Greenies/Birdies/Sandies) --- */
#epsScoreModal .eps-props-wrap {
    min-width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-self: center;
    position: relative;
}

#epsScoreModal .eps-props-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    line-height: 1.15;
    font-size: 0.82rem;
    cursor: pointer;
}

#epsScoreModal .eps-props-toggle input {
    transform: scale(1.3);
    margin: 0;
    accent-color: var(--eps-site-green, #10b981);
    cursor: pointer;
}

#epsScoreModal .eps-props-toggle label {
    cursor: pointer;
    color: rgba(255,255,255,0.8);
}

#epsScoreModal .eps-props-panel {
    display: none;
    position: fixed;
    top: 50%;
    right: 210px;
    margin-right: -140px;
    transform: translateY(-50%);
    width: 260px;
    max-width: 90vw;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.05);
    z-index: 10000;
    padding: 1rem;
    color: #333;
}

html.theme-dark #epsScoreModal .eps-props-panel,
body.theme-dark #epsScoreModal .eps-props-panel {
    background: #1f2937;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
}

#epsScoreModal .eps-props-panel[aria-hidden="false"] {
    display: block;
    animation: eps-pop-in 0.2s ease-out;
}

#epsScoreModal .eps-props-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}
html.theme-dark #epsScoreModal .eps-props-head { border-bottom-color: rgba(255,255,255,0.1); }

#epsScoreModal .eps-props-title {
    font-weight: 700;
    font-size: 1rem;
}

#epsScoreModal .eps-props-items {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

#epsScoreModal .eps-prop-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
}

#epsScoreModal .eps-prop-row input {
    transform: scale(1.4);
    accent-color: var(--eps-site-green, #10b981);
}

#epsScoreModal .btn-props-save {
    width: 100%;
    padding: 0.6rem;
    border-radius: 8px;
    background: var(--eps-site-green, #10b981);
    color: #fff;
    font-weight: 600;
    border: none;
    cursor: pointer;
}
#epsScoreModal .btn-props-save:hover {
    filter: brightness(1.1);
}

@media (max-width: 480px) {
    #epsScoreModal .eps-props-panel {
        right: 50%;
        margin-right: -140px;
    }
}




/* =========================================================
   UI TWEAKS (Enter Score Button)
   ========================================================= */

/* Revert to vertical stack: Field top, Button bottom */
#epsScoreModal .eps-score-entry {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

/* Make the button square-ish with stacked text */
#epsScoreModal .btn-save {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.15;
}
#epsScoreModal .btn-save:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

/* Square Input to match Button width */
#epsScoreModal #eps-score {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    padding: 0;
    text-align: center;
    font-size: 1.6rem;
    line-height: 60px; /* Center text vertically */
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.12);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
/* Hide spinners */
#epsScoreModal #eps-score::-webkit-outer-spin-button,
#epsScoreModal #eps-score::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#epsScoreModal #eps-score[type=number] {
  -moz-appearance: textfield;
}

/* Aux Column (Props + Concede) */
#epsScoreModal .eps-aux-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    min-width: 80px;
}

/* Ensure CTP wrap also aligns well */
#epsScoreModal .eps-ctp-wrap {
    justify-content: flex-start; /* Align top with others */
}


/* =========================================================
   PROPS TOGGLE STYLING (Circular Button)
   ========================================================= */

#epsScoreModal #eps-props-wrap {
    display: none; /* Hidden by default to prevent flash */
}

#epsScoreModal .eps-props-toggle {
    position: relative;
    display: flex;
    justify-content: center;
}

#epsScoreModal .eps-props-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

#epsScoreModal .eps-props-toggle label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #64a2f2;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1;
    user-select: none;
}

#epsScoreModal .eps-props-toggle label:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

#epsScoreModal .eps-props-toggle input:checked + label {
    /* Visual feedback when active/panel open */
    background: #4a8ed4;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 0 0 2px rgba(255,255,255,0.8);
}

/* Ensure Concede toggle aligns nicely below */
#epsScoreModal .eps-concede-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: 0.7rem;
}
#epsScoreModal .eps-aux-wrap {
    padding-top: 0.25rem; /* Align top with CTP checkbox */
}

/* Hide the CTP Edit link */
#epsScoreModal #eps-ctp-edit {
    display: none !important;
}

/* [FIX] Mobile Scorecard Floating & Scroll Issue */
@media (max-width: 768px) {
    #eps-scorecard-container {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        float: none !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}
