:root {
    --primary-color: #9C27B0;
    --secondary-color: #2196F3;
    --accent-color: #ff9800;
    --danger-color: #f44336;
    --dark-color: #333;
    --light-color: #f5f5f5;
    --border-color: #ddd;
    --text-color: #333;
    --card-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Malgun Gothic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem 1rem;
    text-align: center;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    position: relative;
}

h1, h2, h3 {
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.home-button {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    transition: background-color 0.3s;
}

.home-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.home-button i {
    margin-right: 5px;
}

/* 탭 스타일 */
.tabs {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab-button {
    background-color: #e0e0e0;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 10px 20px;
    transition: 0.3s;
    font-size: 16px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin-right: 2px;
    white-space: nowrap;
}

.tab-button:hover {
    background-color: #d0d0d0;
}

.tab-button.active {
    background-color: var(--primary-color);
    color: white;
}

.tab-content {
    display: none;
    padding: 15px 0;
}

.tab-content.active {
    display: block;
}

/* 섹션 헤더 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* 버튼 스타일 */
.action-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    display: inline-flex;
    align-items: center;
}

.action-button i {
    margin-right: 5px;
}

.action-button:hover {
    background-color: #45a049;
}

.action-button.secondary {
    background-color: var(--secondary-color);
}

.action-button.secondary:hover {
    background-color: #0b7dda;
}

.action-button.danger {
    background-color: var(--danger-color);
}

.action-button.danger:hover {
    background-color: #d32f2f;
}

.action-button.cancel {
    background-color: #9e9e9e;
}

.action-button.cancel:hover {
    background-color: #757575;
}

/* 테이블 스타일 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
    table-layout: fixed;
    white-space: nowrap;
}

.data-table th,
.data-table td {
    padding: 0.3rem 0.1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

/* 각 열의 너비 설정 */
.data-table th:nth-child(1), /* 이름 */
.data-table td:nth-child(1) {
    width: 15%;
}

.data-table th:nth-child(2), /* 성별 */
.data-table td:nth-child(2) {
    width: 8%;
    text-align: center;
}

.data-table th:nth-child(3), /* 급수 */
.data-table td:nth-child(3) {
    width: 8%;
    text-align: center;
}

.data-table th:nth-child(4), /* 같은편 전적 */
.data-table td:nth-child(4) {
    width: 20%;
    text-align: center;
}

.data-table th:nth-child(5), /* 상대팀 전적 */
.data-table td:nth-child(5) {
    width: 20%;
    text-align: center;
}

.data-table th:nth-child(6), /* 액션 */
.data-table td:nth-child(6) {
    width: 15%;
    text-align: center;
}

.data-table th {
    background-color: var(--background-color);
    font-weight: 600;
    color: var(--text-color);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: #f9f9f9;
}

/* 필터 컨트롤 */
.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1rem;
    padding: 15px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: bold;
    white-space: nowrap;
}

.filter-group select,
.filter-group input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 120px;
}

.filter-controls .action-button {
    padding: 6px 12px;
    height: 32px;
    margin-left: 0;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.filter-controls .action-button i {
    margin-right: 4px;
    font-size: 12px;
}

@media screen and (max-width: 768px) {
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-controls .filter-group {
        width: 100%;
    }
    
    .filter-controls .action-button {
        width: 100%;
    }
}

/* 카드 스타일 */
.stats-card, .settings-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.chart-container {
    height: 250px;
    margin-bottom: 15px;
}

.stats-summary {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
}

.stats-item {
    text-align: center;
}

.stats-label {
    display: block;
    font-size: 14px;
    color: #666;
}

.stats-value {
    font-size: 18px;
    font-weight: bold;
}

/* 목표 카드 */
.goals-section {
    margin-bottom: 30px;
}

.goal-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.goal-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: var(--card-shadow);
}

.goal-title {
    font-size: 18px;
    margin-bottom: 10px;
}

.goal-deadline {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.goal-progress-bar {
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-bottom: 10px;
    overflow: hidden;
}

.goal-progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
}

.goal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

/* 빈 상태 스타일 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.empty-state i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 15px;
}

.empty-state p {
    margin-bottom: 20px;
    color: #666;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    width: 90%;
    max-width: 600px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s;
    position: relative;
    z-index: 10000;
}

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

.modal-header {
    padding: 15px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
}

.close-button {
    color: white;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

/* 폼 스타일 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
}

.form-group textarea {
    height: 100px;
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* 세트 점수 입력 */
.set-scores {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.set-score {
    display: flex;
    align-items: center;
    gap: 10px;
}

.set-score label {
    width: 60px;
}

.set-score input {
    width: 80px;
}

.set-score span {
    font-weight: bold;
}

/* 별점 평가 */
.rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.rating input {
    display: none;
}

.rating label {
    cursor: pointer;
    width: 30px;
    height: 30px;
    margin: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" fill="%23d4d4d4"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 30px;
}

.rating input:checked ~ label {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" fill="%23FFD700"/></svg>');
}

.rating label:hover,
.rating label:hover ~ label {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" fill="%23FFD700"/></svg>');
}

.settings-description {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.settings-description p {
    margin-bottom: 8px;
}

/* 푸터 */
footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    background-color: var(--dark-color);
    color: white;
    border-radius: var(--border-radius);
}

.creator-info {
    margin-top: 0.5rem;
    font-style: italic;
    opacity: 0.8;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .goal-cards {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        justify-content: flex-start;
    }
    
    .tab-button {
        flex: 0 0 auto;
        font-size: 14px;
        padding: 8px 15px;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .set-score {
        flex-wrap: wrap;
    }
    
    .filter-controls {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .section-header .action-button {
        width: 100%;
        justify-content: center;
    }
    
    .data-table {
        font-size: 14px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

/* 모바일 환경을 위한 테이블 컨테이너 */
.match-list-container,
.opponent-list-container,
.training-list-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 모바일 환경에서의 테이블 최소 너비 설정 */
.data-table {
    min-width: 400px;
}

/* 모바일 환경에서의 폰트 크기 조정 */
@media screen and (max-width: 768px) {
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.2rem 0.1rem;
    }
    
    .action-button {
        padding: 0.2rem 0.2rem;
        font-size: 0.8rem;
    }
    
    #match-table td:nth-child(3) {
        min-width: 100px;
        max-width: 150px;
    }
}

/* 경기 기록 테이블의 상대 정보 열 스타일 */
#match-table td:nth-child(3) {
    white-space: normal;
    min-width: 120px;
    max-width: 200px;
}

/* 경기 기록 테이블의 상대 정보 셀 내용 스타일 */
#match-table td:nth-child(3) span {
    display: inline-block;
    white-space: nowrap;
}

/* 경기 기록 테이블의 상대 정보 셀 내용이 길 경우 줄바꿈 */
#match-table td:nth-child(3) span + span {
    margin-left: 4px;
}

/* 경기 기록 테이블 열 너비 설정 */
#match-table th:nth-child(1), /* 날짜 */
#match-table td:nth-child(1) {
    width: 15%;
}

#match-table th:nth-child(2), /* 파트너 */
#match-table td:nth-child(2) {
    width: 15%;
}

#match-table th:nth-child(3), /* 상대 */
#match-table td:nth-child(3) {
    width: 25%;
    white-space: nowrap;
}

#match-table th:nth-child(4), /* 결과 */
#match-table td:nth-child(4) {
    width: 6%;
    text-align: center;
}

#match-table th:nth-child(5), /* 점수 */
#match-table td:nth-child(5) {
    width: 10%;
    text-align: center;
}

#match-table th:nth-child(6), /* 관리 */
#match-table td:nth-child(6) {
    width: 15%;
    text-align: center;
}

.current-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem 0;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.current-stats .stats-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.current-stats .stats-label {
    font-size: 0.9rem;
    color: var(--text-color);
}

.current-stats .stats-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .current-stats {
        gap: 1rem;
        padding: 0.8rem;
    }

    .current-stats .stats-label {
        font-size: 0.8rem;
    }

    .current-stats .stats-value {
        font-size: 1rem;
    }
}

.view-more-container {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.view-more-container .action-button {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.view-more-container .action-button:hover {
    background-color: var(--primary-color);
    color: white;
}

.view-more-container .action-button i {
    margin-right: 0.5rem;
}

.stats-section {
    margin-bottom: 2rem;
}

.stats-section h4 {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 600;
}

.stats-section:last-child {
    margin-bottom: 0;
}

.stats-section .data-table {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .stats-section {
        margin-bottom: 1.5rem;
    }

    .stats-section h4 {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-controls label {
    font-size: 0.9rem;
    color: var(--text-color);
}

.sort-controls select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    font-size: 0.9rem;
    color: var(--text-color);
    cursor: pointer;
}

.sort-controls select:hover {
    border-color: var(--primary-color);
}

.sort-controls select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

@media (max-width: 768px) {
    .stats-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .sort-controls {
        width: 100%;
    }

    .sort-controls select {
        flex: 1;
    }
}

/* 통계 필터 컨트롤 */
.stats-filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1rem;
    padding: 15px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.stats-filter-controls .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-filter-controls .filter-group label {
    font-weight: bold;
    white-space: nowrap;
}

.stats-filter-controls .filter-group select,
.stats-filter-controls .filter-group input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 120px;
}

.stats-filter-controls .action-button {
    margin-left: auto;
}

@media screen and (max-width: 768px) {
    .stats-filter-controls {
        flex-direction: column;
    }
    
    .stats-filter-controls .filter-group {
        width: 100%;
    }
    
    .stats-filter-controls .action-button {
        width: 100%;
        margin-left: 0;
    }
}

/* 통계 섹션 스타일 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.stats-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.stats-card h5 {
    margin-bottom: 10px;
    color: var(--text-color);
    font-size: 1rem;
}

.stats-section {
    margin-bottom: 30px;
}

.stats-section h4 {
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

.calendar-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
}

.calendar-header div {
    padding: 10px;
    text-align: center;
    font-weight: bold;
    color: #495057;
}

.calendar-body {
    display: flex;
    flex-direction: column;
}

.calendar-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-height: 80px;
}

.calendar-cell {
    border: 1px solid #dee2e6;
    padding: 5px;
    position: relative;
    min-height: 80px;
    transition: background-color 0.3s ease;
}

.calendar-cell.winning-day {
    background-color: rgba(76, 175, 80, 0.15);
}

.calendar-cell.losing-day {
    background-color: rgba(244, 67, 54, 0.15);
}

.calendar-cell .date-number {
    font-size: 14px;
    color: #495057;
    margin-bottom: 5px;
}

.calendar-cell .match-count {
    font-size: 12px;
    color: #4CAF50;
    font-weight: bold;
    margin-top: 2px;
}

.calendar-cell .match-result {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

.calendar-cell.winning-day .match-count {
    color: #2E7D32;
}

.calendar-cell.losing-day .match-count {
    color: #C62828;
}

.calendar-cell.has-matches {
    background-color: rgba(76, 175, 80, 0.1);
}

.calendar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.calendar-controls button {
    padding: 8px 16px;
    border: none;
    background: var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: white;
}

.calendar-controls button:hover {
    background: #7B1FA2;
}

.calendar-controls button i {
    font-size: 16px;
}

#current-month-display {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-color);
}

/* 선수 급수별 배경색 */
.grade-S {
    background-color: #FFD700;
    color: #000;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
}

.grade-A {
    background-color: #FF6B6B;
    color: #fff;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
}

.grade-B {
    background-color: #4ECDC4;
    color: #fff;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
}

.grade-C {
    background-color: #45B7D1;
    color: #fff;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
}

.grade-D {
    background-color: #96CEB4;
    color: #fff;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
}

.grade-초심 {
    background-color: #FFEEAD;
    color: #000;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
}

/* 급수 셀 스타일 */
.data-table td.grade-cell {
    text-align: center;
    width: 80px;
}

/* 승률에 따른 전적 배경색 */
.record-high {
    background-color: rgba(76, 175, 80, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

.record-medium {
    background-color: rgba(255, 152, 0, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

.record-low {
    background-color: rgba(244, 67, 54, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

.record-none {
    color: #999;
}

/* 통계 날짜 범위 스타일 */
.date-range {
    font-size: 0.7em;
    color: #666;
    font-weight: normal;
    margin-left: 10px;
}
