/* Existing styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

header {
    background-color: #3498db;
    color: white;
    padding: 1rem;
}

h1 {
    margin: 0;
}

nav {
    background-color: #2980b9;
}

nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: flex-start;
}

nav ul li {
    padding: 0.5rem 1rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
}

nav ul li a:hover {
    text-decoration: underline;
}

main {
    padding: 20px;
}

footer {
    background-color: #34495e;
    color: white;
    text-align: center;
    padding: 1rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1030;
    /* Ensure footer is below modals */
}

/* Flash messages */
.flashes {
    list-style-type: none;
    padding: 0;
}

.flashes li {
    background-color: #f39c12;
    color: white;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

form {
    margin-bottom: 20px;
}

select,
button {
    margin: 5px;
    padding: 5px;
}

.pagination-page-info {
    padding: .6em;
    padding-left: 0;
    width: 40em;
    margin: .5em;
    margin-left: 0;
    font-size: 12px;
}

.pagination-page-info b {
    color: black;
    background: #6aa6ed;
    padding-left: 2px;
    padding: .1em .25em;
    font-size: 150%;
}

.problem {
    margin-bottom: 30px;
    border: 1px solid #ddd;
    padding: 20px;
}

.problem-image,
.solution-image {
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
}

.show-solution {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
}

.solution {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    padding: 10px;
    margin-top: 10px;
}

/* Button & interactive states */
.back-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 10px 0;
    cursor: pointer;
    font-size: 16px;
}

.back-button:hover {
    background-color: #2980b9;
}

.grade-student-form .answer-box {
    display: inline-block;
    width: 60px;
    height: 30px;
    border: 2px solid #999;
    border-radius: 5px;
    text-align: center;
    line-height: 30px;
    cursor: pointer;
    margin-right: 10px;
    transition: all 0.3s;
}

.grade-student-form .answer-box.correct {
    border-color: #2ecc71;
    color: #2ecc71;
}

.grade-student-form .answer-box.incorrect {
    border-color: #e74c3c;
    color: #e74c3c;
}

.grade-student-form .answer-box.selected {
    background-color: #3498db;
    border-color: #3498db;
    color: white;
}

.grade-student-form .answer-box.correct:hover {
    background-color: #2ecc71;
    color: white;
}

.grade-student-form .answer-box.incorrect:hover {
    background-color: #e74c3c;
    color: white;
}

.problem-stats {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #212529;
}

.analysis-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.analysis-table th,
.analysis-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.analysis-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.analysis-table tr:hover {
    background-color: #f8f9fa;
}

/* 
   Robust Fix for Modal Backdrop Issues 
   Forces modals to always be on top of backdrops and other fixed elements.
*/
.modal-backdrop {
    z-index: 2000 !important;
}

.modal {
    z-index: 2005 !important;
}

.modal-dialog {
    z-index: 2010 !important;
}
/*
   정답률 구간 색상 — 문제카드 배지·분석표가 같은 클래스를 쓴다.
   구간(원장 결정 2026-09-04): 0–39 빨강 / 40–59 주황 / 60–79 노랑 / 80–100 초록
   표본이 없으면 무채색(0%로 칠하면 "전원 오답"으로 읽힌다).
*/
.rate-band {
    display: inline-block;
    padding: 0.15em 0.45em;
    border-radius: 0.25rem;
    font-size: 0.85em;
    white-space: nowrap;
}

.rate-band-low   { background-color: #f8d7da; color: #842029; }
.rate-band-mid   { background-color: #ffe0c2; color: #8a4b08; }
.rate-band-high  { background-color: #fff3cd; color: #664d03; }
.rate-band-top   { background-color: #d1e7dd; color: #0f5132; }
.rate-band-none  { background-color: #e9ecef; color: #6c757d; }

/* 표본이 얇을 때(n<10)는 구간 색을 쓰지 않고 흐리게 둔다 */
.rate-band-thin  { background-color: #f1f3f5; color: #6c757d; }

.rate-band-count { opacity: 0.75; font-size: 0.9em; }

/* 분석표 셀에서는 배지가 아니라 배경만 칠한다 */
td.rate-cell-low   { background-color: #f8d7da !important; }
td.rate-cell-mid   { background-color: #ffe0c2 !important; }
td.rate-cell-high  { background-color: #fff3cd !important; }
td.rate-cell-top   { background-color: #d1e7dd !important; }
td.rate-cell-none  { background-color: #e9ecef !important; color: #6c757d; }

/* 제출 답 표시(#9) — 색만으로 구분하지 않도록 O/X를 함께 남긴다 */
.answer-value { font-weight: 600; }
.answer-value-correct { color: #0a58ca; }
.answer-value-wrong   { color: #b02a37; }
.answer-mark { font-size: 0.85em; opacity: 0.8; }
