/* ==================== 스마트 안전관리 교육센터 관리자 대시보드 전용 스타일 ==================== */

/* 1. 기본 레이아웃 & 도화지 배경 */
body { background-color: #fff; margin: 0; padding: 0; font-family: 'Pretendard', sans-serif; }
a { text-decoration: none; color: inherit; }

.admin-container { display: flex; max-width: 1400px; margin: 40px auto; min-height: 800px; border-top: 2px solid #111; }

/* 2. 좌측 사이드바 (LNB) */
.admin-sidebar { width: 260px; border-right: 1px solid #eaeaea; padding: 30px 20px 30px 0; flex-shrink: 0; }
.admin-sidebar h3 { font-size: 18px; font-weight: 800; color: #111; margin-bottom: 20px; padding-left: 10px; }
.admin-menu { list-style: none; padding: 0; margin: 0; }
.admin-menu li { margin-bottom: 5px; }
.admin-menu li a { display: block; padding: 14px 20px; font-size: 15px; font-weight: 700; color: #666; border-radius: 8px; transition: 0.2s; cursor: pointer; text-decoration: none; }
.admin-menu li a:hover { background-color: #f8fafc; color: #111; }
.admin-menu li a.active { background-color: #f1f5f9; color: #0d4a96; font-weight: 800; }
.admin-menu li a i { margin-right: 10px; width: 16px; text-align: center; }

/* 3. 우측 메인 콘텐츠 및 탭 애니메이션 */
.admin-content { flex: 1; padding: 30px 0 50px 40px; overflow-x: auto; }
.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: 30px; border-bottom: 1px solid #eaeaea; padding-bottom: 15px; flex-wrap: wrap; }
.section-header h2 { font-size: 24px; font-weight: 800; color: #111; margin: 0; }
.section-header p { margin: 5px 0 0 0; color: #666; font-size: 14px; }

/* ==================== 4. 입력 폼 스타일 (비율 조절 적용) ==================== */
.admin-form-box { background: #fff; border: 1px solid #e1e8f0; border-radius: 8px; padding: 30px; margin-bottom: 40px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 40px; }
.form-grid.full { grid-template-columns: 1fr; }

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 14px; font-weight: 700; color: #333; }
.form-group label .req { color: #e11d48; margin-left: 4px; }

.form-group input[type="text"], 
.form-group input[type="password"], 
.form-group select { 
    padding: 12px; 
    border: 1px solid #cbd5e1; 
    border-radius: 6px; 
    font-size: 14px; 
    outline: none; 
    transition: 0.2s; 
    max-width: 380px; 
    width: 100%; 
    box-sizing: border-box;
    font-family: inherit;
}
.form-group textarea { padding: 12px; border: 1px solid #cbd5e1; border-radius: 6px; outline: none; width: 100%; resize: vertical; box-sizing: border-box; font-family: inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #0d4a96; }

.inline-group { display: flex; align-items: center; gap: 10px; max-width: 380px; }
.inline-group input { flex: 1; min-width: 0; }
.inline-group .dash { color: #94a3b8; }

/* ==================== 5. 공통 버튼 스타일 ==================== */
.btn-group { display: flex; gap: 10px; margin-top: 20px; }
.btn { padding: 12px 24px; border-radius: 6px; font-size: 14px; font-weight: 700; cursor: pointer; border: none; transition: 0.2s; display: inline-flex; align-items: center; justify-content: 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 { background: #f8fafc; border-color: #94a3b8; }
.btn-danger { background: #e11d48; color: #fff; padding: 6px 12px; font-size: 13px; border-radius: 4px; }
.btn-danger:hover { background: #be123c; }

/* ==================== 6. 데이터 리스트 테이블 (글씨 깨짐/줄바꿈 완벽 방지) ==================== */
.data-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.data-table th, .data-table td { 
    padding: 15px; 
    border-bottom: 1px solid #f1f5f9; 
    text-align: center; 
    vertical-align: middle; 
    white-space: nowrap; /* 💡 표 안의 글자가 밑으로 떨어지지 않게 고정 */
}
.data-table th { background-color: #f8fafc; font-weight: 700; color: #475569; border-top: 1px solid #e1e8f0; border-bottom: 1px solid #e1e8f0; }
.data-table tbody tr:hover { background-color: #f8fafc; }
.data-table .text-left { text-align: left; }

/* 클릭 가능한 텍스트 링크 (강좌명 등) */
.clickable-link { color: #1a73e8; font-weight: 700; cursor: pointer; transition: 0.2s; }
.clickable-link:hover { text-decoration: underline; color: #0d4a96; }

/* 클릭 가능한 숫자(뱃지) 스타일 */
.clickable-count { 
    display: inline-block;
    background-color: #f8fafc; /* 아주 연한 도화지 회색 */
    border: 1px solid #e2e8f0; /* 깔끔하고 얇은 테두리 */
    padding: 6px 14px; 
    border-radius: 6px; 
    font-size: 14px; 
    font-weight: 700; 
    cursor: pointer; 
    transition: 0.2s; 
}
.clickable-count:hover { 
    background-color: #f1f5f9; 
    border-color: #cbd5e1;
    transform: translateY(-1px); /* 마우스 올릴 때 살짝 뜨는 효과 */
}

/* ==================== 7. 모달 팝업 스타일 ==================== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }

.modal-content { background: #fff; width: 900px; max-height: 90vh; overflow-y: auto; border-radius: 8px; padding: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #111; padding-bottom: 15px; margin-bottom: 20px; }
.modal-header h3 { font-size: 20px; font-weight: 800; margin: 0; }

.close-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: #666; transition: 0.2s; padding: 0; }
.close-btn:hover { color: #111; }

/* ==================== 8. 신규 강좌 등록 (차시 입력 박스) ==================== */
.chapter-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 20px; margin-bottom: 15px; position: relative; }
.chapter-box .box-title { font-weight: 800; color: #0d4a96; margin-bottom: 15px; font-size: 14px; }
.chapter-box .btn-remove { position: absolute; top: 20px; right: 20px; background: none; border: none; color: #e11d48; font-weight: 700; cursor: pointer; font-size: 13px; }
.chapter-box .btn-remove:hover { text-decoration: underline; }
.chapter-box .input-row { display: flex; gap: 15px; margin-bottom: 10px; }
.chapter-box .input-row input { flex: 1; padding: 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; outline: none; }
.chapter-box .input-row input:focus { border-color: #0d4a96; }

/* ==================== 9. 깔끔한 윤곽선 버튼 & X 버튼 ==================== */
.btn-clean-outline {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e3a8a;
    padding: 0 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    height: 46px; 
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-clean-outline:hover {
    border-color: #1e3a8a;
    background-color: #f8fafc;
}

/* 깔끔한 X 아이콘 버튼 */
.btn-clear-x {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 18px;
    cursor: pointer;
    padding: 10px;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-clear-x:hover {
    color: #b91c1c;
    transform: scale(1.1);
}

/* ==================== 10. 모바일 반응형 완벽 대응 (갤럭시 S21~S23 기준 768px 이하) ==================== */
@media (max-width: 768px) {
    /* 1. 레이아웃 세로 배치 (사이드바 위, 콘텐츠 아래) */
    .admin-container {
        flex-direction: column;
        margin: 0;
        border-top: none;
    }

    /* 2. 관리자 사이드바 -> 상단 가로 스와이프 메뉴로 변신 */
    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eaeaea;
        padding: 20px 15px;
        box-sizing: border-box;
    }
    .admin-sidebar h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    .admin-menu {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
    }
    .admin-menu::-webkit-scrollbar { display: none; }
    .admin-menu li { margin: 0; }
    .admin-menu li a {
        padding: 10px 15px;
        font-size: 14px;
        border: 1px solid #eaeaea;
    }
    .admin-menu li a.active { border-color: #0d4a96; }

    /* 3. 메인 콘텐츠 여백 및 글씨 크기 축소 */
    .admin-content {
        padding: 20px 15px;
        width: 100%;
        box-sizing: border-box;
    }
    .section-header h2 { font-size: 20px; }
    
    /* 4. 입력 폼 가로 2칸 -> 세로 1칸으로 변경 */
    .admin-form-box { padding: 20px 15px; }
    .form-grid { grid-template-columns: 1fr; gap: 15px; }
    
    .form-group input[type="text"], 
    .form-group input[type="password"], 
    .form-group select,
    .inline-group { max-width: 100%; } /* 모바일에서 꽉 차게 */
    
    /* 수강 등록 탭의 가로 배치된 요소들을 세로로 분리 */
    .form-group > div[style*="display: flex"] {
        flex-direction: column;
        gap: 10px;
    }
    .form-group > div[style*="display: flex"] > select,
    .form-group > div[style*="display: flex"] > input,
    .form-group > div[style*="display: flex"] > button {
        width: 100%;
        flex: none !important; 
    }

    /* 5. 데이터 리스트 표 폰트 축소 (가로 스크롤은 이미 적용됨) */
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 10px; }

    /* 6. 모달(팝업창) 모바일 꽉 차게 변경 */
    .modal-content {
        width: 95% !important; /* HTML의 인라인 스타일(800px 등) 강제 무시 */
        padding: 20px;
        margin: 10px;
    }
    .modal-header h3 { font-size: 18px; }

    /* 7. 강좌 차시 등록 화면 모바일 맞춤 */
    .chapter-row {
        flex-direction: column;
        align-items: stretch !important;
        padding: 20px 15px 15px 15px !important;
        position: relative;
    }
    .chapter-row .btn-clear-x {
        position: absolute;
        top: 10px;
        right: 10px;
    }
    .chapter-row > div {
        text-align: left !important;
        margin-bottom: 5px;
    }
    
    /* 8. 버튼 모바일 크기 최적화 */
    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; }
}