@charset "utf-8";
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

#bookWrap {
    width: 100%;
    max-width: 1280px; /* 룰북 게시판 폭 제한 유지 */
    margin: 0 auto;
    font-family: "Pretendard Variable", "Pretendard", sans-serif;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
   text-decoration: none;
}

/* 1. 통합 래퍼 (탭 디자인 호환용) */
.unified-wrapper {
    background: var(--bg-card);
    border: var(--border-width) solid var(--line);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 40px -5px rgba(0,0,0,0.5);
    margin-bottom: 20px;
    overflow: hidden; 
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 2. 게시판 헤더 */
.sc-header {
    background: var(--bg-header);
    border-top: 1px solid var(--line); /* 중요: 탭과 이어지는 라인 */
    border-bottom: 1px solid var(--line);
    padding: 15px 20px;
    display: flex; align-items: center; justify-content: space-between;
}
.sc-header h2 {
    margin: 0; font-size: 16px; font-weight: 700; color: #fff;
    display: flex; align-items: center; gap: 8px;
}

/* 3. 버튼 스타일 (시나리오 게시판 스타일) */
.btn_write, .btn_action {
    background: rgba(100, 255, 218, 0.1); color: var(--accent) !important;
    border: var(--border-width) solid var(--accent); padding: 6px 14px; border-radius: var(--border-radius);
    font-weight: 600; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
}
.btn_write:hover, .btn_action:hover { background: var(--accent); color: var(--text-btn-hover) !important; }

/* 관리자용/취소 버튼 */
.btn_admin, .btn_cancel {
    background: transparent; border: 1px solid rgba(255,255,255,0.2); 
    color: var(--text-muted) !important; padding: 6px 14px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.btn_admin:hover, .btn_cancel:hover { border-color: #fff; color: #fff !important; }

/* 4. 테이블 스크롤 영역 */
.table-wrapper {
    width: 100%;
    max-height: 650px;
    overflow-y: auto;
    background: var(--bg-table-head);
    border-top: none; /* 헤더와 중복 라인 제거 */
}
/* 스크롤바 디자인 */
.table-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrapper::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
.table-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.table-wrapper::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* 5. 테이블 공통 스타일 */
.sc-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 800px; }

.sc-table thead th {
    position: sticky; top: 0; z-index: 10;
    background: var(--bg-table-head);
    color: var(--text-muted); font-weight: 600; padding: 12px;
    border-bottom: var(--border-width) solid var(--line); text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.sc-table td {
    padding: 12px; 
    border-bottom: 1px solid var(--line-light);
    vertical-align: middle; color: #e2e8f0;
}

/* --- [Rulebook Specific Styles] --- */
/* 룰북 계층 구조 및 순서 편집 */

/* 메인 룰북 행 */
.rb-parent { background: transparent; transition: background 0.2s; }
.rb-parent:hover { background: rgba(100, 255, 218, 0.02); }
.rb-parent.is-primary td.rb-subject-cell { color: var(--accent-gold); font-weight: 700; }
.rb-parent.is-primary { background: linear-gradient(90deg, rgba(255, 236, 179, 0.05), transparent); }

/* 서플리먼트(자식) 행 */
.rb-child { background: var(--nav-bg-inactive); display: none; } /* 기본 숨김 */
.rb-child:hover { background: rgba(0, 0, 0, 0.2); }
.rb-child td { color: var(--text-muted) !important; font-size: 0.95em; }

/* 제목 셀 및 트리 아이콘 */
.rb-subject-cell { text-align: left !important; padding-left: 15px !important; position: relative; }
.rb-subject-link { display: flex; align-items: center; }
.rb-child .rb-subject-link { padding-left: 20px; }
.rb-child .rb-subject-link::before { 
    content: '└'; margin-right: 8px; color: var(--text-muted);
}

/* 토글 버튼 */
.rb-toggle {
    background: transparent; border: 1px solid rgba(255,255,255,0.2); color: var(--text-muted);
    width: 20px; height: 20px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; cursor: pointer; margin-right: 8px; transition: 0.2s;
}
.rb-toggle:hover { border-color: var(--accent); color: var(--accent); }
.rb-toggle[aria-expanded="true"] { transform: rotate(90deg); border-color: var(--accent); color: var(--accent); }

/* 배지 스타일 (시나리오 게시판과 통일) */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; margin-right: 2px; }
.badge-type { border: 1px solid var(--line); color: var(--text-muted); }
.badge-primary { border: 1px solid var(--accent-gold); color: var(--accent-gold); background: rgba(255, 236, 179, 0.05); }
.badge-rule {  border: 1px solid var(--line); color: var(--text-muted);  }
.badge-supp {  border: 1px solid var(--line); color: var(--text-muted); }

  /* 숙련도 배지 (마스터 / 능숙 / 무난 / 초보 / 재활필요 / 미입문) */
  .lv-master   { border: 1px solid var(--accent-gold); color: var(--accent-gold); background: rgba(255, 236, 179, 0.08); }
  .lv-skilled  { border: 1px solid var(--accent); color: var(--accent); background: rgba(100, 255, 218, 0.08); }
  .lv-normal   { border: 1px solid var(--accent); color: var(--accent); background: rgba(100, 255, 218, 0.03); }
  .lv-beginner { border: 1px solid var(--text-muted); color: var(--text-muted); background: rgba(255,255,255,0.05); }
  .lv-rehab    { border: 1px solid var(--accent-pink); color: var(--accent-pink); background: rgba(244, 114, 182, 0.08); }
  .lv-none     { border: 1px solid var(--line); color: var(--text-muted); background: transparent; }

  /* 가능 역할 배지 */
  .badge-role  { border: 1px solid var(--line); color: var(--text-primary); background: rgba(255,255,255,0.04); }

/* 입력 폼 스타일 (쓰기 페이지용 - 시나리오 게시판 스타일 적용) */
.sc-write-table { width: 100%; border-collapse: collapse; }
.sc-write-table th { width: 130px; text-align: left; color: var(--accent); padding: 15px 5px; font-weight: 600; }
.sc-write-table td { padding: 10px 5px; border-bottom: var(--border-width) solid var(--line-light); }

.sc-input, .sc-select, .form-control {
    background: var(--bg-input); border: 1px solid var(--line); color: #fff;
    padding: 10px; border-radius: 6px; width: 100%; outline: none; box-sizing: border-box;
}
.sc-input:focus, .sc-select:focus { border-color: var(--accent); }

/* 모바일 카드 뷰 (룰북 전용) */
.mobile-view-area { display: none; padding: 15px; }
.pc-view-area { display: block; }
@media (max-width: 768px) {
    .pc-view-area { display: none !important; }
    .mobile-view-area { display: block; 
        background: var(--bg-card) !important; /* 배경색 강제 적용 */
        padding: 15px;
        min-height: 400px; /* 박스가 작아 보이지 않게 최소 높이 설정 */
        border-radius: 0 0 8px 8px; /* 하단 라운드 처리 */}
    .sc-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    
    .mo-card { background: rgba(20,30,40,0.5); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
    .mo-head { padding: 12px; background: rgba(255,255,255,0.03); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
    .mo-body { padding: 12px; }
    .mo-supp-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); color: var(--text-muted); font-size: 13px; }
    .mo-supp-list li:last-child { border-bottom: none; }
}

/* 모달 (팝업) 스타일 */
@keyframes modalPop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.ts-modal {    
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center; align-items: center;
}

.ts-modal.active { display: flex; }

.ts-card {    
    background: var(--bg-card); /* 전체 배경색 사용 */
    border: 1px solid var(--accent); /* 민트색 테두리 */
    box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.15); /* 민트색 발광 */
    width: 90%; max-width: 500px;
    border-radius: 12px;
    position: relative;
    display: flex; flex-direction: column;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ts-card .head { 
    padding: 15px 20px; 
    border-bottom: 1px solid var(--line); 
    background: transparent; /* [수정] 배경색 투명화 */
    display: flex; justify-content: space-between; align-items: center;
    color: var(--accent); font-weight: 700; font-size: 16px;
}

.ts-card .body { padding: 20px; overflow-y: auto; max-height: 80vh; }

.ts-card .foot { 
    border-top: 1px solid var(--line); 
    background: transparent; 
    display: flex; justify-content: space-between; 
    align-items: center;
    gap: 8px; 
}

/* [추가] 모달 전용 버튼 (시나리오 스타일) */
.btn-del { 
    background: transparent; border: 1px solid #f472b6; color: #f472b6; 
    padding: 8px 15px; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 13px;
    transition: 0.2s;
}
.btn-del:hover { background: var(--accent-pink); color: var(--text-btn-hover); }

.btn-save { 
    background: var(--accent); border: 1px solid var(--accent); color: #000; 
    padding: 8px 20px; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 13px;
    transition: 0.2s;
}
.btn-save:hover { background: #fff; border-color: #fff; }

/* 순서 편집용 */
.col-order { display: none; width: 60px; text-align: center; color: var(--text-muted); cursor: grab; }
.edit-mode .col-order { display: table-cell !important; }



/* --- 버튼 및 액션 스타일 (스킨 전용) --- */
.btn-header {
    height: 25px; 
    padding: 0 15px; 
    font-size: 13px;
    background: transparent; 
    border: var(--border-width) solid var(--accent); /* 테두리 굵기 및 색상 변수 */
    color: var(--accent) !important;
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    font-weight: bold; 
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.btn-header:hover {
    background: var(--accent); 
    color: var(--text-btn-hover) !important;
    box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.4); /* RGB 변수로 발광 효과 */
}

/* 모달 전용 버튼들 (배경 채움 + 여백 축소) */
.btn-modal-save {
    height: 40px;
    padding: 0 22px;
    background: var(--accent);
    border: var(--border-width) solid var(--accent);
    color: var(--text-btn-hover) !important;
    font-size: 14px;
    font-weight: bold;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: filter 0.2s ease;
}

.btn-modal-save:hover {
    filter: brightness(1.1);
}

.btn-modal-del {
    height: 40px;
    padding: 0 18px;
    background: var(--accent-red);
    border: var(--border-width) solid var(--accent-red);
    color: var(--text-white) !important;
    font-size: 14px;
    font-weight: bold;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: filter 0.2s ease;
}

.btn-modal-del:hover {
    filter: brightness(1.1);
}

/* 요청 5: 등록/수정 모달 입력칸 — 흰 배경 / 검은 글자 */
#rb-modal .sc-input,
#rb-modal .sc-select {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid var(--line);
}
#rb-modal .sc-input::placeholder { color: #888 !important; }
#rb-modal .sc-input:focus,
#rb-modal .sc-select:focus { border-color: var(--accent); }

/* 요청 6: 입문 세션 가능 표시 마커 & 범례 */
.intro-mark {
    color: var(--accent-gold);
    margin-left: 6px;
    font-size: 13px;
}
.rb-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--line-light);
}
.rb-legend strong { color: var(--accent-gold); }
/* ========================================
   모바일 반응형
   ======================================== */
@media (max-width: 768px) {
    #bookWrap {
        font-size: 13px;
    }
    
    .unified-wrapper {
        border-radius: 8px;
        margin-bottom: 0px;
    }
    
    .sc-header {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .sc-header h2 {
        font-size: 14px;
    }
    
    .sc-header > div {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* 테이블 숨기고 카드 뷰로 */
    .table-wrapper {
        display: none;
    }
    
    /* 모바일 카드 뷰 */
    .mobile-view {
        display: block;
        padding: 15px;
    }
    
    .rb-card {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 15px;
        margin-bottom: 12px;
    }
    
    .rb-card.is-primary {
        border-left: 3px solid var(--accent-gold);
        background: linear-gradient(90deg, rgba(255, 236, 179, 0.05), transparent);
    }
    
    .rb-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 10px;
    }
    
    .rb-card-title {
        font-size: 15px;
        font-weight: 700;
        color: #fff;
        flex: 1;
    }
    
    .rb-card-badge {
        font-size: 11px;
        padding: 3px 8px;
        border-radius: 4px;
        white-space: nowrap;
    }
    
    .rb-card-level {
        font-size: 12px;
        color: var(--text-muted);
        margin-top: 8px;
    }
    
    .rb-card-children {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--line);
    }
    
    .rb-child-item {
        font-size: 13px;
        color: var(--text-muted);
        padding: 5px 0;
        padding-left: 15px;
        position: relative;
    }
    
    .rb-child-item::before {
        content: "└";
        position: absolute;
        left: 0;
    }
}

/* 드래그 핸들 */
.drag-handle {
    cursor: move;
    color: var(--text-muted);
    padding: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.drag-handle:hover {
    color: var(--accent);
}

.drag-handle i {
    font-size: 16px;
}

/* 순서 컬럼은 기본적으로 숨김 */
.col-order {
    display: none;
}

/* 편집 모드에서만 표시 */
#bookWrap.edit-mode .col-order {
    display: table-cell;
}
