
/* Scroll Fix */
.scorecard-scroll-wrapper {
    overflow-x: auto !important;
    width: 100%;
    padding-bottom: 10px;
}

/* ============================================================
   UNIVERSAL 5-COLUMN GRID FOR SCORECARD
   ============================================================ */

.manual-player-row,
.manual-summary-row {
    display: grid;
    grid-template-columns: 172px 68px 68px 68px 68px;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

/* Player select / Blind label */
.manual-player-row select,
.manual-player-row span,
.summary-label {
    width: 100%;
    font-weight: 700;
    white-space: nowrap;
}

/* Score fields */
.manual-player-row input,
.manual-summary-row input {
    width: 100%;
    text-align: center;
}

/* TEAM A — normal grid order */
.team-left .manual-player-row,
.team-left .manual-summary-row {
    direction: ltr;
}

.team-right .manual-player-row,
.team-right .manual-summary-row {
    grid-template-columns: 68px 68px 68px 68px 172px !important;
}

/* But keep text inside inputs normal */
.team-right input,
.team-right select,
.team-right span {
    direction: ltr !important;
}

/* Summary label alignment */
.team-left .summary-label {
    text-align: left;
}

.team-right .summary-label {
    text-align: right;
}

/* FORCE GRID — override Bootstrap flexbox */
.manual-player-row,
.manual-summary-row {
    display: grid !important;
    grid-template-columns: 172px 68px 68px 68px 68px;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

/* Remove Bootstrap spacing overrides */
.manual-player-row > *,
.manual-summary-row > * {
    margin: 0 !important;
}

/* Prevent Bootstrap table cell flex inheritance */
.team-cell div {
    display: block !important;
}

/* ============================================
   SCORECARD INPUT RESET — override Bootstrap
   ============================================ */

.manual-player-row input,
.manual-player-row select,
.manual-summary-row input {
    height: 34px !important;
    padding: 4px 6px !important;
    font-size: 0.95rem !important;
    line-height: 1 !important;
    border-radius: 4px !important;
    display: block !important;
    width: 100% !important;
}

/* Remove Bootstrap's huge spacing */
.manual-player-row .form-control,
.manual-summary-row .form-control,
.manual-player-row .form-select {
    margin: 0 !important;
}

/* Tighten selects */
.manual-player-row select {
    padding-right: 24px !important;
}

/* Make summary rows match */
.manual-summary-row input {
    height: 34px !important;
}

/* Optional: slightly smaller font for cleaner look */
.manual-player-row input,
.manual-player-row select {
    font-size: 0.9rem !important;
}

/* ============================================
   SCORECARD INPUT RESET — override Bootstrap
   ============================================ */

.manual-player-row input,
.manual-player-row select,
.manual-summary-row input {
    height: 32px !important;
    padding: 4px 6px !important;
    font-size: 0.9rem !important;
    line-height: 1 !important;
    border-radius: 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Remove Bootstrap spacing */
.manual-player-row .form-control,
.manual-player-row .form-select,
.manual-summary-row .form-control {
    margin: 0 !important;
}

/* Tighten selects */
.manual-player-row select {
    padding-right: 20px !important;
}

/* Summary rows match player rows */
.manual-summary-row input {
    height: 32px !important;
}

/* Fix label alignment */
.summary-label {
    display: flex;
    align-items: center;
    font-weight: 700;
}

.manual-player-row,
.manual-summary-row {
    display: grid !important;
    grid-template-columns: 172px 68px 68px 68px 68px !important;
    align-items: center;
    gap: 6px;
}

.scorecard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.match-pill {
    display: flex;
    justify-content: center;
}

.match-pill .pill {
    background: #0d6efd; /* or your theme color */
    color: white;
    padding: 8px 20px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* ============================================================
   MOBILE: STACK PLAYER ROWS BUT KEEP TEAM A LEFT / TEAM B RIGHT
   ============================================================ */

@media (max-width: 700px) {

    /* Keep two columns on mobile */
    .scorecard-grid {
        display: grid;
        grid-template-columns: 1fr 1fr !important;
        gap: 20px;
    }

    /* Each player row becomes a vertical stack */
    .manual-player-row {
        display: grid !important;
        grid-template-columns: 1fr !important;
        grid-template-areas:
            "player"
            "gross"
            "hcp"
            "net"
            "points";
        gap: 8px !important;
        padding: 10px 0;
        border-bottom: 1px solid #ddd;
    }

    /* Assign grid areas */
    .manual-player-row select,
    .manual-player-row span {
        grid-area: player;
    }

    .gross-input  { grid-area: gross; }
    .hcp-input    { grid-area: hcp; }
    .net-input    { grid-area: net; }
    .points-input { grid-area: points; }

    /* Inputs full width */
    .manual-player-row select,
    .manual-player-row input {
        width: 100% !important;
        font-size: 16px !important; /* Prevent iPhone zoom */
    }

    /* Summary rows also stack but stay in their column */
    .manual-summary-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        padding: 10px 0;
    }

    .manual-summary-row .summary-label {
        grid-column: span 2;
        text-align: center !important;
        font-size: 1rem;
    }
}

/* ============================================================
   EXTRA SMALL SCREENS (iPhone SE)
   ============================================================ */

@media (max-width: 480px) {
    .scorecard-grid {
        grid-template-columns: 1fr !important; /* Only stack teams on tiny screens */
    }
}

/* FORCE GRID — override Bootstrap flexbox */
.scorecard-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px;
}

.team-card {
    width: 100% !important;
    flex: none !important;
}

/* FIX TEAM B NARROW COLUMN ON MOBILE */
@media (max-width: 700px) {
    .team-right .manual-player-row,
    .team-right .manual-summary-row {
        grid-template-columns: 1fr !important;
    }
}

/* Prevent Bootstrap from shrinking Team B column */
.team-card {
    width: 90% !important;
    flex: none !important;
    max-width: none !important;
}

/* FIX SUMMARY ROWS ON MOBILE */
@media (max-width: 700px) {

    /* Stack summary rows cleanly for BOTH teams */
    .manual-summary-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        padding: 10px 0;
    }

    /* Label spans full width */
    .manual-summary-row .summary-label {
        grid-column: span 2;
        text-align: center !important;
        font-size: 1rem;
        margin-bottom: 5px;
    }

    /* Kill Team B’s mirrored desktop grid */
    .team-right .manual-summary-row {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* ============================================================
   MOBILE: Force summary label to appear on TOP for BOTH teams
   ============================================================ */

@media (max-width: 700px) {

    /* Stack summary rows */
    .manual-summary-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    /* Force label to be first element */
    .manual-summary-row .summary-label {
        order: -1 !important;   /* Move label to the top */
        grid-column: span 2 !important;
        text-align: center !important;
        margin-bottom: 5px;
    }
}

/* ============================================================
   FINAL FIX: Align Net/Pts rows across Team A and Team B
   ============================================================ */

@media (max-width: 700px) {

    .manual-summary-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-areas:
            "label label"
            "net pts";
        gap: 10px !important;
        padding: 10px 0 !important;
        align-items: center !important;
    }

    /* Label always first */
    .manual-summary-row .summary-label {
        grid-area: label !important;
        margin-bottom: 5px !important;
        text-align: center !important;
    }

    /* FIRST input = Net */
    .manual-summary-row input:nth-of-type(1) {
        grid-area: net !important;
    }

    /* SECOND input = Pts */
    .manual-summary-row input:nth-of-type(2) {
        grid-area: pts !important;
    }

    /* Kill Team B mirrored desktop grid */
    .team-right .manual-summary-row {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* Make Save + Submit buttons bigger and more visible */
.scorecard-actions .btn-lg {
    padding: 18px 32px !important;
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
}

/* Fix scorecard centering on desktop */
@media (min-width: 992px) {
    .page-wrapper {
        max-width: 1200px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .universal-scorecard {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
}
/* Center the grid inside each team card */
.team-card .manual-player-row,
.team-card .manual-summary-row {
    margin-left: auto;
    margin-right: auto;
    justify-content: center;   /* center the 5 fixed-width columns as a block */
}

.team-card .team-header {
    display: block;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
    font-size: 1.6rem !important;
    font-weight: 800 !important;
}

/* ============================================================
   PHONE SCORE ENTRY: ONE MATCH COLUMN, FAST THUMB INPUT
   ============================================================ */

@media (max-width: 900px) {
    .universal-scorecard {
        width: 100%;
        max-width: 560px;
        margin: 0 auto;
    }

    .scorecard-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .team-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 14px 12px !important;
        border-radius: 10px !important;
        position: relative;
        overflow: visible !important;
    }

    .team-left {
        border-top: 6px solid #0f7a3a;
    }

    .team-right {
        border-top: 6px solid #175cd3;
    }

    .team-card .team-header {
        position: sticky;
        top: 6px;
        z-index: 12;
        margin-bottom: 12px !important;
        padding: 10px 12px;
        border-radius: 999px;
        color: #ffffff;
        font-size: 1.25rem !important;
        line-height: 1.15;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    }

    .team-left .team-header {
        background: #0f7a3a;
    }

    .team-right .team-header {
        background: #175cd3;
    }

    .manual-player-row,
    .team-right .manual-player-row {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        grid-template-areas:
            "player player player player"
            "gross hcp net points" !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
        padding: 10px !important;
        border: 1px solid #d7dde3;
        border-radius: 8px;
        background: #ffffff;
    }

    .team-left .manual-player-row,
    .team-left .manual-summary-row {
        border-left: 4px solid rgba(15, 122, 58, 0.45);
    }

    .team-right .manual-player-row,
    .team-right .manual-summary-row {
        border-left: 4px solid rgba(23, 92, 211, 0.45);
    }

    .manual-player-row select,
    .manual-player-row span {
        grid-area: player !important;
        min-width: 0 !important;
        width: 100% !important;
        font-size: 16px !important;
        font-weight: 800 !important;
    }

    .gross-input { grid-area: gross !important; }
    .hcp-input { grid-area: hcp !important; }
    .net-input { grid-area: net !important; }
    .points-input { grid-area: points !important; }

    .manual-player-row input,
    .manual-player-row select,
    .manual-summary-row input {
        min-height: 44px !important;
        height: 44px !important;
        padding: 6px 8px !important;
        border-radius: 7px !important;
        font-size: 16px !important;
    }

    .manual-player-row input {
        font-weight: 700 !important;
    }

    .manual-summary-row,
    .team-right .manual-summary-row {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-template-areas:
            "label label"
            "net pts" !important;
        gap: 8px !important;
        margin-bottom: 8px !important;
        padding: 10px !important;
        border-radius: 8px;
    }

    .manual-summary-row .summary-label {
        grid-area: label !important;
        justify-content: center;
        text-align: center !important;
        font-size: 0.98rem !important;
        line-height: 1.15;
    }

    .manual-summary-row .summary-net-input {
        grid-area: net !important;
    }

    .manual-summary-row .summary-points-input {
        grid-area: pts !important;
    }

    .manual-summary-row > div:not(.summary-label) {
        display: none !important;
    }

    .scorecard-actions {
        position: sticky;
        bottom: 0;
        z-index: 20;
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 10px !important;
        margin: 14px -8px 0 !important;
        padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.94);
        border-top: 1px solid rgba(0, 0, 0, 0.12);
        backdrop-filter: blur(6px);
    }

    .scorecard-actions .btn-lg {
        width: 100%;
        min-height: 54px;
        padding: 12px 16px !important;
        font-size: 1.05rem !important;
        border-radius: 10px !important;
    }
}

@media (max-width: 420px) {
    .team-card {
        padding: 12px 8px !important;
    }

    .manual-player-row {
        padding: 8px !important;
        gap: 6px !important;
    }

    .manual-player-row input,
    .manual-summary-row input {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }
}

/* ============================================================
   2026 SCORECARD POLISH LAYER
   ============================================================ */

.universal-scorecard,
.view-scorecard {
    background: transparent !important;
}

.scorecard-grid {
    gap: 18px !important;
}

.team-card {
    background: #ffffff !important;
    border: 1px solid #c7d5c4 !important;
    border-radius: 8px !important;
    box-shadow: 0 3px 10px rgba(18, 48, 34, 0.14) !important;
}

.team-left {
    border-top: 4px solid #197650 !important;
}

.team-right {
    border-top: 4px solid #285c86 !important;
}

.team-card .team-header {
    color: #152b20 !important;
}

.manual-player-row,
.manual-summary-row,
.view-player-row,
.view-summary-row {
    border-color: #c7d5c4 !important;
    border-radius: 8px !important;
    background: #fbfcfa !important;
}

.manual-player-row input,
.manual-player-row select,
.manual-summary-row input {
    border: 1px solid #cfdace !important;
    border-radius: 7px !important;
    background: #ffffff !important;
}

.manual-player-row input:focus,
.manual-player-row select:focus,
.manual-summary-row input:focus {
    border-color: #197650 !important;
    box-shadow: 0 0 0 2px rgba(25, 118, 80, 0.16) !important;
    outline: none;
}

.scorecard-actions {
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid #c7d5c4 !important;
    border-radius: 8px !important;
    box-shadow: 0 3px 10px rgba(18, 48, 34, 0.14) !important;
}

.scorecard-order-warning {
    margin: 16px auto 0;
    max-width: 900px;
    padding: 12px 14px;
    border: 1px solid #d9a3a3;
    border-radius: 8px;
    background: #fff4f4;
    color: #7b1c1c;
    font-weight: 700;
    line-height: 1.35;
}

.scorecard-actions .btn-lg {
    border-radius: 8px !important;
}

@media (max-width: 900px) {
    .team-card .team-header {
        border-radius: 8px !important;
        box-shadow: none !important;
    }

    .team-left .team-header {
        background: #197650 !important;
        color: #ffffff !important;
    }

    .team-right .team-header {
        background: #285c86 !important;
        color: #ffffff !important;
    }
}

