/**
 * Live Scoring CSS
 *
 * Styles for the game scoring UI: stepper controls, hole navigation,
 * scorecard grid, mini leaderboard, and score color coding.
 */

/* ============================================
 * SCORE STEPPER
 * ============================================ */

.score-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.score-stepper-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--psp-border);
    background: var(--psp-bg-white);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--psp-transition-fast),
                border-color var(--psp-transition-fast);
    color: var(--psp-text-dark);
    padding: 0;
    line-height: 1;
}

.score-stepper-btn:hover {
    background-color: var(--psp-bg-light);
    border-color: var(--psp-green);
}

.score-stepper-btn:active {
    background-color: var(--psp-green);
    color: white;
}

.score-stepper-value {
    font-size: 3rem;
    font-weight: 700;
    min-width: 80px;
    text-align: center;
    line-height: 1;
}

/* ============================================
 * SCORE COLOR CLASSES
 * ============================================ */

.score-eagle {
    color: #d4a017;
    font-weight: 700;
}

.score-birdie {
    color: var(--psp-green);
    font-weight: 700;
}

.score-par {
    color: var(--psp-text-muted);
}

.score-bogey {
    color: var(--psp-red);
    font-weight: 600;
}

.score-double-bogey {
    color: var(--psp-red);
    font-weight: 700;
}

/* Scorecard cell backgrounds */
.score-cell-eagle {
    background-color: #fff3cd;
    color: #856404;
    font-weight: 700;
}

.score-cell-birdie {
    background-color: #d1e7dd;
    color: #0a3622;
    font-weight: 700;
}

.score-cell-par {
    background-color: transparent;
}

.score-cell-bogey {
    background-color: #f8d7da;
    color: #58151c;
    font-weight: 600;
}

.score-cell-double-bogey {
    background-color: #f1aeb5;
    color: #58151c;
    font-weight: 700;
}

/* ============================================
 * HOLE NAVIGATION DOTS
 * ============================================ */

.hole-nav {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
    padding: 0.75rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hole-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--psp-border);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background-color var(--psp-transition-fast),
                transform var(--psp-transition-fast);
}

.hole-dot:hover {
    transform: scale(1.3);
}

.hole-dot-scored {
    background-color: var(--psp-green);
}

.hole-dot-active {
    background-color: var(--psp-blue);
    transform: scale(1.4);
}

/* ============================================
 * HOLE NAVIGATION ARROWS
 * ============================================ */

.hole-arrows {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.hole-arrow-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--psp-border);
    background: var(--psp-bg-white);
    border-radius: var(--psp-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--psp-transition-fast);
}

.hole-arrow-btn:hover {
    background-color: var(--psp-bg-light);
}

.hole-arrow-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
 * MINI LEADERBOARD
 * ============================================ */

.mini-leaderboard {
    position: sticky;
    bottom: 0;
    background: var(--psp-bg-white);
    border-top: 2px solid var(--psp-border);
    padding: 0.75rem 1rem;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    z-index: var(--psp-z-sticky);
}

.mini-leaderboard-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.875rem;
}

.mini-leaderboard-pos {
    font-weight: 700;
    width: 24px;
    color: var(--psp-text-muted);
}

.mini-leaderboard-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-leaderboard-score {
    font-weight: 700;
    min-width: 48px;
    text-align: right;
}

/* ============================================
 * SCORECARD GRID
 * ============================================ */

.scorecard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    table-layout: fixed;
}

.scorecard-table th,
.scorecard-table td {
    padding: 4px 2px;
    text-align: center;
    border: 1px solid var(--psp-border);
    vertical-align: middle;
}

.scorecard-table thead th {
    background-color: var(--psp-bg-light);
    font-weight: 600;
    font-size: 0.75rem;
}

.scorecard-table .scorecard-hole-header {
    background-color: var(--psp-green);
    color: white;
    font-weight: 700;
}

.scorecard-table .scorecard-par-row td {
    background-color: var(--psp-bg-light);
    font-weight: 600;
}

.scorecard-table .scorecard-subtotal {
    background-color: #e9ecef;
    font-weight: 700;
}

.scorecard-table .scorecard-player-name {
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

/* Best-ball "used" score highlight (blind draw scorecards) */
.scorecard-used-score {
    font-weight: 700;
    text-decoration: underline;
}

/* Handicap stroke indicator dot (bottom-right corner of cell) */
.scorecard-stroke-dot {
    position: relative;
}

.scorecard-stroke-dot::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 5px;
    height: 5px;
    background-color: #000;
    border-radius: 50%;
}

/* ============================================
 * LOBBY
 * ============================================ */

.lobby-group {
    border: 1px solid var(--psp-border);
    border-radius: var(--psp-radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--psp-bg-white);
}

.lobby-group-header {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--psp-text-dark);
}

.lobby-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--psp-border);
}

.lobby-player:last-child {
    border-bottom: none;
}

.lobby-player-name {
    font-weight: 500;
}

.lobby-player-handicap {
    color: var(--psp-text-muted);
    font-size: 0.875rem;
}

.lobby-group-team-score {
    background-color: var(--psp-bg-light);
    border-radius: var(--psp-radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* ============================================
 * COLLAPSIBLE GROUP CARDS
 * ============================================ */

.lobby-group-details {
    border: 1px solid var(--psp-border);
    border-radius: var(--psp-radius-lg);
    margin-bottom: 1rem;
    background: var(--psp-bg-white);
}

.lobby-group-details > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 1rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-weight: 600;
    font-size: 1rem;
}

.lobby-group-details > summary::-webkit-details-marker {
    display: none;
}

.lobby-group-details > summary::after {
    content: '\25B8';
    font-size: 0.875rem;
    color: var(--psp-text-muted);
    transition: transform var(--psp-transition-fast);
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.lobby-group-details[open] > summary::after {
    transform: rotate(90deg);
}

.lobby-group-summary-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.lobby-group-summary-score {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
    font-size: 0.875rem;
    margin-left: auto;
    padding-left: 0.75rem;
}

.lobby-group-body {
    padding: 0 1rem 1rem;
}

/* ============================================
 * STICKY BOTTOM BAR
 * ============================================ */

.lobby-bottom-bar {
    position: sticky;
    bottom: 0;
    background: var(--psp-bg-white);
    padding: 0.75rem 0;
    z-index: var(--psp-z-sticky);
    border-top: 1px solid var(--psp-border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

/* ============================================
 * LEADERBOARD
 * ============================================ */

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--psp-border);
}

.leaderboard-table thead th {
    background-color: var(--psp-bg-light);
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 2px solid var(--psp-border);
}

.leaderboard-pos {
    font-weight: 700;
    text-align: center;
    width: 40px;
}

.leaderboard-name {
    font-weight: 500;
}

.leaderboard-thru {
    color: var(--psp-text-muted);
    text-align: center;
}

.leaderboard-score {
    font-weight: 700;
    text-align: right;
}

.leaderboard-to-par-under {
    color: var(--psp-green);
}

.leaderboard-to-par-over {
    color: var(--psp-red);
}

.leaderboard-to-par-even {
    color: var(--psp-text-muted);
}

/* ============================================
 * HOLE HEADER
 * ============================================ */

.hole-header {
    text-align: center;
    padding: 1rem 0;
}

.hole-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--psp-text-dark);
}

.hole-info {
    font-size: 0.875rem;
    color: var(--psp-text-muted);
}

/* ============================================
 * GROUP SCORING STEPPER
 * ============================================ */

.group-stepper-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--psp-border);
}

.group-stepper-row:last-of-type {
    border-bottom: none;
}

.group-stepper-name {
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-stepper-row .score-stepper {
    gap: 0.75rem;
}

.score-stepper-btn-sm {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
}

.score-stepper-value-sm {
    font-size: 2rem;
    min-width: 50px;
}

/* ============================================
 * RESPONSIVE
 * ============================================ */

/* ============================================
 * EVENT TOASTS
 * ============================================ */

.game-toast-container {
    position: fixed;
    bottom: 0;
    right: 0;
    padding: 1rem;
    z-index: 1080;
}

.game-toast-container.notifications-muted {
    display: none;
}

.game-toast {
    background: white;
    border-radius: var(--psp-radius-md);
    box-shadow: var(--psp-shadow-card);
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    animation: toast-in 0.3s ease, toast-out 0.3s ease 4.7s forwards;
    max-width: 320px;
}

.game-toast-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.game-toast-body {
    font-weight: 500;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ============================================
 * OFFLINE BANNER
 * ============================================ */

#offline-banner {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--psp-radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #664d03;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* ============================================
 * PUSH TOGGLE
 * ============================================ */

.push-toggle {
    padding: 0.25rem 0.4rem;
    line-height: 1;
}

.push-toggle svg {
    vertical-align: middle;
}

.push-toggle-active {
    background-color: var(--psp-green);
    border-color: var(--psp-green);
    color: white;
}

.push-toggle-active:hover {
    background-color: var(--psp-green-dark);
    border-color: var(--psp-green-dark);
    color: white;
}

/* ============================================
 * RESPONSIVE
 * ============================================ */

/* ============================================
 * GAME CHAT
 * ============================================ */

.chat-picker-label {
    font-size: 0.95rem;
    color: var(--psp-text-dark);
}

.chat-box {
    border: 1px solid var(--psp-border);
    border-radius: var(--psp-radius-lg);
    padding: 0.75rem 1rem;
    background: var(--psp-bg-white);
}

.chat-messages {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem 0;
    border-top: 1px solid var(--psp-border);
    border-bottom: 1px solid var(--psp-border);
}

.chat-msg {
    margin-bottom: 0.375rem;
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.chat-msg:last-child {
    margin-bottom: 0;
}

.chat-msg-other {
    align-items: flex-start;
    align-self: flex-start;
}

.chat-msg-own {
    align-items: flex-end;
    align-self: flex-end;
    margin-left: auto;
}

.chat-msg-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--psp-text-muted);
    margin-bottom: 0.125rem;
}

.chat-msg-body {
    display: inline-block;
    padding: 0.375rem 0.625rem;
    border-radius: var(--psp-radius-md);
    font-size: 0.875rem;
    line-height: 1.35;
    word-break: break-word;
}

.chat-msg-other .chat-msg-body {
    background-color: var(--psp-bg-light);
    color: var(--psp-text-dark);
}

.chat-msg-own .chat-msg-body {
    background-color: var(--psp-green);
    color: white;
}

.chat-input-row .chat-input {
    font-size: 0.875rem;
}

.chat-switch-link {
    text-decoration: none;
}

.chat-switch-link:hover {
    text-decoration: underline;
}

@media (max-width: 576px) {
    .scorecard-table {
        font-size: 0.7rem;
    }

    .scorecard-table th,
    .scorecard-table td {
        padding: 3px 1px;
    }

    .score-stepper-value {
        font-size: 2.5rem;
    }
}
