/* 토론방 전용 CSS */

/* 모달 기본 (backdrop) */
.disc-modal-backdrop {
    z-index: 1060;
    align-items: center;
    justify-content: center;
    background-color: rgba(0,0,0,0.5); /* 모달 배경 어둡게 */
    pointer-events: auto; /* 포인터 이벤트 활성화 (이전에는 transparent에 none이었음) */
}

.disc-modal-content {
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    position: relative;
    margin: auto;
    background: white;
}

/* 헤더 영역 */
.disc-modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 15px 20px;
    cursor: move;
    user-select: none;
    background: white;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.disc-title {
    margin: 0;
    font-size: 18px;
    color: #1e293b;
    white-space: nowrap; /* 제목 줄바꿈 방지 */
}

.disc-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    height: 100%;
}

.disc-user-badge {
    display: flex;
    font-size: 14px;
    color: #475569;
    align-items: center;
    gap: 4px;
}

.disc-nickname {
    font-weight: bold;
    color: #3b82f6;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

.disc-logout-btn {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: #94a3b8;
}

.disc-close-btn {
    display: flex;
    align-items: center;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    line-height: 1;
    padding: 0;
    margin-bottom: 2px;
}

/* 본문 영역 */
.disc-modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f8fafc;
}

/* 목록 뷰 - 헤더 (총건수 + 글쓰기 버튼) */
.disc-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.disc-total-count {
    font-size: 14px;
    color: #64748b;
}

/* btn-search 클래스 분리 -> disc-btn-write로 독립 */
.disc-btn-write {
    padding: 6px 12px;
    border-radius: 6px;
    background-color: #3b82f6;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

/* 게시물/댓글 목록 */
.disc-list-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 게시물 카드 (JS에서 생성) */
.disc-post-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.disc-post-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: #64748b;
    flex-wrap: wrap; /* 모바일에서 겹치면 줄바꿈 허용 */
}

.disc-post-author {
    font-weight: bold;
    color: #334155;
    word-break: break-all;
}

.disc-post-content {
    font-size: 14px;
    color: #334155;
    line-height: 1.5;
    white-space: pre-wrap;
    margin-bottom: 12px;
}

.disc-post-actions {
    display: flex;
    gap: 15px;
    font-size: 13px;
    align-items: center;
    flex-wrap: wrap; /* 모바일 대응 */
}

/* 버튼 리셋용 클래스 */
.disc-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.disc-btn-like {
    color: #94a3b8;
}

.disc-btn-like.liked {
    color: #ef4444;
}

.disc-btn-comment {
    color: #3b82f6;
}

.disc-btn-edit {
    color: #64748b;
}

/* 댓글 컨테이너 */
.disc-comments-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #e2e8f0;
}

.disc-comment-item {
    font-size: 13px;
}

.disc-comment-root {
    margin-left: 10px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.disc-comment-reply {
    margin-left: 30px;
    border-left: 2px solid #e2e8f0;
    padding-left: 10px;
}

/* 글쓰기/댓글 폼 공통 레이아웃 */
.disc-write-view {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.disc-write-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
    color: #1e293b;
    font-weight: 500;
}

/* 입력 폼 그룹 (이메일, 비번, 닉네임) */
.disc-write-form-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

/* 댓글 폼 */
.disc-comment-form-box {
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin-top: 10px;
}

.disc-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
    min-width: 0; /* flex 환경에서 넘침 방지 */
    box-sizing: border-box;
}

/* 비번 인풋 그룹 */
.disc-pass-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.disc-pass-wrapper .disc-input {
    width: 100%;
    padding-right: 60px; /* 아이콘 영역 확보 */
}

.disc-pass-icons {
    position: absolute;
    right: 10px;
    display: flex;
    gap: 8px;
}

.disc-icon-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
}

.disc-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    resize: none;
    overflow: hidden;
    font-family: inherit;
    outline: none;
    font-size: 14px;
}

.disc-write-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.disc-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.disc-btn-cancel {
    background-color: #e2e8f0;
    color: #475569;
}

.disc-btn-submit {
    background-color: #3b82f6;
    color: white;
}

/* 페이지네이션 */
.disc-pagination {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}
.disc-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    color: #3b82f6;
    text-decoration: none;
    border-radius: 4px;
}
.disc-page-link.active {
    font-weight: bold;
    color: #ffffff;
    background-color: #3b82f6;
}

/* 모바일 전용 스타일 (360px~768px 미만 대응) */
@media (max-width: 768px) {
    /* 모달을 화면에 꽉 차게 변경 */
    .disc-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .disc-modal-header {
        border-radius: 0;
        padding: 15px;
    }

    /* 닉네임 최대 너비 축소 */
    .disc-nickname {
        max-width: 80px; 
    }

    /* 폼 입력 항목들을 세로로 정렬 */
    .disc-write-form-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    /* 입력 필드 터치 영역 확보 */
    .disc-input {
        padding: 10px 12px;
        font-size: 16px; /* iOS 자동 확대 방지 */
    }

    /* 글쓰기 버튼 터치 영역 및 마진 확보 */
    .disc-btn-write {
        padding: 8px 16px;
    }

    /* 대댓글 여백 축소 */
    .disc-comment-reply {
        margin-left: 15px; 
    }
    
    /* 각 종 버튼 터치 높이 확보 */
    .disc-action-btn {
        padding: 8px 4px; 
    }
    
    /* 페이징 버튼 터치 영역 확보 및 가로 크기 최적화, 폰트 크기 축소 */
    .disc-page-link {
        padding: 8px 10px;
        font-size: 13px;
    }
}
