/* Q&A Board Styles */

/* 컨테이너 */
.qna-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #f9fafb;
    min-height: 100vh;
}

/* 헤더 */
.qna-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.qna-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.qna-header h1 i {
    color: #3b82f6;
    margin-right: 10px;
}

.btn-write-post {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-write-post:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* 탭 네비게이션 (제거됨 - 필터로 대체) */
.qna-tabs {
    display: none;
}

/* 검색 바 */
.qna-search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-input-group {
    flex: 1;
    position: relative;
}

.search-input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.search-input-group input {
    width: 100%;
    padding: 12px 15px 12px 50px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-input-group input:focus {
    outline: none;
    border-color: #3b82f6;
}

.qna-search-bar select {
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: white;
    min-width: 150px;
}

/* 게시글 목록 - 테이블 */
.posts-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.posts-table {
    width: 100%;
    border-collapse: collapse;
}

.posts-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.posts-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
}

.posts-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background-color 0.15s;
}

.posts-table tbody tr:hover {
    background: #f9fafb;
}

.posts-table tbody tr:last-child {
    border-bottom: none;
}

.posts-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: #374151;
}

/* 상태 컬럼 */
.posts-table td.status-pending {
    color: #d97706;
    font-weight: 600;
}

.posts-table td.status-answered {
    color: #059669;
    font-weight: 600;
}

.posts-table td.status-closed {
    color: #6b7280;
    font-weight: 600;
}

/* 제목 컬럼 */
.posts-table td.title-cell {
    font-weight: 500;
    color: #1f2937;
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 아이콘 */
.pin-icon, .lock-icon, .check-icon {
    font-size: 14px;
    margin-right: 4px;
}

.deleted-icon {
    font-size: 13px;
    color: #ef4444;
    font-weight: 600;
    margin-right: 4px;
}

/* 삭제된 게시글 스타일 */
.posts-table tbody tr.deleted {
    opacity: 0.5;
    background: #fee;
}

.posts-table tbody tr.deleted:hover {
    opacity: 0.6;
    background: #fdd;
}

.posts-table tbody tr.deleted td {
    text-decoration: line-through;
    color: #9ca3af;
}

/* 컬럼 너비 */
.posts-table th:nth-child(1),
.posts-table td:nth-child(1) {
    width: 90px;
}

.posts-table th:nth-child(2),
.posts-table td:nth-child(2) {
    width: 100px;
}

.posts-table th:nth-child(4),
.posts-table td:nth-child(4) {
    width: 120px;
}

.posts-table th:nth-child(5),
.posts-table td:nth-child(5) {
    width: 100px;
}

.posts-table th:nth-child(6),
.posts-table td:nth-child(6) {
    width: 60px;
    text-align: center;
}

/* 페이지네이션 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}

.page-btn {
    padding: 10px 15px;
    border: 2px solid #e5e7eb;
    background: white;
    color: #6b7280;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.page-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.page-btn.active {
    border-color: #3b82f6;
    background: #3b82f6;
    color: white;
}

/* 로딩/에러/빈 메시지 */
.loading-message,
.error-message,
.empty-message {
    text-align: center;
    padding: 60px 20px;
}

.loading-message i {
    font-size: 2rem;
    color: #3b82f6;
    margin-bottom: 15px;
}

.error-message i {
    font-size: 2rem;
    color: #ef4444;
    margin-bottom: 15px;
}

.empty-message i {
    font-size: 2rem;
    color: #9ca3af;
    margin-bottom: 15px;
}

.loading-message p,
.error-message p,
.empty-message p {
    color: #6b7280;
    font-size: 15px;
    margin-bottom: 20px;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 5px;
}

.close-btn:hover {
    color: #1f2937;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    cursor: pointer;
}

.form-group select,
.form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ========== 상세 페이지 ========== */

.breadcrumb {
    margin-bottom: 20px;
}

.breadcrumb a {
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: #3b82f6;
}

.post-detail {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 30px;
    margin-bottom: 30px;
}

.post-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.post-title h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 10px 0;
}

.post-meta {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    font-size: 14px;
    color: #6b7280;
    flex-wrap: wrap;
}

.post-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.post-content {
    font-size: 15px;
    line-height: 1.8;
    color: #374151;
}

/* 답변 컨테이너 */
.replies-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 30px;
    margin-bottom: 30px;
}

.replies-container h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 20px;
}

.reply-item {
    padding: 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 15px;
}

.reply-item.admin-reply {
    background: #eff6ff;
    border-color: #3b82f6;
}

.reply-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
}

.admin-badge {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.reply-author {
    font-weight: 600;
    color: #374151;
}

.reply-time {
    color: #9ca3af;
}

.reply-content {
    font-size: 14px;
    line-height: 1.7;
    color: #374151;
}

/* 답변 작성 폼 */
.reply-form {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 30px;
}

.reply-form h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 15px;
}

.reply-form textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 15px;
}

.reply-form textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.reply-form-actions {
    display: flex;
    justify-content: flex-end;
}

/* ============================================================================
   이미지 업로드 영역
   ============================================================================ */

.image-upload-area {
    margin-top: 10px;
}

.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8fafc;
}

.upload-zone:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-zone.drag-over {
    border-color: #3b82f6;
    background: #dbeafe;
    transform: scale(1.02);
}

.upload-zone p {
    margin: 10px 0 0;
    color: #64748b;
    font-size: 14px;
}

.image-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.image-preview-item {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    transition: all 0.2s;
}

.image-preview-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.image-preview-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.image-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.image-preview-remove:hover {
    background: rgb(220, 38, 38);
    transform: scale(1.1);
}

.image-preview-name {
    padding: 8px;
    font-size: 12px;
    color: #64748b;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    background: #f8fafc;
}

/* ===============================================
   회원 정보 섹션
   =============================================== */

.author-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    margin: 16px 0;
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.author-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0f2fe;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    color: #3b82f6;
    font-size: 32px;
}

.author-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.author-name {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
}

.author-join-date {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 4px;
}

.author-join-date i {
    font-size: 12px;
}

.level-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 6px;
}

/* 답변 액션 버튼 */
.reply-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reply-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.btn-icon {
    background: transparent;
    border: 1px solid #e5e7eb;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
    font-size: 13px;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #3b82f6;
    border-color: #3b82f6;
}

.btn-icon.btn-danger:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #ef4444;
}

/* ============================================================
   파일 업로드 스타일
   ============================================================ */

/* textarea 컨테이너 (드래그앤드롭 영역) */
.textarea-container {
    position: relative;
    width: 100%;
}

.textarea-container.drag-over {
    border: 2px dashed #3b82f6;
    border-radius: 8px;
}

/* 드래그 오버레이 */
.drop-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(59, 130, 246, 0.1);
    border: 2px dashed #3b82f6;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.drop-message {
    text-align: center;
    color: #3b82f6;
    font-size: 16px;
    font-weight: 600;
}

/* 첨부파일 미리보기 */
.attachment-preview {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 12px 0;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.attachment-item {
    position: relative;
    width: 120px;
    height: 120px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.attachment-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-item .file-icon {
    font-size: 48px;
    color: #6b7280;
    margin-bottom: 8px;
}

.attachment-item .file-name {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    padding: 4px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.remove-attachment {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
    z-index: 5;
}

.remove-attachment:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* 업로드 중 메시지 */
.uploading-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    color: #3b82f6;
    font-size: 14px;
    font-weight: 600;
}

.uploading-message i {
    font-size: 20px;
}

/* 답변에 표시되는 첨부파일 */
.reply-attachments {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.attachment-thumbnail {
    width: 120px;
    height: 120px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: block;
    transition: all 0.2s;
}

.attachment-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.attachment-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
}

.attachment-file:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.attachment-file i {
    font-size: 16px;
    color: #6b7280;
}

.attachment-file span {
    font-weight: 500;
}
