/* 기본 스타일 및 레이아웃 */
body {
    font-family: 'Malgun Gothic', sans-serif;
    background-color: #1a472a; /* 어두운 녹색 배경 */
    color: #f0f0f0;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 1200px;
    background-color: #ffffff; /* 흰색 배경 */
    color: #333; /* 어두운 글자색 */
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

h1, h2, h3 {
    color: #1a472a;
    text-align: center;
}

/* 헤더 및 달력 */
.header-container {
    background-color: #2a6f47; /* 헤더 배경색 */
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.header-container h1 {
    color: #fff;
    margin: 0 0 20px 0;
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-container h1::before {
    content: '⚽';
    margin-right: 15px;
}

/* 달력과 경기 기록 레이아웃 */
.calendar-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: flex-start;
}

#date-picker-container {
    background-color: #fff;
    padding: 15px;
    border-radius: 6px;
    flex-shrink: 0;
    margin-left: 20px;
}

#match-history-container {
    background-color: #fff;
    padding: 15px;
    border-radius: 6px;
    flex: 1;
    height: 340px;
    display: flex;
    flex-direction: column;
}

#match-history-container h3 {
    margin: 0 0 10px 0;
    color: #2a6f47;
    font-size: 1.1em;
}

#match-months-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0px;
    overflow-y: auto;
    flex: 1;
    max-height: 280px;
    padding-right: 5px;
}

/* 스크롤바 스타일링 */
#match-months-list::-webkit-scrollbar {
    width: 6px;
}

#match-months-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#match-months-list::-webkit-scrollbar-thumb {
    background: #2a6f47;
    border-radius: 3px;
}

#match-months-list::-webkit-scrollbar-thumb:hover {
    background: #1a472a;
}

.month-badge {
    background: #2e7d4f;
    color: #fff;
    display: inline-block;
    margin: 2px;
    padding: 4px 8px;
    min-width: 80px;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.month-badge:hover {
    background-color: #1a472a;
}

.month-badge.active {
    background-color: #f0ad4e;
    color: #333;
}

/* 게임 폼 스타일 */
.game-form-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.team-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.team-label {
    font-weight: bold;
    color: #2a6f47;
    margin-bottom: 5px;
}

.player-selectors {
    display: flex;
    gap: 5px;
}

.player-selectors select {
    width: 80px;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.team-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.team-controls select {
    width: 120px;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.team-controls input {
    width: 60px;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
    text-align: center;
}

.formation-input input {
    width: 100px;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
    text-align: center;
    font-size: 0.9em;
}

.vs-section {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 30px;
}

.vs-section span {
    font-size: 1.2em;
    font-weight: bold;
    color: #2a6f47;
}

.submit-section {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 30px;
}

.submit-section button {
    padding: 10px 20px;
    background-color: #2a6f47;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

.submit-section button:hover {
    background-color: #1a472a;
}

.selectors {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

select {
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

#day-buttons-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.day-btn {
    padding: 10px;
    border: none;
    border-radius: 4px;
    background-color: #2a6f47; /* 기본 버튼색 */
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.day-btn:hover {
    background-color: #3a8f57;
}

.day-btn.has-data {
    font-weight: bold;
    background-color: #ff8c00; /* 데이터 있는 날 - 주황색 */
    color: white;
}

.day-btn.selected {
    background-color: #f0ad4e; /* 선택된 날 */
    color: #333;
}

/* 전적 섹션 */
.stats-section {
    margin-bottom: 20px;
}

.stats-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.period-buttons button, .view-mode-btn {
    padding: 8px 15px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    cursor: pointer;
    border-radius: 5px;
}

.period-buttons button.active, .view-mode-btn.active {
    background-color: #2a6f47;
    color: white;
    border-color: #2a6f47;
}

/* 테이블 스타일 */
.stats-table-container, .stats-chart-container {
    display: flex;
    gap: 20px;
    justify-content: space-around;
    flex-wrap: wrap;
}

.stats-group, .chart-group {
    flex: 1;
    min-width: 400px;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.stats-table th, .stats-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.stats-table th {
    background-color: #e9e9e9;
}

/* 숨김 클래스 */
.hidden {
    display: none;
}

.chart-group {
    flex: 1;
    min-width: 320px;
    max-width: 380px;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-group canvas {
    max-width: 340px;
    width: 100%;
    height: 240px !important;
}



/* 포메이션 툴팁 스타일 */
.tooltip-container {
    position: relative;
    cursor: help;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: normal;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    
    /* 툴팁 위치 조정 */
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.tooltip-container:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* 포메이션 정보 스타일 */
.formation-info {
    font-weight: bold;
    color: #4CAF50;
}

.formation-info::before {
    content: '⚽ ';
    color: #FFD700;
}

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

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    background-color: #2a6f47;
    color: white;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: white;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    opacity: 0.7;
}

.edit-form-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 20px;
    border-top: 1px solid #ddd;
    background-color: #f9f9f9;
    border-radius: 0 0 10px 10px;
}

.btn-save {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.btn-save:hover {
    background-color: #218838;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.btn-delete:hover {
    background-color: #c82333;
}

.btn-cancel {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.btn-cancel:hover {
    background-color: #5a6268;
}

.edit-btn, .delete-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 5px;
}

.edit-btn:hover {
    background-color: #0056b3;
}

.delete-btn {
    background-color: #dc3545;
}

.delete-btn:hover {
    background-color: #c82333;
}