/* =============================================
   UPBIT PRO 게시판 스타일
   ============================================= */

/* 로고 밑줄 제거 */
.logo {
    text-decoration: none;
}

/* 게시판 링크 (헤더) */
.board-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.board-link:hover,
.board-link.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* 게시판 컨테이너 */
.board-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* 게시판 헤더 */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.board-header h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 0;
}

.board-stats {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* 게시판 컨트롤 */
.board-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sort-tabs {
    display: flex;
    gap: 0.3rem;
}

.sort-tab {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.sort-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sort-tab.active {
    background: var(--blue);
    color: white;
}

.write-btn {
    background: var(--green);
    color: white;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.write-btn:hover {
    background: #2ea043;
}

/* 게시판 테이블 */
.board-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
}

.board-table th,
.board-table td {
    padding: 0.8rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.board-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

.board-table td {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.col-num { width: 60px; }
.col-title { text-align: left !important; }
.col-writer { width: 100px; }
.col-date { width: 70px; }
.col-view { width: 60px; }
.col-recommend { width: 60px; }

.board-table td a {
    color: var(--text-primary);
    text-decoration: none;
}

.board-table td a:hover {
    color: var(--blue);
}

.comment-count {
    color: var(--blue);
    font-weight: 600;
    margin-left: 0.3rem;
}

.file-icon {
    margin-left: 0.3rem;
}

.notice-badge {
    background: var(--red);
    color: white;
    /*padding: 0.2rem 0.5rem;*/
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.title-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 0.3rem;
}

.title-badge.notice {
    background: var(--red);
    color: white;
}

.notice-row {
    background: rgba(248, 81, 73, 0.1);
}

.recommend-up {
    color: var(--green);
    font-weight: 600;
}

.empty-row {
    text-align: center !important;
    color: var(--text-tertiary);
    padding: 3rem !important;
}

/* 페이지네이션 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 1.5rem;
}

.page-btn {
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.page-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.page-btn.active {
    background: var(--blue);
    color: white;
}

/* =============================================
   글쓰기/수정 폼
   ============================================= */

.write-form {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.required {
    color: var(--red);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
}

.form-group textarea {
    resize: vertical;
    min-height: 200px;
}

/* 에디터 툴바 */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    background: var(--blue);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: var(--purple);
}

.toolbar-hint {
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

/* 이미지 미리보기 */
.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-bottom: none;
    min-height: 0;
}

.image-preview:empty {
    display: none;
}

.preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-primary);
}

.preview-item.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
}

.preview-item.loading span {
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

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

.preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(248, 81, 73, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-remove:hover {
    background: var(--red);
}

/* 에디터 툴바가 있을 때 textarea 스타일 */
.editor-toolbar + .image-preview + textarea,
.editor-toolbar + textarea {
    border-radius: 0 0 6px 6px;
}

.form-group input[type="file"] {
    color: var(--text-primary);
}

.file-hint {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-top: 0.3rem;
}

.current-file {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

/* 캡차 */
.captcha-group .captcha-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.captcha-number {
    background: linear-gradient(135deg, var(--blue), var(--purple));
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 0.3rem;
}

.captcha-refresh {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.8rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.captcha-refresh:hover {
    background: var(--border);
}

/* 폼 버튼 */
.form-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.cancel-btn,
.submit-btn {
    padding: 0.8rem 2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.cancel-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.cancel-btn:hover {
    background: var(--border);
}

.submit-btn {
    background: var(--blue);
    color: white;
}

.submit-btn:hover {
    background: var(--purple);
}

/* =============================================
   게시글 상세보기
   ============================================= */

.post-header {
    background: var(--bg-secondary);
    border-radius: 8px 8px 0 0;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.post-title {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    line-height: 1.4;
}

.post-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.meta-item {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.post-content {
    background: var(--bg-secondary);
    padding: 1.5rem;
    min-height: 200px;
}

.post-image {
    margin-bottom: 1rem;
    text-align: center;
}

.post-image img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
    cursor: pointer;
}

.post-file {
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.post-file a {
    color: var(--blue);
    text-decoration: none;
}

.post-file a:hover {
    text-decoration: underline;
}

.post-text {
    color: var(--text-primary);
    line-height: 1.8;
    word-break: break-word;
}

/* 본문 내 이미지 */
.post-text img {
    display: block;
    max-width: 100%;
    max-height: 600px;
    height: auto;
    margin: 1rem auto;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.post-text img:hover {
    transform: scale(1.02);
}

/* 추천/비추천 */
.vote-section {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.vote-btn {
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.vote-btn.recommend:hover {
    background: rgba(63, 185, 80, 0.2);
    border-color: var(--green);
    color: var(--green);
}

.vote-btn.unrecommend:hover {
    background: rgba(248, 81, 73, 0.2);
    border-color: var(--red);
    color: var(--red);
}

/* 게시글 액션 버튼 */
.post-actions {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0 0 8px 8px;
    border-top: 1px solid var(--border);
}

.action-right {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.action-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

.action-btn.list-btn {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

.action-btn.delete-btn:hover {
    background: rgba(248, 81, 73, 0.2);
    border-color: var(--red);
    color: var(--red);
}

/* =============================================
   댓글
   ============================================= */

.comment-section {
    margin-top: 2rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
}

.comment-section h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border);
}

.comment-list {
    margin-bottom: 1.5rem;
}

.comment-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
}

.comment-nickname {
    color: var(--blue);
    font-weight: 600;
    font-size: 0.85rem;
}

.comment-date {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.comment-content {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.comment-empty {
    text-align: center;
    color: var(--text-tertiary);
    padding: 2rem;
}

/* 답글 버튼 */
.reply-toggle-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.3rem 0;
    margin-top: 0.3rem;
}

.reply-toggle-btn:hover {
    color: var(--blue);
}

/* 대댓글 입력폼 */
.reply-form {
    margin-top: 0.8rem;
    padding: 0.8rem;
    background: var(--bg-primary);
    border-radius: 6px;
}

.reply-input-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.reply-input-row input {
    flex: 0 0 120px;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.reply-input-row button {
    padding: 0.5rem 0.8rem;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

.reply-input-row button:hover {
    background: var(--purple);
}

.reply-form textarea {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.85rem;
    resize: none;
}

/* 대댓글 목록 */
.reply-list {
    margin-top: 0.8rem;
    margin-left: 1.5rem;
    border-left: 2px solid var(--border);
    padding-left: 1rem;
}

.reply-item {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
}

.reply-item:last-child {
    border-bottom: none;
}

.reply-arrow {
    color: var(--text-tertiary);
    margin-right: 0.5rem;
}

/* 댓글 입력 */
.comment-form {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 1rem;
}

.comment-input-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.comment-input-row input {
    flex: 0 0 150px;
    padding: 0.6rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.comment-form textarea {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    resize: vertical;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--blue);
}

.comment-submit {
    padding: 0.6rem 1rem;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.comment-submit:hover {
    background: var(--purple);
}

/* =============================================
   모달
   ============================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 350px;
}

.modal-content h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.modal-content input {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.modal-content input:focus {
    outline: none;
    border-color: var(--blue);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.modal-cancel,
.modal-confirm {
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.modal-cancel {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.modal-confirm {
    background: var(--blue);
    color: white;
}

/* =============================================
   반응형
   ============================================= */

@media (max-width: 768px) {
    .board-container {
        margin: 1rem auto;
    }

    .board-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .board-controls {
        flex-direction: column;
        gap: 0.8rem;
    }

    .sort-tabs {
        width: 100%;
        justify-content: space-between;
    }

    .sort-tab {
        flex: 1;
        text-align: center;
        padding: 0.5rem;
    }

    .write-btn {
        width: 100%;
        text-align: center;
    }

    /* 모바일: 테이블 헤더 숨기고 카드 형식 */
    .board-table thead {
        display: none;
    }

    .board-table,
    .board-table tbody,
    .board-table tr,
    .board-table td {
        display: block;
        width: 100%;
    }

    .board-table tr {
        background: var(--bg-secondary);
        margin-bottom: 0.5rem;
        border-radius: 8px;
        padding: 0.8rem;
        border: 1px solid var(--border);
    }

    .board-table td {
        padding: 0;
        border: none;
        text-align: left !important;
    }

    .board-table td.col-num {
        display: none;
    }

    .board-table td.col-title {
        display: block;
        font-size: 0.95rem;
        font-weight: 500;
        margin-bottom: 0.5rem;
        line-height: 1.4;
    }

    /* 메타 정보 한 줄로 */
    .board-table td.col-writer,
    .board-table td.col-date,
    .board-table td.col-view,
    .board-table td.col-recommend {
        display: inline;
        font-size: 0.75rem;
        color: var(--text-tertiary);
    }

    .board-table td.col-writer::before { content: '👤 '; }
    .board-table td.col-writer::after { content: '  '; }
    .board-table td.col-date::before { content: '📅 '; }
    .board-table td.col-date::after { content: '  '; }
    .board-table td.col-view::before { content: '👁 '; }
    .board-table td.col-view::after { content: '  '; }
    .board-table td.col-recommend::before { content: '👍 '; }

    .notice-row {
        background: rgba(248, 81, 73, 0.1);
    }

    .post-header,
    .post-content,
    .vote-section,
    .post-actions {
        padding: 1rem;
    }

    .post-title {
        font-size: 1.1rem;
    }

    .vote-section {
        flex-direction: column;
    }

    .vote-btn {
        width: 100%;
    }

    .post-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .action-right {
        justify-content: space-between;
    }

    .action-btn {
        flex: 1;
        text-align: center;
    }

    .comment-input-row {
        flex-direction: column;
    }

    .comment-input-row input {
        flex: 1;
    }

    .form-actions {
        flex-direction: column;
    }

    .cancel-btn,
    .submit-btn {
        width: 100%;
    }

    /* 대댓글 모바일 */
    .reply-list {
        margin-left: 0.8rem;
        padding-left: 0.8rem;
    }

    .reply-input-row {
        flex-direction: column;
    }

    .reply-input-row input {
        flex: 1;
        width: 100%;
    }
}
