/* ==========================================
   CSS 변수 - 라이트 모드 (Light Mode)
   ========================================== */

:root {
    /* 배경색 */
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-gradient-index: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-gradient-professor: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-gradient-student: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);

    /* 텍스트 색상 */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --text-light: #555555;

    /* 카드 및 컨테이너 */
    --card-bg: #ffffff;
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    --card-shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.3);

    /* 테두리 */
    --border-color: #e0e0e0;
    --border-light: #dee2e6;
    --border-divider: #f0f0f0;

    /* 입력 요소 */
    --input-bg: #ffffff;
    --input-border: #e0e0e0;
    --input-focus-professor: #667eea;
    --input-focus-student: #f5576c;

    /* 특별한 배경 */
    --classroom-info-professor: #f8f9fa;
    --classroom-info-student: #fff5f8;
    --question-bg: #f8f9fa;
    --answer-bg: #f8f9fa;

    /* 액센트 컬러 */
    --professor-color: #667eea;
    --student-color: #f5576c;
    --success-bg: #d4edda;
    --success-text: #155724;
    --success-border: #c3e6cb;
    --error-bg: #f8d7da;
    --error-text: #721c24;
    --error-border: #f5c6cb;
    --info-bg: #d1ecf1;
    --info-text: #0c5460;
    --info-border: #bee5eb;
}

/* ==========================================
   CSS 변수 - 다크 모드 (Dark Mode)
   ========================================== */

body.dark-mode {
    /* 배경색 */
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-gradient-index: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    --bg-gradient-professor: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    --bg-gradient-student: linear-gradient(135deg, #db2777 0%, #c026d3 100%);

    /* 텍스트 색상 */
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-light: #d4d4d8;

    /* 카드 및 컨테이너 */
    --card-bg: #16213e;
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --card-shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.6);

    /* 테두리 */
    --border-color: #374151;
    --border-light: #4b5563;
    --border-divider: #374151;

    /* 입력 요소 */
    --input-bg: #1f2937;
    --input-border: #374151;
    --input-focus-professor: #818cf8;
    --input-focus-student: #f472b6;

    /* 특별한 배경 */
    --classroom-info-professor: #1f2937;
    --classroom-info-student: #1f2937;
    --question-bg: #1f2937;
    --answer-bg: #1f2937;

    /* 액센트 컬러 */
    --professor-color: #818cf8;
    --student-color: #f472b6;
    --success-bg: #064e3b;
    --success-text: #6ee7b7;
    --success-border: #047857;
    --error-bg: #7f1d1d;
    --error-text: #fca5a5;
    --error-border: #991b1b;
    --info-bg: #164e63;
    --info-text: #67e8f9;
    --info-border: #0e7490;
}

/* ==========================================
   테마 토글 버튼
   ========================================== */

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.theme-toggle span {
    font-size: 1.2em;
}

.theme-toggle .theme-label {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================
   공통 스타일 (Common Styles)
   ========================================== */

/* 기본 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* body 기본 스타일 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 컨테이너 */
.container {
    margin: 0 auto;
}

/* 카드 */
.card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--card-shadow);
    transition: background-color 0.3s ease;
}

.card h2 {
    font-size: 1.5em;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid;
}

/* 폼 요소 */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s, background-color 0.3s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
}

textarea {
    resize: vertical;
}

/* 버튼 */
.btn {
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 유틸리티 클래스 */
.hidden {
    display: none;
}

.no-data {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px;
    font-style: italic;
}

/* 강의실 목록 스타일 */
.classroom-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.classroom-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--question-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.classroom-item:hover {
    background: var(--bg-secondary);
    border-color: var(--professor-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.classroom-item .classroom-info {
    flex: 1;
    padding: 0;
    margin: 0;
    border-radius: 0;
}

.classroom-item .classroom-name {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.classroom-item .classroom-meta {
    display: flex;
    gap: 16px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.classroom-item .classroom-meta i {
    margin-right: 6px;
    color: var(--professor-color);
}

.btn-select {
    padding: 8px 16px;
    background: var(--professor-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.btn-select:hover {
    background: #5568d3;
    transform: translateX(4px);
}

.btn-select i {
    margin-left: 6px;
}

/* 헤더 */
.header {
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

.header-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.back-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.back-link:hover {
    opacity: 1;
}

/* 강의실 정보 */
.classroom-info {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.classroom-info div {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.classroom-info strong {
    color: var(--text-primary);
}

/* ==========================================
   메인 선택 페이지 (Main Selection Page)
   ========================================== */

body.page-main {
    background: var(--bg-gradient-index);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

body.page-main .container {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 60px 40px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--card-shadow-heavy);
    text-align: center;
}

body.page-main h1 {
    font-size: 2.5em;
    color: var(--text-primary);
    margin-bottom: 20px;
}

body.page-main .subtitle {
    color: var(--text-secondary);
    margin-bottom: 50px;
    font-size: 1.1em;
}

body.page-main .btn {
    padding: 20px 40px;
    font-size: 1.2em;
    border-radius: 12px;
    text-decoration: none;
    display: block;
}

body.page-main .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* ==========================================
   메인 페이지 (Index Page)
   ========================================== */

body.page-index {
    background: var(--bg-primary);
    padding: 15px;
}

body.page-index .container {
    max-width: 800px;
    margin: 0 auto;
}

body.page-index .header {
    background: var(--bg-gradient-student);
    color: white;
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
}

body.page-index h1 {
    font-size: 2.5em;
    color: white;
    margin-bottom: 10px;
}

body.page-index .subtitle {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
    font-size: 1.1em;
}

/* 헤더 링크 컨테이너 */
.header-links {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 헤더 내 버튼 */
.header-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9em;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.header-link-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.header-link-btn i {
    font-size: 1em;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

body.page-index .btn {
    padding: 20px 40px;
    font-size: 1.2em;
    border-radius: 12px;
    text-decoration: none;
    display: block;
}

.btn-professor {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.dark-mode .btn-professor {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.btn-student {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

body.dark-mode .btn-student {
    background: linear-gradient(135deg, #db2777 0%, #c026d3 100%);
}

.btn-student-join {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

body.dark-mode .btn-student-join {
    background: linear-gradient(135deg, #db2777 0%, #c026d3 100%);
}

.btn-student-submit {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

body.dark-mode .btn-student-submit {
    background: linear-gradient(135deg, #db2777 0%, #c026d3 100%);
}

body.page-index .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* 교수용 링크 (우측 상단) */
.professor-link-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.professor-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

body.dark-mode .professor-link {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    box-shadow: 0 4px 15px rgba(90, 103, 216, 0.4);
}

.professor-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

body.dark-mode .professor-link:hover {
    box-shadow: 0 6px 20px rgba(90, 103, 216, 0.5);
}

.professor-link i {
    font-size: 1.1em;
}

/* ==========================================
   교수용 페이지 (Professor Page)
   ========================================== */

body.page-professor {
    background: var(--bg-primary);
    padding: 15px;
}

body.page-professor .container {
    max-width: 1200px;
}

body.page-professor .header {
    background: var(--bg-gradient-professor);
    color: white;
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
}

body.page-professor h1 {
    font-size: 2.5em;
    color: white;
    margin-bottom: 10px;
}

body.page-professor .header #pageSubtitle {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
    font-size: 1.1em;
}

body.page-professor .card h2 {
    border-bottom-color: var(--professor-color);
}

body.page-professor input[type="text"]:focus,
body.page-professor input[type="password"]:focus,
body.page-professor input[type="number"]:focus,
body.page-professor textarea:focus {
    border-color: var(--input-focus-professor);
}

body.page-professor textarea {
    min-height: 100px;
}

body.page-professor .btn {
    background: var(--bg-gradient-professor);
}

body.page-professor .btn:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    margin-left: 10px;
}

.btn-danger {
    background: linear-gradient(135deg, #f5576c 0%, #dc3545 100%);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

body.page-professor .classroom-info {
    background: var(--classroom-info-professor);
}

.classroom-code {
    font-size: 2em;
    font-weight: bold;
    color: var(--professor-color);
    text-align: center;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    margin: 10px 0;
    letter-spacing: 3px;
    border: 2px solid var(--border-color);
}

.answers-container {
    background: var(--answer-bg);
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.answer-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.answer-item:last-child {
    border-bottom: none;
}

.answer-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.answer-content {
    color: var(--text-primary);
    font-size: 1em;
    line-height: 1.6;
    padding-left: 10px;
}

.student-name {
    font-weight: 600;
    color: var(--professor-color);
}

.question-status {
    background: #28a745;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    display: inline-block;
}

.question-block {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    border: 2px solid var(--professor-color);
}

.question-block.inactive {
    border-color: var(--border-color);
    opacity: 0.7;
}

.question-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-divider);
}

.question-title {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.question-meta {
    font-size: 0.9em;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.question-text {
    background: var(--question-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 1.05em;
    line-height: 1.6;
    color: var(--text-primary);
}

.answer-count {
    font-size: 0.9em;
    color: var(--professor-color);
    font-weight: 600;
    margin-bottom: 10px;
}

/* ==========================================
   학생용 페이지 (Student Page)
   ========================================== */

body.page-student {
    background: var(--bg-primary);
    padding: 15px;
}

body.page-student .container {
    max-width: 800px;
}

body.page-student .header {
    background: var(--bg-gradient-student);
}

body.page-student .card h2 {
    border-bottom-color: var(--student-color);
}

body.page-student input[type="text"]:focus,
body.page-student input[type="password"]:focus,
body.page-student input[type="number"]:focus,
body.page-student textarea:focus {
    border-color: var(--input-focus-student);
}

body.page-student textarea {
    min-height: 120px;
}

body.page-student .btn {
    background: var(--bg-gradient-student);
    width: 100%;
}

body.page-student .btn:hover {
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
}

body.page-student .classroom-info {
    background: var(--classroom-info-student);
}

.question-box {
    background: var(--question-bg);
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid var(--student-color);
}

.question-label {
    font-size: 0.9em;
    color: var(--student-color);
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.question-content {
    font-size: 1.2em;
    color: var(--text-primary);
    line-height: 1.6;
}

.success-message {
    background: var(--success-bg);
    color: var(--success-text);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid var(--success-border);
}

.error-message {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid var(--error-border);
}

.info-message {
    background: var(--info-bg);
    color: var(--info-text);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid var(--info-border);
}

.no-question {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px;
    font-style: italic;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

/* ==========================================
   반응형 미디어 쿼리 (Responsive)
   ========================================== */

@media (max-width: 768px) {
    .theme-toggle {
        top: 5px;
        right: 5px;
        padding: 5px 10px;
        z-index: 1001;
    }

    .theme-toggle .theme-label {
        display: none;
    }

    /* 모바일에서 body 패딩 완전 제거 - 네이티브 앱처럼 */
    body.page-professor,
    body.page-student,
    body.page-index {
        padding: 0;
        margin: 0;
    }

    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .header {
        padding: 40px 0px 12px 0px;
        border-radius: 0;
        margin: 0;
        position: relative;
        display: flex;
        flex-direction: column;
    }

    .header h1 {
        font-size: 1.4em;
        margin-bottom: 8px;
        margin-left: 10px;
        margin-right: 10px;
        order: 1;
    }

    .header #pageSubtitle {
        font-size: 0.9em;
        margin-bottom: 12px;
        margin-left: 10px;
        margin-right: 10px;
        order: 2;
    }

    /* 리더보드를 제목 다음에 배치 */
    .leaderboard {
        order: 3;
        margin-bottom: 12px;
        margin-left: 10px;
        margin-right: 10px;
    }

    /* 헤더 링크를 제목 아래로 이동 */
    .header-links {
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        margin: 0 10px;
        flex-wrap: wrap;
        gap: 6px;
        order: 4;
    }

    /* 학생 점수 정보 (헤더 밖에 있음) */
    .student-score-info {
        margin: 10px;
        padding: 10px;
    }

    .header-link-btn,
    .back-link {
        padding: 7px 12px;
        font-size: 0.85em;
        flex: 0 1 auto;
    }

    .card {
        padding: 12px 10px;
        border-radius: 0;
        margin: 0;
        box-shadow: none;
        border-bottom: 1px solid var(--border-divider);
    }

    .classroom-code {
        font-size: 1.5em;
    }

    .btn-secondary {
        margin-left: 0;
        margin-top: 10px;
    }

    .question-content {
        font-size: 1.1em;
    }
}

@media (max-width: 600px) {
    /* 소형 화면에서는 완전히 꽉 채움 */
    body {
        margin: 0;
        padding: 0;
    }

    body.page-index .container {
        padding: 0;
        border-radius: 0;
        margin: 0;
        max-width: 100%;
    }

    body.page-index .header {
        padding: 20px 0px;
        margin: 0;
        border-radius: 0;
    }

    body.page-index h1 {
        font-size: 1.8em;
        margin-left: 10px;
        margin-right: 10px;
    }

    body.page-index .btn {
        padding: 14px 20px;
        font-size: 1em;
        margin-left: 10px;
        margin-right: 10px;
    }

    .header {
        padding: 35px 0px 10px 0px;
    }

    .header h1 {
        margin-left: 8px;
        margin-right: 8px;
    }

    .header #pageSubtitle {
        margin-left: 8px;
        margin-right: 8px;
    }

    .leaderboard {
        margin-left: 8px;
        margin-right: 8px;
    }

    .header-links {
        margin-left: 8px;
        margin-right: 8px;
    }

    /* 학생 점수 정보 */
    .student-score-info {
        margin: 8px;
        padding: 8px;
    }

    .card {
        padding: 10px 8px;
    }

    .header-link-btn,
    .back-link {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

/* ==========================================
   객관식 문제 스타일
   ========================================== */

/* 문제 유형 선택 */
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.3s;
}

select:focus {
    outline: none;
    border-color: var(--input-focus-professor);
}

/* 선택지 관리 */
.choice-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.choice-input {
    flex: 1;
}

.btn-add-choice {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    margin-top: 10px;
    transition: background 0.3s;
}

.btn-add-choice:hover {
    background: #218838;
}

.btn-remove-choice {
    background: #dc3545;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.btn-remove-choice:hover {
    background: #c82333;
}

/* 문제 유형 뱃지 */
.question-type-badge {
    background: #6f42c1;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    margin-left: 8px;
    display: inline-block;
}

/* 선택지 표시 */
.choices-display {
    background: var(--question-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 3px solid var(--professor-color);
}

.choice-display-item {
    padding: 8px 0;
    color: var(--text-primary);
    display: flex;
    gap: 8px;
}

.choice-number {
    font-weight: 600;
    color: var(--professor-color);
    min-width: 25px;
}

/* 객관식 통계 및 차트 */
.mc-stats-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.pie-chart {
    flex-shrink: 0;
}

.stats-list {
    flex: 1;
}

.stats-item {
    margin-bottom: 15px;
}

.stats-label {
    display: flex;
    gap: 8px;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-primary);
}

.stats-bar-container {
    width: 100%;
    height: 25px;
    background: var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 5px;
}

.stats-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--professor-color), #8b9aff);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
}

.stats-value {
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 600;
}

/* 학생용 객관식 선택 */
.mc-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.mc-choice {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mc-choice:hover {
    border-color: var(--student-color);
    transform: translateX(5px);
}

.mc-choice.selected {
    border-color: var(--student-color);
    background: var(--classroom-info-student);
}

.mc-choice-radio {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
    position: relative;
}

.mc-choice.selected .mc-choice-radio {
    border-color: var(--student-color);
}

.mc-choice.selected .mc-choice-radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--student-color);
}

.mc-choice-text {
    flex: 1;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .mc-stats-container {
        flex-direction: column;
        align-items: center;
    }

    .pie-chart {
        width: 250px !important;
        height: 250px !important;
    }

    .stats-list {
        width: 100%;
    }
}

/* 선택지별 학생 목록 (배지 형태) */
.students-badges-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    background: var(--question-bg);
    border-radius: 6px;
    border-left: 3px solid var(--professor-color);
}

.student-choice-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    background: linear-gradient(135deg, var(--professor-color), #8b9aff);
    color: white;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    transition: all 0.2s;
    cursor: default;
}

.student-choice-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

/* 문제 삭제 버튼 */
.btn-delete-question {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 10px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-delete-question:hover {
    background: #c82333;
    transform: scale(1.05);
}

.btn-delete-question i {
    font-size: 0.9em;
}

/* 입장한 학생 목록 */
.students-badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    min-height: 60px;
    background: var(--question-bg);
    border-radius: 8px;
}

.student-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--professor-color), #8b9aff);
    color: white;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: all 0.3s;
    cursor: default;
}

.student-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.student-badge-compact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--professor-color), #8b9aff);
    color: white;
    border-radius: 16px;
    font-size: 0.75em;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.2);
    transition: all 0.2s;
    cursor: default;
    margin: 2px;
    min-width: 60px;
}

.student-badge-compact:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #7886ea, #9ba9ff);
}

.student-badge-compact .student-name {
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.student-badge-compact .kick-btn {
    display: none;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0 0 0 6px;
    margin: 0;
    font-size: 0.85em;
    line-height: 1;
    transition: color 0.2s;
}

.student-badge-compact:hover .kick-btn {
    display: inline-flex;
}

.student-badge-compact .kick-btn:hover {
    color: #ff6b6b;
}

.no-students {
    color: var(--text-tertiary);
    text-align: center;
    width: 100%;
    padding: 20px;
    font-style: italic;
}

/* 강의실 세션 종료 버튼 */
.btn-close-classroom {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.btn-close-classroom:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-close-classroom i {
    font-size: 1em;
}

/* 학생 퇴장 버튼 */
.btn-exit-classroom {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.btn-exit-classroom:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-exit-classroom i {
    font-size: 1em;
}

/* 문제 공개 버튼 */
.btn-open-question {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 10px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.btn-open-question:hover {
    background: #218838;
    transform: scale(1.05);
}

.btn-open-question i {
    font-size: 0.9em;
}

/* 답변 마감 버튼 */
.btn-close-question {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 10px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.btn-close-question:hover {
    background: #ffca2c;
    transform: scale(1.05);
}

.btn-close-question i {
    font-size: 0.9em;
}

/* 답변 재개 버튼 */
.btn-reopen-question {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 10px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.btn-reopen-question:hover {
    background: #138496;
    transform: scale(1.05);
}

.btn-reopen-question i {
    font-size: 0.9em;
}

/* 답변 마감 뱃지 */
.closed-badge {
    background: #6c757d;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    margin-left: 8px;
    display: inline-block;
    font-weight: 500;
}

.closed-badge-student {
    background: #6c757d;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    margin-left: 10px;
    display: inline-block;
    font-weight: 600;
}

/* 마감된 문제 스타일 (학생용) */
.question-box:has(+ * .closed-badge-student),
.question-box:has(.closed-badge-student) {
    opacity: 0.6;
    position: relative;
}

.question-box:has(+ * .closed-badge-student)::after,
.question-box:has(.closed-badge-student)::after {
    content: '답변 마감됨';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(108, 117, 125, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1em;
    pointer-events: none;
}

/* 마감된 객관식 선택지 */
.mc-choice.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.mc-choice.disabled:hover {
    transform: none;
    border-color: var(--border-color);
}

/* 학생용 문제 카드 */
.student-question-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s;
    border: 2px solid var(--border-color);
}

.student-question-card.answered {
    opacity: 0.6;
    background: var(--question-bg);
}

.student-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-divider);
}

.student-question-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
}

/* 답변 완료 뱃지 */
.answered-badge {
    background: #28a745;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    margin-left: 8px;
    display: inline-block;
    font-weight: 500;
}

/* ==========================================
   점수 시스템 스타일
   ========================================== */

.student-badge-with-score {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--card-bg);
    border: 2px solid var(--input-border);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.student-badge-with-score:hover {
    border-color: var(--primary-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.student-rank {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    font-size: 1.2em;
    border-radius: 50%;
    flex-shrink: 0;
}

.student-info {
    flex: 1;
    min-width: 0;
}

.student-name {
    font-weight: 600;
    font-size: 1.05em;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.student-id {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.student-score-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.student-score {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--primary-purple);
    min-width: 60px;
    text-align: right;
}

.score-buttons {
    display: flex;
    gap: 6px;
}

.btn-score-adjust,
.btn-score-set {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s ease;
    color: white;
}

.btn-score-adjust {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-width: 36px;
}

.btn-score-adjust:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-score-set {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-score-set:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(240, 147, 251, 0.3);
}

body.dark-mode .student-badge-with-score {
    background: var(--card-bg-dark);
    border-color: #444;
}

body.dark-mode .student-badge-with-score:hover {
    border-color: #667eea;
}

body.dark-mode .student-badge-compact {
    background: linear-gradient(135deg, #667eea, #6b7aef);
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.4);
}

body.dark-mode .student-badge-compact:hover {
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #7886ea, #7c88f5);
}

/* 학생 목록 컨테이너 조정 */
.students-badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* 리더보드 스타일 */
.leaderboard {
    margin: 20px 0;
    padding: 20px;
    background: var(--card-bg);
    border: 2px solid var(--input-border);
    border-radius: 12px;
}

.leaderboard h3 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.leaderboard h3:hover {
    color: var(--professor-color);
}

.leaderboard h3 .toggle-icon {
    margin-left: auto;
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.leaderboard h3 .toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.leaderboard-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.leaderboard-list.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

/* 반응형: 작은 화면에서는 2열로 */
@media (max-width: 768px) {
    .leaderboard-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 매우 작은 화면에서는 1열로 */
@media (max-width: 480px) {
    .leaderboard-list {
        grid-template-columns: 1fr;
    }
}

.leaderboard-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Scoreboard styles */
.scoreboard-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.scoreboard-content.collapsed {
    max-height: 0;
    opacity: 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.leaderboard-item:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.leaderboard-medal {
    font-size: 1.8em;
    min-width: 40px;
    text-align: center;
}

.leaderboard-rank {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9em;
}

.leaderboard-student-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.leaderboard-student-name {
    font-weight: bold;
    font-size: 1em;
    color: var(--text-primary);
}

.leaderboard-student-id {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.leaderboard-score {
    font-size: 1.1em;
    font-weight: bold;
    color: #667eea;
    min-width: 60px;
    text-align: right;
}

/* 학생 점수 정보 (학생 페이지 헤더) */
.student-score-info {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 15px;
    justify-content: center;
}

.score-badge, .rank-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.score-badge i, .rank-badge i {
    font-size: 1.2em;
}

/* 다크 모드 조정 */
[data-theme="dark"] .leaderboard {
    border-color: #444;
}

[data-theme="dark"] .leaderboard-item {
    background: #2a2a2a;
    border-color: #444;
}

[data-theme="dark"] .leaderboard-item:hover {
    background: #333;
}
