/* =================================================================
   Chatly Manager - 전면 개편 CSS (v2.0)
   ================================================================= */

/* 1. 기본 & 폰트 설정
----------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap');

:root {
    --primary-color: #007bff;
    --dark-color: #343a40;
    --light-gray-color: #f8f9fa;
    --medium-gray-color: #e9ecef;
    --border-color: #dee2e6;
    --font-family: 'Noto Sans KR', sans-serif;
}

body {
    font-family: var(--font-family);
    margin: 0;
    background-color: var(--light-gray-color);
    color: var(--dark-color);
    font-size: 14px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

a:hover {
    text-decoration: underline;
}

/* 2. 최상단 헤더
----------------------------------------------------------------- */
.main-header {
    background-color: #ffffff;
    padding: 0 25px;
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-header .header-title {
    font-size: 20px;
    font-weight: 700;
}

.main-header .header-links a {
    margin-left: 15px;
    font-size: 14px;
    color: #6c757d;
}
.main-header .header-links a:hover {
    color: var(--primary-color);
}


/* 3. 메인 레이아웃 (왼쪽 패널 + 메인 콘텐츠)
----------------------------------------------------------------- */
.main-layout {
    display: flex;
    align-items: flex-start;
}

/* 4. 왼쪽 컨트롤 패널
----------------------------------------------------------------- */
.left-panel {
    width: 300px;
    flex-shrink: 0;
    height: calc(100vh - 61px); /* 헤더 높이 제외 */
    background-color: #ffffff;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 61px; /* 헤더 높이만큼 아래에 고정 */
    overflow-y: auto;
}

/* 타입 선택 (Life/MBTI/Quiz) */
.type-selector {
    display: flex;
    padding: 10px;
    background-color: var(--light-gray-color);
    border-bottom: 1px solid var(--border-color);
}

.type-selector a {
    flex: 1;
    text-align: center;
    padding: 10px 5px;
    font-weight: 500;
    color: #495057;
    border-radius: 5px;
    border: 1px solid transparent;
}

.type-selector a.active,
.type-selector a:hover {
    background-color: var(--primary-color);
    color: #ffffff;
    text-decoration: none;
}

.panel-content {
    padding: 20px;
}

.panel-content h2 {
    font-size: 16px;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--medium-gray-color);
}

/* 현황판 테이블 */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.stats-table th, .stats-table td {
    padding: 8px 5px;
    text-align: center;
    border-bottom: 1px solid var(--medium-gray-color);
}

.stats-table th {
    font-weight: 500;
    background-color: var(--light-gray-color);
}
.stats-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.stats-table tr.active-category {
    background-color: #e6f2ff;
}
.stats-table tr:hover {
    background-color: #f1f3f5;
}

/* MBTI 필터 */
.mbti-grid-panel {
    margin-top: 25px;
}
.mbti-grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}
.mbti-type-link {
    display: block;
    padding: 8px 5px;
    font-size: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.mbti-type-link:hover, .mbti-type-link.active {
    background: #28a745;
    color: white;
    border-color: #28a745;
    text-decoration: none;
}


/* 5. 메인 콘텐츠 영역
----------------------------------------------------------------- */
/* --- 수정 후 --- */

/* =================================================================
   7. UI 수정 요청사항 반영 (v2.1)
   ================================================================= */

/* 1. '제목만 보기' 클릭 시 리스트 높이 조절 */
.title-only-mode .result-item .level-content-wrapper {
    display: none; /* 내용 전체를 숨겨서 높이를 최소화 */
}
.title-only-mode .result-item {
    margin-bottom: 5px; /* 목록 간격을 좁게 조정 */
}


/* 2. 액션 버튼들(넓게보기, 작업완료 등) 우측 정렬 */
.action-buttons {
    text-align: right; /* 버튼들을 담고 있는 컨테이너의 텍스트 정렬을 오른쪽으로 변경 */
    margin-bottom: 10px; /* 버튼과 텍스트 영역 사이의 간격 추가 */
}

/* 3. '작업 완료' 상태인 레벨 버튼 스타일 (아래 3번 항목과 연동) */
.level-btn.completed {
    background-color: #28a745; /* 완료된 레벨 버튼 배경색 */
    color: white;
    border-color: #28a745;
}
.main-content {
    flex-grow: 1;
    padding: 25px;
    max-width: 1200px; /* <<< 이 줄을 추가하세요. (값은 원하는대로 조절) */
    /* 예: 960px, 1140px 등 표준적인 너비를 사용해볼 수 있습니다. */
}

.main-content > form {
    margin-bottom: 20px;
}

/* 컨트롤러 (상태/레벨 필터, 버튼) */
.controls-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 20px;
}

.filters a, .level-filters a {
    margin-right: 10px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px; /* 둥근 버튼 */
    font-size: 13px;
}

.filters a.active, .level-filters a.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    font-weight: 500;
    text-decoration: none;
}

.view-options button {
    margin-left: 10px;
}

/* 페이지 제목 */
.main-content > h2 {
    font-size: 18px;
    margin-top: 0;
    margin-bottom: 20px;
}

/* 결과 아이템 */
.result-item {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.result-header .topic-info strong { font-size: 16px; }
.result-header .topic-info small { color: #6c757d; }

.action-buttons button, .status-btn {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #6c757d;
    background-color: #fff;
    margin-left: 5px;
}
.action-buttons button:hover {
    background-color: #f1f3f5;
}


/* 상태별 스타일 */
.status-completed { background-color: #e6ffed !important; }
.status-disabled { background-color: #fff0f1 !important; opacity: 0.7; }
.result-header.status-completed { border-left: 4px solid #28a745; }
.result-header.status-disabled { border-left: 4px solid #dc3545; }


/* 텍스트 영역 */
.level-content-wrapper { padding: 0 15px 15px; }
textarea {
    width: 100%;
    height: 150px; /* 기본 높이 */
    padding: 10px;
    border: 1px solid var(--medium-gray-color);
    border-radius: 4px;
    font-family: 'D2Coding', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    box-sizing: border-box; /* 패딩 포함 크기 계산 */
}
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* 페이지네이션 */
.pagination {
    margin: 25px 0;
    text-align: center;
}
.pagination .page-link {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.pagination .page-link.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    font-weight: bold;
}