/*!
 * Copyright © 2024 Spotlite (https://spotlite.com)
 * This stylesheet is part of the Spotlite tournament system.
 * Unauthorized reproduction or redistribution is prohibited.
 */

/* 컨테이너 스타일 */
.live-table-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

@media (max-width: 600px) {
    .live-table-container {
        padding: 0;
    }
}

/* 상단 날짜/코트 선택기 */
.date-selector, .court-selector {
    display: flex;
    gap: 5px;
    font-size: .9rem;
    overflow-x: auto;
    padding: 8px 0;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; 
}

.date-btn, .court-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-color);
    background-color: var(--bg-color);
    font-size: 0.9em;
    position: relative;
}

.court-btn {
    position: relative;
    margin-top: 0;
    padding-top: 10px;
}

.date-btn:hover, .court-btn:hover {
    background-color: #f0f0f0;
}

.date-btn.active, .court-btn.active {
    background-color: var(--secondary-color);
    color: white;
}

.pending-badge {
    position: absolute;
    top: -6px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7em;
    z-index: 99;
}

/* 섹션 타이틀 */
.court-title {
    color: var(--text-color);
    margin-bottom: 15px;
    margin-top: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    margin-bottom: 15px;
    margin-top: 30px;
}

.start-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(45deg, var(--primary-color), var(--primary-hover-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.start-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.start-button:active {
    transform: translateY(0);
}

.start-button svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.start-button:hover svg {
    transform: scale(1.1);
}

.court-title h2 {
    font-size: 1.5em;
}

/* 테이블 스타일 */
.table-responsive {
    cursor: grab;
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    margin-bottom: 24px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.match-table {
    width: 100%;
    min-width: 600px;
    table-layout: auto;
    border-collapse: collapse;
    background-color: #fff;
}

.match-table th {
    background-color: var(--primary-color-10);
    color: var(--primary-color);
    padding: 12px;
    text-align: center;
    font-weight: 500;
    border: 1px solid #ddd;
    word-break: keep-all;
}

.match-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: center;
    word-break: keep-all;
}

.match-table td.score-cell {
    padding: 0;
}
    
.match-cards {
    display: none;
}

/* 검색 및 필터 영역 */
.query-container {
    display: flex;
    gap: 16px;
    margin: 20px 0;
}

.division-select-form select,
.search-form input {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    min-width: 200px;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-button {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

/* referee input 수정 */
.referee-input {
    border: none;
    background: transparent;
    font-size: inherit;
    color: inherit;
    outline: none;
    text-align: center;
    width: 100%;
    max-width: 100px;
    padding: 4px;
}

.referee-input:focus {
    background-color: rgba(0, 0, 0, 0.02);
}

/* 성별 라벨 수정 */
.gender-label {
    display: inline-block;
    font-size: 0.8em;
    padding: 2px 5px;
    border-radius: 3px;
    margin-right: 2px;
}

.gender-label.gender-male {
    border: 1px solid #6991ff;
    color: #6991ff;
}

.gender-label.gender-female {
    border: 1px solid #ff69b4;
    color: #ff69b4;
}

.gender-label.gender-mixed {
    border: 1px solid #8a8a8a;
    color: #8a8a8a;
}

/* 승자 표시 */
.winner {
    color: white !important;
    background-color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
}

/* 검색 결과 하이라이트 */
.searched:not(.winner) {
    background-color: rgba(34, 86, 178, 0.1);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 4px;
    margin: auto;
    font-weight: 500;
}

/* 상태 표시 */
.running {
    font-size: 14px;
    color: var(--success-color);
}

.ready {
    font-size: 14px;
    color: var(--info-color);
}

.end {
    font-size: 14px;
    color: var(--danger-color);
    cursor: pointer;
}

.match-type {
    font-size: 12px;
}

@media screen and (max-width: 600px) {
    .start-button {
        right: 0;
    }
    
    .instruction-text {
        display: block;
        margin-top: 8px;
    }

    .match-table {
        display: none;
    }

    .waiting-table,
    .running-table {
        display: table;
    }
    
    .match-cards {
        display: block;
    }

    .match-card {
        background: white;
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }

    .match-header {
        display: flex;
        align-items: center;
        margin-bottom: 12px;
        gap: 12px;
        white-space: nowrap;
    }

    .match-time {
        font-size: 1.1rem;
        font-weight: bold;
    }

    .match-title {
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: 14px;
        text-wrap: nowrap;
        overflow: hidden;
    }

    .match-name {
        text-wrap: auto;
    }

    .match-type {
        display: inline-block;
        padding: 4px 8px;
        border-radius: 4px;
    }

    .match-type.gender-male {
        background: #e3f2fd;
        color: #1a73e8;
    }

    .match-type.gender-female {
        background: #fde3f7;
        color: #e81ad7;
    }

    .match-court {
        color: #666;
        font-size: 14px;
        margin-left: auto;
    }

    .match-teams {
        display: flex;
        justify-content: space-between;
        padding-top: 7px;
        border-top: 1px solid #eee;
    }

    .team {
        flex: 1;
        text-align: center;
    }

    .team-title {
        color: #666;
        font-size: 14px;
        margin-bottom: 8px;
        font-weight: 600;
    }

    .team-players {
        font-size: 15px;
        line-height: 1.4;
        padding: 5px 0;
    }

    .vs-divider {
        display: flex;
        align-items: center;
        padding: 0 12px;
        color: #999;
        font-weight: 600;
        font-size: 14px;
    }

    .score-cell {
        text-align: center;
        background-color: var(--bg-heavy-light);
        padding: 6px 5px;
        border-radius: 5px;
        margin-top: 10px;
        font-size: 14px;
        min-height: 30px;
        cursor: pointer;
    }

    .running, .ready, .end {
        font-size: 12px;
    }

    .match-cards div[data-match-type="running"] {
        border: 1px solid var(--text-muted);
    }

    .match-cards div[data-match-type="waiting"] {
        border: 1px solid var(--info-color);
    }

    .query-container {
        flex-direction: column;
        gap: 10px;
    }

    .division-select-form select,
    .search-form input {
        width: 100%;
    }

    .match-referee {
        text-align: center;
        background-color: var(--bg-heavy-light);
        padding: 6px 5px;
        border-radius: 5px;
        margin-top: 10px;
        font-size: 14px;
    }
}

/* 모바일 대응 - 원래 스타일로 복원 */
@media (max-width: 500px) {
    .court-btn, .date-btn,
    .match-table th,
    .match-table td,
    .instruction-text,
    .division-select-form select,
    .search-form input {
        font-size: 13px;
    }

    .team-players {
        font-size: 14px;
        line-height: 1.4;
        padding: 5px 0;
    }
}

/* 버튼 스타일 */
[class^="referee-actions-"] {
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn {
    border: 0;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
}

.accepted-btn {
    background-color: var(--primary-color);
    color: white;
    margin: 3px;
}

.denied-btn {
    background-color: var(--text-muted);
    color: white;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: white;
    margin-top: 20px;
    font-size: 1.2em;
}

.hidden {
    display: none !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 스크롤바 공통 스타일 */
.court-selector::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    height: 4px;
}

.court-selector::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.court-selector::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.court-selector::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* 세로 스크롤바 스타일 (테이블용) */
.table-responsive::-webkit-scrollbar {
    width: 6px;  /* 세로 스크롤바는 조금 더 넓게 */
    height: 6px; /* 가로 스크롤바도 동일하게 */
}

/* Firefox 스크롤바 스타일링 */
.court-selector,
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: #ddd #f1f1f1;
}

.available-matches-dialog {
    padding: 0;
    margin: auto;
    max-width: 90%;
    max-height: 85vh;
    width: 900px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.dialog-title-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.show-all-court-matches {
    padding: 6px 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease;
}

.show-all-court-matches:hover {
    background-color: var(--primary-hover-color);
}

.show-all-court-matches svg {
    width: 16px;
    height: 16px;
}

.dialog-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    border-radius: 12px 12px 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.dialog-header h2 {
    font-size: 20px;
    color: var(--text-color);
    margin: 0;
}

.matches-content {
    padding: 20px 24px;
    overflow-y: auto;
    max-height: calc(85vh - 140px);
}

.match-section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.header-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 4px 0;
}

.section-description {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

.match-count {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-light);
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.table-container {
    background: white;
    border-radius: 8px;
    overflow: auto;
    border: 1px solid var(--border-color);
}

.dialog-matches-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 743px;
}

.dialog-matches-table th {
    background: var(--bg-light);
    font-weight: 500;
    color: var(--text-color);
    text-align: left;
    padding: 12px 16px;
    font-size: 14px;
    white-space: nowrap;
}

.dialog-matches-table td {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 14px;
}

.match-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.match-row:hover {
    background-color: var(--bg-heavy-light);
}

.continuous-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #1a459021;
    color: #1a4590;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    margin-right: 4px;
}

.continuous-badge:last-child {
    margin-right: 0;
}

.time-cell {
    width: 80px;
    font-family: monospace;
    color: var(--text-muted);
}

.court-cell {
    width: 50px;
    text-align: center;
}

.participant-cell {
    width: 150px;
    line-height: 1.5;
}

.participant-cell br {
    content: "";
    display: block;
    margin: 2px 0;
}

.no-matches {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    background: var(--bg-light);
    border-radius: 8px;
    font-size: 14px;
}

.dialog-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    text-align: right;
    background: var(--bg-color);
    border-radius: 0 0 12px 12px;
    position: sticky;
    bottom: 0;
}

.close-button {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: white;
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-button:hover {
    background-color: var(--bg-light);
    border-color: var(--text-muted);
}

/* 반응형 스타일 */
@media (max-width: 600px) {
    .dialog-header {
        border-radius: 0;
    }

    .dialog-matches-table {
        min-width: 600px;
    }

    .time-cell {
        width: 70px;
    }

    .court-cell {
        width: 45px;
    }

    .participant-cell {
        width: 120px;
    }

    .matches-content {
        padding: 16px;
    }

    .dialog-footer {
        border-radius: 0;
        padding: 12px 16px;
    }
}

/* 스크롤바 스타일링 */
.matches-content::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.matches-content::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track {
    background: var(--bg-light);
}

.matches-content::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.matches-content::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* 다이얼로그 기본 스타일 */
#scoreDialog {
    padding: 0;
    max-width: 90%;
    width: 400px;
    margin: auto;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    background: var(--bg-color);
}

/* 헤더 영역 */
#scoreDialog h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

/* 매치 정보 */
#score_dialog_match {
    margin: 0;
    padding: 12px 24px;
    font-size: 14px;
    text-align: center;
    color: var(--primary-hover-color);
    background: var(--bg-light);
}

/* 게임 수 입력 영역 */
#scoreDialog label {
    flex: 1;
    display: block;
    margin: 20px 24px 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

#scoreGames {
    width: calc(100% - 48px);
    margin: 0 24px 20px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-color);
    background: white;
}

#scoreGames:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(34, 86, 178, 0.1);
}

/* 스코어 테이블 */
#scoreInputsContainer {
    width: calc(100% - 48px);
    margin: 0 24px 24px;
    border-collapse: collapse;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

#scoreInputsContainer th {
    padding: 12px;
    background: var(--bg-light);
    font-weight: 500;
    font-size: 14px;
    color: var(--text-color);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

#scoreInputsContainer td {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

#scoreInputsContainer tr:last-child td {
    border-bottom: none;
}

#scoreInputsContainer input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    color: var(--text-color);
}

#scoreInputsContainer input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(34, 86, 178, 0.1);
}

.game-column {
    width: 60px;
}

.team-column {
    width: calc((100% - 60px) / 2);
}

/* 버튼 영역 */
.dialog-buttons {
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-color);
}

#scoreDialogCancelBtn,
#scoreDialogConfirmBtn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

#scoreDialogCancelBtn {
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
}

#scoreDialogCancelBtn:hover {
    background: var(--bg-light);
    border-color: var(--text-muted);
}

#scoreDialogConfirmBtn {
    border: none;
    background: var(--primary-color);
    color: white;
}

#scoreDialogConfirmBtn:hover {
    background: var(--primary-hover-color);
}

/* 모바일 대응 */
@media (max-width: 500px) {
    #scoreGames,
    #scoreInputsContainer {
        width: calc(100% - 32px);
        margin: 0 16px 16px;
    }

    #score_dialog_match {
        padding: 10px 20px;
    }

    #scoreDialog label {
        margin: 16px 20px 8px;
    }

    .dialog-buttons {
        padding: 12px 16px;
    }
}

.dialog-header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cancel-waiting-button {
    padding: 6px 12px;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease;
}

.cancel-waiting-button:hover {
    background-color: #dc3545;
}

.cancel-waiting-button svg {
    width: 16px;
    height: 16px;
}

.live-table-btns {
    display: flex;
    align-items: center;
    gap: 5px;
}

.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.confirm-dialog {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: dialogFadeIn 0.3s ease;
}

.confirm-dialog-message {
    color: var(--text-color);
    font-size: 16px;
    margin-bottom: 24px;
    text-align: center;
    line-height: 1.5;
}

.confirm-dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.confirm-dialog-button {
    padding: 8px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.confirm-dialog-cancel {
    background-color: var(--bg-light);
    color: var(--text-color);
}

.confirm-dialog-cancel:hover {
    background-color: var(--bg-heavy-light);
}

.confirm-dialog-confirm {
    background-color: var(--primary-color);
    color: white;
}

.confirm-dialog-confirm:hover {
    background-color: var(--primary-hover-color);
}

@keyframes dialogFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.go-button {
    color: var(--primary-color);
    font-weight: bold;
}

.match-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.match-confirm-dialog {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: dialogFadeIn 0.3s ease;
}

.match-confirm-title {
    color: var(--text-color);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

.match-info {
    background-color: var(--bg-light);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.match-detail {
    display: flex;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.match-detail:last-child {
    margin-bottom: 0;
}

.match-detail label {
    flex: 0 0 60px;
    color: var(--text-muted);
}

.match-detail span {
    color: var(--text-color);
    font-weight: 500;
}

.match-confirm-message {
    text-align: center;
    color: var(--text-color);
    font-size: 15px;
    margin-bottom: 24px;
}

.match-confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.match-confirm-button {
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.match-confirm-cancel {
    background-color: var(--bg-light);
    color: var(--text-color);
}

.match-confirm-cancel:hover {
    background-color: var(--bg-heavy-light);
}

.match-confirm-ok {
    background-color: var(--primary-color);
    color: white;
}

.match-confirm-ok:hover {
    background-color: var(--primary-hover-color);
}

@keyframes dialogFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .match-confirm-dialog {
        padding: 20px;
    }
    
    .match-confirm-title {
        font-size: 18px;
    }
    
    .match-detail {
        font-size: 13px;
    }
    
    .match-confirm-message {
        font-size: 14px;
    }
    
    .match-confirm-button {
        padding: 8px 20px;
    }
}

#available-matches-dialog .match-row.available-match {
    background-color: rgba(34, 86, 178, 0.05);
}

#available-matches-dialog .match-row.available-match:hover {
    background-color: rgba(34, 86, 178, 0.1);
}

/* 승부차기 체크박스 스타일 */
.penalty-checkbox {
    display: flex;
    gap: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.penalty-checkbox:hover {
    background-color: var(--bg-heavy-light);
}

.penalty-checkbox label {
    display: flex !important;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin: 0 !important;
    width: 100%;
    font-size: 14px;
    font-weight: 500;
}

.penalty-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background-color: white;
    flex-shrink: 0;
}

.penalty-checkbox input[type="checkbox"]:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(34, 86, 178, 0.1);
}

.penalty-checkbox input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.penalty-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#scoreInputsContainer td:first-child {
    font-size: smaller;
    white-space: nowrap;
}

.forfeit-teams {
    margin: 12px 24px;
    padding: 12px;
    background-color: var(--bg-heavy-light);
    border-radius: 8px;
    display: none;
}

.forfeit-teams label {
    display: block;
    margin: 2px 0 12px 3px !important;
    font-size: 14px;
    color: var(--text-color);
}

.forfeit-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.forfeit-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.forfeit-option:hover {
    background-color: var(--bg-light);
}

.forfeit-option input[type="radio"] {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    appearance: none;
    cursor: pointer;
    position: relative;
}

.forfeit-option input[type="radio"]:checked {
    border-color: var(--primary-color);
}

.forfeit-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background-color: var(--primary-color);
    border-radius: 50%;
}

.forfeit-option label {
    margin-bottom: 0 !important;
    cursor: pointer;
}

@media (max-width: 500px) {
    .forfeit-teams {
        margin: 12px 16px;
        padding: 10px;
    }
    
    .forfeit-option {
        padding: 6px 10px;
    }
}

h3 {
    font-size: 1.25rem;
}

#dynamic-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0;
}

#dynamic-messages:not(:empty) {
    margin-bottom: 20px;
}

@keyframes highlight-row {
    0% { background-color: transparent; }
    10% { background-color: rgba(25, 135, 84, 0.1); }
    70% { background-color: rgba(25, 135, 84, 0.1); }
    100% { background-color: transparent; }
}

.highlight-update {
    animation: highlight-row 5s ease-in-out;
}

.winner-selection {
    margin: 12px 20px 15px 20px;
}

.winner-selection > label {
    display: block;
    margin: 0 0 10px 0 !important;
    font-weight: bold;
}

.winner-options {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.winner-option-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 20px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 !important;
    text-align: center;
}

.winner-option-label:hover {
    border-color: var(--accent-color);
}

.winner-radio {
    display: none;
}

.winner-name {
    font-size: 1.1em;
    font-weight: 500;
    padding: 5px 10px;
}

/* 선택된 승자 스타일 */
.winner-radio:checked + .winner-option-label {
    border-color: var(--accent-color);
    background-color: var(--accent-color);
    color: white;
}

.winner-radio:checked + .winner-option-label .winner-name {
    color: white;
}

.score-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.score-dialog-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.score-dialog-header .running-cancel-btn {
    border: none;
    background-color: white;
    color: #dc3545;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-container {
    overflow-x: auto;
    cursor: grab;
    -webkit-overflow-scrolling: touch;  /* iOS 부드러운 스크롤 */
}

.table-container:active {
    cursor: grabbing;
}

.dialog-matches-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;  /* 텍스트 줄바꿈 방지 */
}

/* 드래그 시 텍스트 선택 방지 */
.dialog-matches-table,
.dialog-matches-table * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.match-label {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.playing-match .match-label {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.waiting-match .match-label {
    background: #f1c40f2e;
    color: var(--accent-hover-color);
}

.continuous-match .match-label {
    background: #1a459021;
    color: var(--primary-hover-color);
}

#available-matches-dialog .match-row.playing-match:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

#available-matches-dialog .match-row.waiting-match:hover {
    background-color: #f1c40f2e;
}

#available-matches-dialog .match-row.continuous-match:hover {
    background-color: #1a459021;
}

.refresh-icon {
    cursor: pointer;
}

.admin-mode-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background-color: var(--accent-color);
    color: white;
    cursor: pointer;
}

.admin-mode-btn:hover {
    background-color: var(--accent-hover-color);
}

.admin-mode-btn:disabled {
    opacity: 1;
    background-color: #059669;
    cursor: default;
}

.admin-mode-btn:disabled:hover {
    background-color: #059669;
}

.admin-dialog {
    margin: auto;
    padding: 20px;
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

.admin-dialog form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.admin-dialog input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.admin-dialog .dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.admin-dialog button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.admin-dialog .cancel-btn {
    background-color: #e5e7eb;
}

.admin-dialog .confirm-btn {
    background-color: var(--accent-color);
    color: white;
}

.custom-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 20%;
    transform: translateX(-50%);
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: max-content;
    max-width: 250px;
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.2s ease forwards;
    pointer-events: none; /* 툴팁이 마우스 이벤트를 방해하지 않도록 */
}

.tooltip-header {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 4px;
}

.tooltip-description {
  font-size: 13px;
  color: #64748b;
  line-height: 1.4;
}

/* 페이드아웃 애니메이션 */
.tooltip-fade-out {
    animation: fadeOut 0.2s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, 5px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translate(-50%, 0); }
    to { opacity: 0; transform: translate(-50%, 5px); }
}

/* 진행 테이블 스타일 */
.running-table tr, .waiting-table tr {
    cursor: pointer;
    transition: all 0.2s ease;
}

/* 호버 효과 */
.running-table tr:hover, .waiting-table tr:hover {
    background-color: var(--primary-color-5);
}

.match-scheduling-guide {
    margin-bottom: 16px;
    background-color: white;
    border-radius: 8px;
    border: 1px solid var(--primary-color-10);
    border-left: 4px solid var(--primary-color);
    font-size: 14px;
    color: #475569;
    transition: all 0.3s ease;
    background-color: var(--primary-color-5);
}

.match-scheduling-guide .guide-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.match-scheduling-guide .guide-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--primary-color);
}

.match-scheduling-guide .guide-icon {
    color: var(--primary-color);
}

.match-scheduling-guide .arrow-icon {
    transition: transform 0.3s ease;
}

.match-scheduling-guide.collapsed .arrow-icon {
    transform: rotate(-90deg);
}

.match-scheduling-guide .guide-content {
    padding: 0 16px 16px;
    max-height: 500px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.match-scheduling-guide.collapsed .guide-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.match-scheduling-guide .guide-list {
    margin: 0;
    padding-left: 20px;
    list-style-type: none;
}

.match-scheduling-guide .guide-list li {
    position: relative;
    padding: 4px 0;
    line-height: 1.5;
}

.match-scheduling-guide .guide-list li::before {
    content: "•";
    position: absolute;
    left: -15px;
    color: var(--primary-hover-color);
}

.guide-highlight {
    color: #2563eb;
    font-weight: 500;
}

.guide-warning {
    color: #dc2626;
    font-weight: 500;
}

.guide-label {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    margin: 0 2px;
    font-weight: 500;
}

.guide-label.continuous {
    background-color: #1a459021;
    color: #1a4590;
}

.guide-label.playing {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.guide-label.waiting {
    background-color: #f1c40f2e;
    color: #927608;
}

.guide-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.guide-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--primary-color);
}

.guide-icon {
    color: var(--primary-color);
}

.arrow-icon {
    transition: transform 0.3s ease;
}

.table-guide.collapsed .arrow-icon {
    transform: rotate(-90deg);
}

.guide-content {
    padding: 0 16px 16px;
    max-height: 500px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.table-guide.collapsed .guide-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* 기존 스타일 유지 */
.table-guide-list {
    margin: 0;
    padding-left: 20px;
    list-style-type: none;
}

.table-guide-list li {
    position: relative;
    padding: 4px 0;
    line-height: 1.5;
}

.table-guide-list li::before {
    content: "•";
    position: absolute;
    left: -15px;
    color: var(--primary-color);
}

/* 입력하기 텍스트 스타일 */
.input-prompt {
    font-size: 0.85em;
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
    transition: all 0.2s;
}

.match-table tr[data-match-type="running"] .input-prompt, .match-card[data-match-type="running"] .input-prompt {
    color: var(--primary-color);
}

.input-prompt:hover {
    color: var(--primary-hover-color);
}

/* 손가락 커서를 보여주기 위한 셀 스타일 */
.score-cell {
    cursor: pointer;
}

.wait-time {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.8em;
    margin: 2px 0;
    font-weight: 500;
}

.wait-time.long {
    background-color: #e8f5e9; /* 연한 녹색 배경 */
    color: #2e7d32; /* 진한 녹색 텍스트 */
}

.wait-time.medium {
    background-color: #fff3e0; /* 연한 주황색 배경 */
    color: #ef6c00; /* 진한 주황색 텍스트 */
}

.wait-time.short {
    background-color: #ffebee; /* 연한 빨간색 배경 */
    color: #c62828; /* 진한 빨간색 텍스트 */
}

.wait-icon {
    margin-right: 4px;
    fill: currentColor;
}

@media (max-width: 600px) {
    .wait-time {
        font-size: .9em;
        padding: 2px 4px;
    }
    
    .wait-time .wait-icon {
        width: 12px;
        height: 12px;
    }
}

.total-table tr[data-match-type="waiting"] td:first-child,
.match-card[data-match-type="waiting"] .match-header {
    cursor: pointer;
}

/* 선수명 검색창 스타일 */
.player-search-container {
    margin: 10px 0 20px;
}

.search-input-wrapper {
    position: relative;
    max-width: 400px;
    display: flex;
    align-items: center;
}

#player-search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-color, #1e293b);
    background-color: white;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#player-search-input:focus {
    outline: none;
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#player-search-input::placeholder {
    color: var(--text-muted, #94a3b8);
}

.search-button {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--primary-color, #2563eb);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.search-button:hover {
    transform: scale(1.05);
}

.search-clear-button {
    position: absolute;
    right: 36px;
    background: none;
    border: none;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    padding: 4px;
    display: none;
    align-items: center;
    justify-content: center;
}

#player-search-input:not(:placeholder-shown) ~ .search-clear-button {
    display: flex;
}

/* 검색 결과 하이라이트 추가 */
.player-highlighted {
    background-color: rgba(37, 99, 235, 0.1);
    border-radius: 4px;
    font-weight: 500;
}

/* 즉시 적용되는 애니메이션 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.match-table tbody tr:not([style*="display: none"]),
.match-card:not([style*="display: none"]) {
    animation: fadeIn 0.3s ease;
}

@media (max-width: 600px) {
    .search-input-wrapper {
        max-width: 100%;
    }
    
    #player-search-input {
        font-size: 13px;
        padding: 8px 40px 8px 12px;
    }
}

/* 동동 뜨는 라벨 */
.floating-label {
    display: inline-block;
    position: relative;
    animation: float 1.5s ease-in-out infinite;
    cursor: pointer;
}

/* 동동 뜨는 애니메이션 */
@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
    100% { transform: translateY(0); }
}

/* 툴팁 스타일 */
.waiting-tooltip {
    position: absolute;
    bottom: calc(100% + 4px);
    left: -20px;
    background-color: var(--accent-hover-color);
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
}

/* 툴팁 화살표 */
.waiting-tooltip::before {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 28px;
    border-width: 4px;
    border-style: solid;
    border-color: var(--accent-hover-color) transparent transparent transparent;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .live-table-container {
        padding: 0;
    }
    .total-table {
        font-size: 15px;
    }
}

.search-container {
    text-align: right;
    margin-bottom: 16px;
}

.match-search-input {
    padding: 6px 10px;
    width: 250px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.staff-btn {
    display: block;
    text-align: center;
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    padding: 8px 15px;
    border-radius: 5px;
    width: fit-content;
    font-size: 14px;
}

.staff-btn:hover {
    transform: translateY(-1px);
}

.header-btns {
    align-items: center;
}

.help-icon {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    line-height: 18px;
    transition: background 0.2s ease;
    vertical-align: middle;
}
  
.help-icon:hover {
    background-color: #004aad; /* hover 시 더 어두운 톤 */
}
  
.help-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    width: max-content;
    max-width: 300px;
    z-index: 10;
}  

@media (max-width: 500px) {
    .help-tooltip {
        left: 0;
        right: auto;
    }
}

.staff-alert {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.staff-alert-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5); /* 어두운 배경 */
    backdrop-filter: blur(2px);
}

.staff-alert-box {
    position: relative;
    background: white;
    border-radius: 10px;
    padding: 24px 28px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
    max-width: 90%;
    min-width: 320px;
    z-index: 10;
    font-size: 15px;
}

.staff-alert-content {
    position: relative;
    color: #333;
    font-weight: 500;
}

.staff-alert-content strong {
    line-height: 1.5;
}

.staff-alert-close {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.monitor-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    color: #555;
}

.monitor-button:hover {
    color: #000;
}

.waiting-table tr.dragging {
    background-color: rgba(0, 132, 255, 0.1);
    outline: 2px dashed var(--primary-color, #1DBF99);
    opacity: 0.9;
    cursor: grabbing;
}

.waiting-table tr.drop-target {
    background-color: rgba(255, 215, 0, 0.1);
    outline: 2px dashed var(--accent-color, #ffc107);
}
