/* ==================== 스마트 안전관리 교육센터 - 나의 강의실 전용 스타일 ==================== */

/* ==================== 1. 기본 레이아웃 & 도화지 배경 ==================== */
body { background-color: #fff; }

.mypage-container { display: flex; max-width: 1200px; margin: 40px auto; min-height: 800px; border-top: 2px solid #111; }

/* ==================== 2. 좌측 사이드바 (LNB) ==================== */
.mypage-sidebar { width: 240px; border-right: 1px solid #eaeaea; padding: 30px 20px 30px 0; flex-shrink: 0; }
.mypage-sidebar h3 { font-size: 18px; font-weight: 800; color: #111; margin-bottom: 20px; padding-left: 10px; }
.mypage-menu li { margin-bottom: 5px; }
.mypage-menu li a { display: block; padding: 14px 20px; font-size: 15px; font-weight: 700; color: #666; border-radius: 8px; transition: 0.2s; cursor: pointer; }
.mypage-menu li a:hover { background-color: #f8fafc; color: #111; }
.mypage-menu li a.active { background-color: #f1f5f9; color: #0d4a96; font-weight: 800; }
.mypage-menu li a i { margin-right: 10px; width: 16px; text-align: center; }

/* ==================== 3. 우측 메인 콘텐츠 및 탭 전환 ==================== */
.mypage-content { flex: 1; padding: 30px 0 50px 50px; }
.tab-pane { display: none; animation: fadeIn 0.3s ease; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #eaeaea; padding-bottom: 15px; }
.section-header h2 { font-size: 24px; font-weight: 800; color: #111; }

/* ==================== 4. 공통 버튼 스타일 ==================== */
.btn { padding: 12px 24px; border-radius: 6px; font-size: 14px; font-weight: 700; cursor: pointer; border: none; transition: 0.2s; text-align: center; }
.btn-primary { background: #0056b3; color: #fff; }
.btn-primary:hover { background: #004085; }
.btn-outline { background: #fff; border: 1px solid #cbd5e1; color: #475569; }
.btn-outline:hover:not(:disabled) { background: #f8fafc; border-color: #94a3b8; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ==================== 5. 수강신청 탭 (내부 탭 및 테이블) ==================== */
/* 💡 안전보건 / 법정필수 분리용 내부 탭 스타일 */
.inner-tabs { display: flex; gap: 10px; border-bottom: 1px solid #eaeaea; margin-bottom: 24px; }
.inner-tabs button { padding: 12px 24px; font-size: 15px; font-weight: 700; color: #666; background: none; border: none; border-bottom: 3px solid transparent; cursor: pointer; transition: 0.2s; }
.inner-tabs button.active { color: #0d4a96; border-bottom-color: #0d4a96; }
.inner-tabs button:hover:not(.active) { color: #111; }

.apply-pane { display: none; animation: fadeIn 0.3s ease; }

.course-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.course-table th, .course-table td { padding: 16px; border-bottom: 1px solid #f1f5f9; text-align: center; vertical-align: middle; }
.course-table th { background-color: #f8fafc; font-weight: 700; color: #475569; border-top: 1px solid #e1e8f0; border-bottom: 1px solid #e1e8f0; }
.course-table tbody tr:hover { background-color: #f8fafc; }
.course-table .text-left { text-align: left; font-weight: 700; color: #111; }

/* ==================== 6. 수강 강의 카드 UI (수강 중 / 완료 강의) ==================== */
.course-card { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    background: #fff; 
    border: 1px solid #e1e8f0; 
    border-radius: 12px; 
    padding: 30px; 
    margin-bottom: 20px; 
    transition: 0.2s; 
}
.course-card:hover { border-color: #cbd5e1; box-shadow: 0 4px 15px rgba(0,0,0,0.03); transform: translateY(-2px); }

/* 완료된 강의 카드는 배경색을 살짝 어둡게, 호버 액션 제거 */
.course-card.completed { background: #f8fafc; border-color: #e2e8f0; }
.course-card.completed:hover { transform: none; box-shadow: none; }

/* 강의 정보 텍스트 영역 */
.course-info { flex: 2; padding-right: 20px; }
.course-title { font-size: 18px; font-weight: 800; color: #111; margin: 12px 0 8px 0; line-height: 1.4; }
.course-period { font-size: 14px; color: #666; font-weight: 700; }

/* 과목 분류 뱃지 */
.badge { display: inline-block; padding: 4px 10px; font-size: 12px; font-weight: 800; border-radius: 4px; }
.badge-safe { background: #e0e7ff; color: #4338ca; } /* 안전보건: 남색톤 */
.badge-law { background: #fce7f3; color: #be185d; } /* 법정필수: 자주톤 */

/* ==================== 7. 프로그레스 바 (진도율 바) ==================== */
.progress-section { flex: 1.5; padding: 0 30px; border-left: 1px solid #f1f5f9; border-right: 1px solid #f1f5f9; }
.progress-info { display: flex; justify-content: space-between; font-size: 14px; font-weight: 800; margin-bottom: 10px; color: #475569; }

.progress-bar-bg { width: 100%; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease-in-out; }

/* 색상 유틸리티 */
.bg-blue { background-color: #0d4a96; }
.bg-green { background-color: #16a34a; }
.text-blue { color: #0d4a96; }
.text-green { color: #16a34a; }

/* ==================== 8. 우측 액션 버튼 영역 ==================== */
.course-action { flex: 0 0 auto; margin-left: 30px; display: flex; gap: 10px; justify-content: center; align-items: center; }
.course-action.flex-col { flex-direction: column; }
.course-action .btn { min-width: 140px; }

/* ==================== 9. 모바일 반응형 완벽 대응 (갤럭시 S21~S23 기준 768px 이하) ==================== */
@media (max-width: 768px) {
    /* 1. 전체 레이아웃 세로 배치 (사이드바 위, 본문 아래) */
    .mypage-container {
        flex-direction: column;
        margin: 20px auto;
        border-top: none;
    }

    /* 2. 좌측 사이드바 -> 상단 가로 스와이프 탭으로 변신 */
    .mypage-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eaeaea;
        padding: 15px;
        box-sizing: border-box;
    }
    .mypage-sidebar h3 {
        font-size: 16px;
        margin-bottom: 15px;
        padding-left: 0;
    }
    .mypage-menu {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
    }
    .mypage-menu::-webkit-scrollbar { display: none; }
    .mypage-menu li { margin: 0; }
    .mypage-menu li a {
        padding: 10px 15px;
        font-size: 14px;
        border: 1px solid #eaeaea;
    }
    .mypage-menu li a.active { border-color: #0d4a96; }

    /* 3. 우측 메인 콘텐츠 여백 초기화 및 타이틀 축소 */
    .mypage-content {
        padding: 20px 15px;
        width: 100%;
        box-sizing: border-box;
    }
    .section-header h2 { font-size: 20px; }

    /* 4. 수강신청 탭: 테이블 화면 꽉 차게 맞춤 (잘림 방지) */
    .inner-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
    .inner-tabs button {
        padding: 10px 15px;
        font-size: 14px;
    }
    .apply-pane {
        overflow-x: hidden; /* 가로 스크롤 제거 */
    }
    .course-table {
        min-width: 100%; /* 💡 480px 강제 고정을 풀고 화면에 100% 딱 맞춤 */
        word-break: keep-all; /* 단어가 중간에 안 끊기게 줄바꿈 */
    }
    .course-table th, .course-table td {
        padding: 12px 5px; /* 💡 양옆 여백을 10px -> 5px로 줄여 공간 확보 */
        font-size: 12px;
    }
    .course-table .text-left {
        font-size: 13px; 
    }
    
    /* 💡 버튼 영역 크기 최소화 및 최적화 */
    .course-table td:last-child {
        width: 75px; 
        white-space: nowrap;
    }
    .course-table td .btn-sm {
        padding: 6px 10px; /* 버튼 안쪽 여백 축소 */
        font-size: 11px;   /* 버튼 글씨 축소 */
        width: 100%;
        box-sizing: border-box;
    }
    
    /* 💡 '학습중 + 수강취소'가 같이 뜰 때 가로로 밀리지 않게 위아래로 배치 */
    .course-table td div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 4px !important;
    }

    /* 5. 수강 강의 카드 (가로 배치 -> 세로 배치로 완벽 변환) */
    .course-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px 15px;
        gap: 15px;
    }
    .course-info {
        width: 100%;
        padding-right: 0;
    }
    .course-title {
        font-size: 16px;
        margin: 8px 0;
    }
    
    /* 진도율 막대그래프 영역을 위아래 점선으로 분리 */
    .progress-section {
        width: 100%;
        padding: 15px 0;
        border-left: none;
        border-right: none;
        border-top: 1px dashed #e2e8f0;
        border-bottom: 1px dashed #e2e8f0;
        box-sizing: border-box;
    }
    
    /* 강의실 입장 / 복습하기 버튼 가로 꽉 차게 확장 */
    .course-action {
        width: 100%;
        margin-left: 0;
    }
    .course-action .btn {
        width: 100%; 
    }
    
    /* 6. 수강 현황 요약 박스 (학습 진행 중 0건) 크기 최적화 */
    #tab-learning > div:nth-child(2) {
        padding: 15px !important;
    }
    #tab-learning > div:nth-child(2) > div {
        transform: scale(0.9); /* 글씨 튀어나가지 않게 비율 살짝 축소 */
    }
}

/* ==================== 모바일 수강 현황 요약 박스 회색 긴 상자 깨짐 완벽 해결 ==================== */
@media (max-width: 768px) {
    /* 수강 현황 요약 박스 전체 영역 */
    #tab-learning > div:nth-child(2),
    .mypage-content .mypage-content-box,
    .mypage-content div[style*="background"] {
        box-sizing: border-box !important;
        width: 100% !important;
        overflow: hidden !important;
    }

    /* 가운데 늘어져 있는 회색 박스(구분선 또는 빈 공간) 강제 숨김 및 크기 안정화 */
    #tab-learning > div:nth-child(2) hr,
    #tab-learning > div:nth-child(2) .divider,
    #tab-learning > div:nth-child(2) div[style*="background"],
    .mypage-content div[style*="width: 1px"],
    .mypage-content div[style*="border-left"] {
        display: none !important; /* 모바일에서 깨짐을 유발하는 불필요한 세로 구분선은 숨김 처리 */
    }

    /* 학습 진행 중 / 수강 완료 항목들이 모바일에서 균등하게 예쁘게 배치되도록 조정 */
    #tab-learning > div:nth-child(2) > div,
    .mypage-content .summary-flex-box {
        display: flex !important;
        justify-content: space-around !important;
        align-items: center !important;
        width: 100% !important;
        gap: 10px !important;
        transform: none !important; /* 이전 스케일 축소 효과 초기화 */
    }
}