@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: #f8f9fa;
    color: #333;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

h1 { text-align: center; color: #007bff; margin-bottom: 10px; }
p { text-align: center; color: #6c757d; margin-bottom: 30px; line-height: 1.6; }

.controls {
    display: grid;
    grid-template-areas:
        "view-mode search"
        "selection selection"
        "functions functions";
    grid-template-columns: auto 1fr;
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    align-items: center;
}

.view-mode-container {
    grid-area: view-mode;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.selection-container {
    grid-area: selection;
}
#comparisonSelection, #singleSelection {
    display: flex;
    gap: 15px;
    width: 100%;
}
.selection-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.selection-item label {
    font-weight: bold;
    white-space: nowrap;
}
/* 수정된 부분: #monthSelector와 #weekSelector를 추가하여 스타일을 적용합니다. */
#yearSelector, #monthSelector, #weekSelector, #dataSelector {
    padding: 10px;
    border: 1px solid #ced4da;
    background-color: #ffffff;
    color: #495057;
    border-radius: 5px;
    font-size: 14px;
    width: 100%;
}

.search-container { grid-area: search; }
#searchInput { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #ced4da; background-color: #ffffff; color: #495057; border-radius: 5px; font-size: 14px; }
#searchInput::placeholder { color: #6c757d; }

.function-buttons, #saveAsImageBtn {
    grid-area: functions;
    border: none; padding: 10px 20px; border-radius: 5px; font-size: 15px; font-weight: bold; cursor: pointer; transition: background-color 0.3s ease;
    background-color: #28a745; color: white;
    width: 100%;
    box-sizing: border-box;
}

.table-container { overflow-x: auto; }
#resultsTable { width: 100%; border-collapse: collapse; margin-top: 20px; }
#resultsTable th, #resultsTable td { padding: 12px 15px; text-align: center; border-bottom: 1px solid #dee2e6; vertical-align: middle; }
#resultsTable th { background-color: #007bff; color: #ffffff; font-weight: bold; }
#resultsTable tbody tr:nth-child(even):not(.rank-up):not(.rank-down) { background-color: #f8f9fa; }

tr.rank-up { background: linear-gradient(to right, rgb(240, 161, 161), transparent) }
tr.rank-down { background: linear-gradient(to right, rgb(160, 205, 241), transparent) }

tr.rank-up .rank-change { color: red; }
tr.rank-down .rank-change { color: rgb(0, 140, 255); }
tr.rank-same .rank-change { color: #6c757d; }
tr.rank-new .rank-change { color: #629b41; font-weight: bold; }

.no-results { color: #6c757d; font-weight: bold; padding: 30px 0; text-align: center; font-size: 1.1em; }

.table-container.single-view .rank-change { display: none; }

.tgall-icon {
    background-color: #ffc107;
    color: #212529;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 8px;
    display: inline-block;
}

.history-link {
    color: inherit;
    text-decoration: none;
}

.history-link:hover {
    text-decoration: underline;
}

/* --- 커트라인 정보 스타일 추가 --- */
.cutoff-container {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.cutoff-container h2 {
    margin-top: 0;
    text-align: center;
    color: #007bff;
    margin-bottom: 20px;
}

.cutoff-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    text-align: center;
}

.cutoff-item {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.cutoff-item .rank {
    font-size: 1em;
    font-weight: bold;
    color: #6c757d;
    margin-bottom: 5px;
}

.cutoff-item .score {
    font-size: 1.3em;
    font-weight: bold;
    color: #343a40;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 15px;
    }
    h1 {
        font-size: 1.8em;
    }
    .controls {
        grid-template-areas:
            "view-mode"
            "search"
            "selection"
            "functions";
        grid-template-columns: 1fr;
    }
    #comparisonSelection, #singleSelection {
        flex-direction: column;
        align-items: stretch;
    }
    #resultsTable th, #resultsTable td {
        padding: 8px 10px;
        font-size: 0.9em;
    }
}