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

.schedules-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .schedules-container {
        padding: 0;
    }
}

/* 경기 일정 헤더 스타일 */
.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.header-actions {
    position: relative;
}

.action-toggle:hover {
    background-color: var(--bg-light);
    color: var(--text-color);
}

.action-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    color: var(--text-muted);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.action-dialog.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.action-dialog {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 8px;
    min-width: 120px;
    display: none;
    z-index: 1000;
    border: 1px solid var(--border-color);
}

.action-button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.action-button:hover {
    background-color: var(--bg-light);
}

.action-button.delete:hover {
    background-color: #FFE8E8;
    color: var(--danger-color);
}

/* 가이드 */
.guide-container {
    margin: 30px auto;
    padding: 24px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.guide-title {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.guide-section {
    margin-bottom: 36px;
}

.section-title {
    margin: auto;
    max-width: 650px;
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.section-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #f0f4ff;
    color: #4466ee;
    border-radius: 50%;
    font-size: 14px;
    margin-right: 12px;
}

.image-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    max-width: 650px;        /* 이미지 + 패딩 고려 */
    margin-left: auto;
    margin-right: auto;
}

.guide-image {
    width: 100%;
    max-width: 400px;        /* 최대 너비 제한 */
    height: auto;            /* 비율 유지 */
    display: block;          /* 중앙 정렬을 위해 */
    margin: 0 auto 12px;     /* 상하 여백과 중앙 정렬 */
}

.guide-text {
    color: #555;
    line-height: 1.6;
    font-size: 14px;
}

.warning-text {
    text-align: center;
    color: #c53030;  /* 더 부드러운 빨간색 */
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    background-color: #fff5f5;  /* 매우 연한 빨간색 배경 */
    border-radius: 6px;
    line-height: 1.5;
}

@media (min-width: 769px) {
    .guide-text {
        font-size: 1rem;
    }
    .warning-text {
        font-size: 0.9rem;
        padding: 0.625rem 0.875rem;
    }
}

.important-section {
    background: #fff9e6;
    border-left: 4px solid #ffd43b;
    padding: 24px;
    border-radius: 8px;
}

/* 비공개 표시 스타일 */
.no-public {
    display: inline-block;
    padding: 4px 8px;
    background-color: #FFE8E8;
    color: #E74C3C;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* 대진표 제목 컨테이너 스타일 */
.schedule-title {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
    margin: 0;
}

/* 부문 제목 스타일 */
.division-title {
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 8px;
}

/* 경기 일정 섹션 스타일 */
.schedule-section {
    background-color: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px; 
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* 섹션 내 구분선 */
.schedule-section > div:not(:last-child) {
    padding-bottom: 32px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
}

/* 대진표 컨테이너 스타일 */
.bracket-container {
    font-size: smaller;
    background-color: var(--bg-light);
    border-radius: 8px;
    padding: 40px 24px;
    margin-top: 10px;  /* 헤더와의 간격 */
    border: 1px solid #eaeaea;
    overflow-x: auto; 
    scrollbar-width: thin; 
    scrollbar-color: #CBD5E1 #F1F5F9;
}

/* Webkit(Chrome, Safari, Edge) 스크롤바 디자인 */
.bracket-container::-webkit-scrollbar {
    height: 8px; /* 가로 스크롤바 높이 */
}

.bracket-container::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 4px;
}

.bracket-container::-webkit-scrollbar-thumb {
    background-color: #CBD5E1;
    border-radius: 4px;
    border: 2px solid #F1F5F9;
}

.bracket-container::-webkit-scrollbar-thumb:hover {
    background-color: #94A3B8;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .schedule-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .bracket-container {
        padding: 20px 16px;
        margin-top: 6px;
    }
    
    .bracket-container::-webkit-scrollbar {
        height: 6px; /* 모바일에서는 더 얇게 */
    }
    
    .schedule-section > div:not(:last-child) {
        padding-bottom: 24px;
        margin-bottom: 24px;
    }
}

/* 토너먼트 */
.bracket-container .bracket {
    display: flex;
    gap: 40px;
    position: relative;
}

.round-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    padding: 0 16px;
}

.round-container-first {
    min-width: 250px;
}

.participation-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.round-container h4 {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
    padding: 8px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid var(--primary-hover-color);
}

.bracket-container .bracket > .round-container:first-child h4 {
    margin-left: 36px;
}

.participation-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bracket-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: 50%;
    flex-shrink: 0;
}

.participation {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.round {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.match {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    transition: all 0.2s ease;
    text-align: center;
}

.third_place_playoff .participation {
    text-align: center;
}

/* 가로 연결선 */
.match::before {
    content: '';
    position: absolute;
    left: -40px;
    top: 50%;
    width: 40px;
    height: 2px;
    background: var(--border-color);
    transform: translateY(-50%);
}

.match::after {
    content: '';
    position: absolute;
    left: -73px;
    top: 50%;
    transform: translateY(-50%);
    width: 33px;
    height: calc(100%);
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    border-right: 2px solid var(--border-color);
}

/* 3,4위전 */
.third_place_playoff {
    padding-top: 16px;
    position: relative;
}

.third_place_playoff h4 {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
}

@media (max-width: 768px) {
    .bracket-container .bracket {
        gap: 24px;
    }

    .round-container {
        min-width: 150px;
        padding: 0 8px;
    }

    .round-container-first {
        min-width: 200px;
    }

    .bracket-container .bracket > .round-container:first-child h4 {
        margin-left: 32px;
    }

    .participation,
    .match {
        padding: 10px;
        font-size: 13px;
    }

    .bracket-number {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }

    .match::before {
        left: -24px;
        width: 24px;
    }

    .match::after {
        left: -41px;
        width: 17px;
    }
}

/* 기존 CSS */
.participation span, th span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: normal;
}

.participation span {
    font-size: .9em;
}

.participation span p {
    text-overflow: ellipsis;
    text-wrap: nowrap;
    overflow: hidden;
}

.participation span.searched {
    background-color: rgb(255, 239, 213, 0.5);;
}

.schedule-actions {
    display: flex;
    gap: 12px;
    justify-content: end;
}

.schedule-actions a {
    display: inline-block;
}

.material-symbols-outlined {
    font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24
}

.schedule-action {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.schedule-action .action-text {
    font-size: .9rem;
}

.division-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.color-box {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.calendar-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden !important;
}

.fc-timegrid-axis {
    position: relative !important;
    z-index: 3 !important;
}

.fc-timegrid-slot-label {
    position: sticky !important;
    left: 0 !important;
    background: white !important;
    z-index: 3 !important;
}

/* 부모 요소들의 z-index 설정 */
.fc-timegrid-slots {
    z-index: 2 !important;
    position: relative !important;
}

.fc-timegrid-slot-label-cushion {
    position: relative !important;
    z-index: 3 !important;
}

/* 다른 요소들이 위에 올라오지 않도록 설정 */
.fc-timegrid-cols {
    z-index: 1 !important;
}

.fc .fc-scrollgrid-section-body {
    position: relative !important;
}

.fc .fc-timegrid-body {
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

.fc .fc-scrollgrid-section-header {
    overflow: hidden !important;
}

/* 각 코트(day) 컬럼의 최소 너비 설정 */
.fc .fc-timegrid-col, .fc-col-header-cell.fc-day {
    width: 55px !important;
    min-width: 55px !important;
}

.fc-direction-ltr .fc-timegrid-slot-label-frame {
    text-align: center;
}

.event-title .main-title {
    font-size: 14px;  /* 기본 크기 */
    margin-bottom: 2px;
}

.event-title .participants {
    font-size: 12px;  /* 더 작은 크기 */
    color: #666;      /* 약간 흐린 색상 */
}

.fc-timegrid-event {
    height: min-content !important;
}

/* 스크롤바 스타일링 */
.fc .fc-timegrid-body::-webkit-scrollbar {
    height: 8px;
}

.fc .fc-timegrid-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.fc .fc-timegrid-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.fc .fc-timegrid-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.fc-timegrid-slots {
    z-index: 2 !important;
    position: sticky !important;
    left: 0;
}

/* 리그 테이블 기본 스타일 */
.league-table.diagonal-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    table-layout: auto;
}

/* 테이블 셀 공통 스타일 */
.league-table.diagonal-table th {
    border: 1px solid #e0e0e0;
    padding: 12px;
    position: relative;
    min-width: 120px;
    max-width: 120px;
    background: white;
}

/* 선수명 셀 스타일 */
.league-table.diagonal-table th span {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.league-table.diagonal-table th span p {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 대각선 셀 스타일 */
.league-table.diagonal-table .diagonal {
    background: linear-gradient(
        to top right,
        white calc(50% - 1px),
        #e0e0e0 calc(50% - 1px),
        #e0e0e0 calc(50% + 1px),
        white calc(50% + 1px)
    );
    border: 1px solid #e0e0e0;
}

/* 경기 순서 번호 스타일 */
.league-table.diagonal-table .match-info {
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-color);
    white-space: normal;
}

/* 검색 결과 강조 */
.league-table.diagonal-table span.searched {
    background-color: rgb(255, 239, 213, 0.5);
}

/* 카드 스타일 */
.league-cards {
    display: none;
}

.match-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.team-container {
    display: flex;
    gap: 20px;
    justify-content: space-around;
    align-items: center;
}

.match-card .team {
    margin-bottom: 5px;
    text-align: center;
    flex: 1;
    overflow: hidden;
}

.match-card .team p {
    overflow: hidden;
    text-wrap: nowrap;
    text-overflow: ellipsis;
}

.match-card .team.searched p {
    background-color: rgb(255, 239, 213, 0.5);;
}

.match-card .vs {
    color: #888;
    margin: 5px 0;
}

.scheduled-time {
    text-align: center;
    background-color: var(--bg-heavy-light);
    padding: 5px;
    border-radius: 5px;
    margin-top: 5px;
}

/* 반응형 디자인 */
@media screen and (max-width: 600px) {
    .schedule-section {
        width: 100%;
    }
    
    .league-table {
        display: none;
    }

    .league-cards {
        display: block;
    }
}

/* 다이얼로그 기본 스타일 */
.schedule-dialog {
    padding: 20px;
    border: none;
    border-radius: 8px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    width: 90%;
    min-width: 90%;
    max-width: fit-content;
    margin: auto;
    background: white;
}
 
.schedule-dialog::backdrop {
    background: rgba(0,0,0,0.5);
}

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

/* 검색 입력창 */
.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 16px;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 셀렉트 박스 컨테이너 */
.select-wrapper {
    margin-bottom: 16px;
}

/* 셀렉트 박스 스타일 */
#divisionFilter,
.date-selector select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    background-color: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232C3E50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    transition: border-color 0.2s ease;
}

#divisionFilter:focus,
.date-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 날짜 선택기 컨테이너 */
.date-selector {
    margin-bottom: 16px;
}

/* 닫기 버튼 컨테이너 */
.close-btn-container {
    padding: 16px 24px;
    text-align: right;
}

/* 닫기 버튼 */
.close-btn {
    background-color: var(--bg-light);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 20px;
    width: 100%;
}

.close-btn:hover {
    background-color: var(--bg-heavy-light);
}

/* 반응형 스타일 */
@media (max-width: 768px) {
    .dialog-header h2 {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .close-btn-container {
        padding: 12px 16px;
    }

    .search-input,
    #divisionFilter,
    .date-selector select {
        padding: 10px 14px;
        font-size: 14px;
    }
}

.schedule-view-link {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    color: var(--primary-color);
    padding: 8px 16px;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background-color: white;
}

/* 아이콘 추가 */
.schedule-view-link svg {
    margin-right: 6px;
    width: 16px;
    height: 16px;
}

.no-schedule {
    text-align: center;
    padding: 48px 24px;
    background: white;
    border-radius: 12px;
    color: var(--text-muted);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.accent-btn {
    background-color: var(--accent-color);
    color: var(--text-light);
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    width: fit-content;
    font-size: 14px;
    margin-left: 5px;
}

.accent-btn:hover {
    background-color: var(--accent-hover-color);
    cursor: pointer;
}

.custom-alert {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.custom-alert .schedule-dialog {
    max-width: 400px;
}

.dialog-content {
    padding: 0 24px;
}

.dialog-content p {
    color: var(--text-color);
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.dialog-actions .cancel-btn {
    background-color: var(--bg-heavy-light);
    color: var(--text-muted);
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dialog-actions .cancel-btn:hover {
    background-color: #ddd;
}

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

/* 모바일 대응 */
@media (max-width: 480px) {
    .schedule-dialog {
        max-width: 100%;
    }
    
    .dialog-header {
        padding: 16px 20px 0;
    }
    
    .dialog-content {
        padding: 12px 20px 20px;
    }
}

.participant-info {
    margin-bottom: 24px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background-color: var(--bg-heavy-light);
    color: black;
    padding: 6px 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.participant-list {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.participant-item {
    padding: 6px 0;
}

.delete-btn {
    background-color: var(--danger-color);
    color: var(--text-light);
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    width: fit-content;
    font-size: 14px;
    transition: all 0.2s ease;
}

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

.bye, 
.bye-match {
    border: none;
    background: var(--bg-heavy-light);
}

.bye:hover {
    border-color: none;
    box-shadow: none;
}

.match-highlight {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    z-index: 1;
}

.timetable {
    border: 1px solid #ccc;
    font-size: 14px;
    min-width: fit-content; /* 폭이 넘어가면 스크롤 허용 */
}

.timetable-header, .timetable-row {
    display: flex;
}

.header-cell, .time-label, .timetable-slot {
    border: 1px solid #ddd;
    box-sizing: border-box;
    text-align: center;
}

.timetable-header .header-cell {
    font-weight: bold;
    background-color: #f0f0f0;
}

/* 시간 라벨 (왼쪽 고정 폭) */
.time-label {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    background-color: #f9f9f9;
    flex-shrink: 0;
    position: sticky;
    left: 0;
    z-index: 2;
}

/* 코트 헤더 셀 고정폭 */
.timetable-header .header-cell:not(.time-label) {
    width: 100px;
    flex: 1;
}

/* 매치 슬롯 고정폭 */
.timetable-slot {
    width: 100px;
    flex: 1;
    min-height: 40px;
    background-color: #fff;
    transition: background-color 0.2s;
}

/* 부모에 가로 스크롤 허용 */
#timetable-wrapper {
    overflow-x: auto;
    cursor: grab;
    user-select: none;
}

#timetable-wrapper:active {
    cursor: grabbing;
}

.assigned-match {
    font-size: 12px;
    line-height: 1.4;
    text-align: start;
    background-color: var(--bg-heavy-light);
    height: 100%;
    position: relative;
    border: 1px solid black;
}

.assigned-match .division-name {
    position: relative;
}

.assigned-match .division-name, .assigned-match .match-name, .assigned-match .players {
    padding: 1px;
}

.end-match:hover {
    border: 1px solid #0066ff;
    cursor: pointer;
}

.bracket-table {
    width: 100%;
    white-space: nowrap;
}

.bracket-cell {
    min-width: 40px;
    text-align: center;
    vertical-align: middle;
    font-size: smaller;
    padding: 5px 8px;
}

.clickable {
    color: var(--primary-color);
    cursor: pointer;
}

.clickable:hover {
    background-color: var(--bg-light) !important;
}
