/* ================================
   레벨테스트 관리 페이지 스타일
   ================================ */

.leveltest-view {
    padding: 20px;
}

.leveltest-view .view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.leveltest-view .view-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.leveltest-view .header-actions {
    display: flex;
    gap: 10px;
}

/* 탭 */
.leveltest-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
}

.leveltest-tabs .tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #6b7280;
    transition: all 0.2s;
}

.leveltest-tabs .tab-btn:hover {
    color: #3b82f6;
}

.leveltest-tabs .tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    font-weight: 600;
}

/* 탭 콘텐츠 */
.tab-content {
    display: block;
}

.tab-content#tabQuestions {
    display: block;
}

/* 통계 요약 */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stats-summary .stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.stats-summary .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
}

.stats-summary .stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 5px;
}

/* 필터 바 */
.filter-bar {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 15px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
}

.filter-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

.filter-bar .filter-group label {
    font-size: 0.8rem;
    color: #6b7280;
}

.filter-bar .filter-group select,
.filter-bar .filter-group input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.9rem;
    height: 38px;
}

.filter-bar .btn {
    height: 38px;
    white-space: nowrap;
}

/* 테이블 */
.questions-table-container,
.results-table-container {
    overflow-x: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.85rem;
    color: #374151;
    white-space: nowrap;
}

.data-table td {
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.question-text-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loading-cell,
.empty-cell,
.error-cell {
    text-align: center;
    padding: 40px !important;
    color: #6b7280;
}

.error-cell {
    color: #ef4444;
}

/* 배지 */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-section {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-section-mini {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #e0e7ff;
    color: #3730a3;
}

.sections-cell {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
}

.actions-cell {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.badge-level {
    background: #dbeafe;
    color: #1e40af;
}

.badge-PreA1 { background: #fef3c7; color: #92400e; }
.badge-A1 { background: #d1fae5; color: #065f46; }
.badge-A2 { background: #cffafe; color: #155e75; }
.badge-B1 { background: #e0e7ff; color: #3730a3; }
.badge-B2 { background: #fce7f3; color: #9d174d; }

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* 액션 버튼 */
.actions-cell {
    white-space: nowrap;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.8rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    color: #374151;
}

.btn-xs:hover {
    background: #f3f4f6;
}

.btn-xs.btn-delete,
.btn-xs.btn-delete-result {
    color: #dc2626;
}

.leveltest-view .btn-danger {
    background: white;
    color: #dc2626;
    border: 1px solid #dc2626;
}

.leveltest-view .btn-danger:hover {
    background: #dc2626;
    color: white;
}

/* 페이지네이션 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 15px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.page-btn:hover {
    background: #f3f4f6;
}

.page-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* 모달 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-large {
    max-width: 800px;
}

.leveltest-view .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #3b82f6;
    border-bottom: none;
}

.leveltest-view .modal-header h2 {
    margin: 0;
    font-size: 1rem;
    color: white;
    font-weight: 500;
}

.leveltest-view .modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: white;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
}

/* 폼 */
.leveltest-view .form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.leveltest-view .form-row.form-row-2 {
    grid-template-columns: repeat(2, 1fr);
}



.leveltest-view .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
}

.leveltest-view .form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

.leveltest-view .form-group input,
.leveltest-view .form-group select,
.leveltest-view .form-group textarea {
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
    height: 40px;
}

.leveltest-view .form-group textarea {
    height: auto;
}

.leveltest-view .form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.leveltest-view .form-group input:focus,
.leveltest-view .form-group select:focus,
.leveltest-view .form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 통계 상세 */
.stats-detail {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.stats-section h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #374151;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.stats-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
}

.stats-card h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #374151;
    text-transform: capitalize;
}

.stats-card .stats-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #3b82f6;
}

.stats-card .stats-sub {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 5px;
}

.stats-card .stats-levels {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.stats-card .level-stat {
    font-size: 0.75rem;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
}

/* 결과 상세 모달 */
.result-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.result-date {
    color: #6b7280;
    font-size: 0.9rem;
}

.result-info p {
    margin: 5px 0;
    color: #4b5563;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.summary-item {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.summary-item .label {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 5px;
}

.summary-item .value {
    font-size: 1.2rem;
    font-weight: 600;
}

.result-sections h4 {
    margin: 0 0 10px 0;
    color: #374151;
}

.section-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 8px;
}

.section-result .section-name {
    font-weight: 600;
    min-width: 100px;
}

.section-result .section-level {
    min-width: 60px;
    text-align: center;
}

.section-result .section-score {
    font-weight: 500;
    color: #374151;
    min-width: 60px;
    text-align: right;
}

/* 반응형 */
@media (max-width: 768px) {
    .stats-summary {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-wrap: wrap;
    }
    
    .result-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}
