/* ======================================
   게시판 스타일 모듈 (board.css)
   KEYWORK v3 브랜드 컬러 및 디자인 일관성 유지
   ====================================== */

/* 댓글 헤더 스타일 */
.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.comments-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.instagram-modal-btn {
    background: linear-gradient(135deg, #1428A0, #2B4CB8);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.instagram-modal-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 40, 160, 0.3);
}

.instagram-modal-btn:active {
    transform: translateY(0);
}

/* CSS 변수 재정의 (main.css와 일관성) */
:root {
    --brand-primary: #1428A0;
    --brand-secondary: #2B4CB8;
    --brand-light: #E8EFFF;
    --brand-dark: #0F1B75;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F9FA;
    --bg-tertiary: #F0F2F5;
    --text-primary: #1A1A1A;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --border-color: #E5E7EB;
    --border-radius: 12px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* 파일 업로드 영역 스타일 */
.file-upload-area {
    margin-top: 8px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    transition: var(--transition);
    background: var(--bg-primary);
}

.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: var(--brand-primary);
    background-color: var(--brand-light);
}

.upload-zone {
    text-align: center;
    cursor: pointer;
    padding: 20px;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.7;
}

.upload-text {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 500;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 업로드 진행 상황 */
.upload-progress {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 14px;
    color: #495057;
    text-align: center;
}

/* 업로드된 파일 목록 */
.uploaded-files {
    margin-top: 16px;
}

/* 업로드된 이미지 미리보기 */
.uploaded-images-section {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.uploaded-images-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #495057;
}

.uploaded-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.uploaded-image-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    border: 1px solid #dee2e6;
}

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

.remove-image-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-image-btn:hover {
    background: #dc3545;
}

.uploaded-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 8px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.file-icon {
    font-size: 18px;
}

.file-name {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

.file-size {
    font-size: 12px;
    color: #6c757d;
}

.remove-file-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.remove-file-btn:hover {
    background: #c82333;
}

/* 메인 게시판 섹션 */
.board-main-section {
    padding: 20px !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding-bottom: 100px !important; /* 하단 네비게이션 공간 확보 */
    background: var(--bg-secondary) !important;
    width: 100%;
    min-height: 100vh;
    display: none;
    transition: all 0.3s ease;
}

.board-main-section.active {
    display: block;
}

/* ========================================
   글쓰기 버튼 섹션
   ======================================== */

.board-post-section {
    background: white !important;
    border-radius: 12px !important;
    padding: 16px 20px !important;
    margin-bottom: 20px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.board-post-section .write-post-btn {
    background: var(--brand-primary) !important;
    color: white !important;
    border: none !important;
    padding: 12px 20px !important;
    border-radius: 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.board-post-section .write-post-btn:hover {
    background: var(--brand-secondary) !important;
    transform: translateY(-1px) !important;
}

.board-post-section .write-post-btn .btn-icon {
    font-size: 16px !important;
}

.board-post-section .write-post-btn .btn-text {
    font-size: 14px !important;
}

/* ========================================
   헤더 스타일 (구인구직과 동일한 스타일)
   ======================================== */
.board-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 24px !important;
    padding-bottom: 16px !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: white !important;
    padding: 20px !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
    margin-bottom: 20px !important;
}

.board-header .header-brand h1 {
    font-size: 24px !important;
    font-weight: 700 !important;
    color: var(--brand-primary) !important;
    margin: 0 !important;
}

.board-header .header-brand .subtitle {
    font-size: 14px !important;
    color: var(--text-secondary) !important;
    margin-top: 4px !important;
}

/* 헤더 액션 영역 */
.board-header .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.write-post-btn {
    background: var(--brand-primary) !important;
    color: white !important;
    border: none !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: all 0.3s ease !important;
}

.write-post-btn:hover {
    background: #1020a0 !important;
    transform: translateY(-1px) !important;
}

/* ========================================
   카테고리 탭 스타일 (구인구직과 동일한 스타일)
   ======================================== */
.board-categories {
    display: flex !important;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef) !important;
    border-radius: 8px !important;
    padding: 3px !important;
    margin-bottom: 16px !important;
    gap: 3px !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06) !important;
}

.category-tab {
    flex: 1 !important;
    background: transparent !important;
    border: none !important;
    padding: 10px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--text-secondary) !important;
    flex-direction: column !important;
}

.category-tab:hover {
    background: rgba(20, 40, 160, 0.1) !important;
    color: var(--brand-primary) !important;
}

.category-tab.active {
    background: linear-gradient(145deg, #ffffff, #f1f3f4) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    transform: translateY(-1px) !important;
}

.category-tab .tab-icon {
    font-size: 14px !important;
}

.category-tab .tab-text {
    font-size: 12px !important;
    font-weight: 500 !important;
}

.category-tab .tab-desc {
    font-size: 9px !important;
    opacity: 0.8 !important;
    display: block !important;
}

/* ========================================
   검색창 스타일
   ======================================== */
.board-search-container {
    background: white;
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.board-search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 14px;
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.board-search-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.search-clear-btn:hover {
    background: #f8f9fa;
    color: #666;
}

/* ========================================
   게시판 설명 스타일
   ======================================== */
.board-description {
    background: white;
    padding: 20px 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.description-content h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.description-content p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.board-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    text-align: center;
    min-width: 60px;
}

.stat-number {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* ========================================
   게시글 목록 스타일
   ======================================== */
.posts-list-section {
    background: var(--bg-primary);
    margin: 0;
}

/* ========================================
   썸네일 스타일
   ======================================== */
.post-item.has-thumbnail .post-content-wrapper {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.post-thumbnail {
    flex-shrink: 0;
    width: 120px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-item:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-item.has-thumbnail .post-info {
    flex: 1;
    min-width: 0;
}

/* 모바일에서 썸네일 크기 조정 */
@media (max-width: 768px) {
    .post-thumbnail {
        width: 80px;
        height: 60px;
    }
    
    .post-item.has-thumbnail .post-content-wrapper {
        gap: 10px;
    }
}

.section-header {
    padding: 15px;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #333;
}

.post-count-badge {
    background: #667eea;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.section-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sort-select {
    padding: 6px 12px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 12px;
    background: white;
    cursor: pointer;
}

.section-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #666;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.section-btn:hover {
    background: #e9ecef;
    color: #333;
}

/* 게시글 목록 */
.posts-list {
    padding: 0 15px 15px;
}

.post-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.post-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
    border-color: var(--brand-primary);
}

.post-item.important {
    border-left: 4px solid #ff6b6b;
    background: linear-gradient(90deg, #fff5f5 0%, white 20%);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.post-badges {
    display: flex;
    gap: 6px;
}

.post-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
}

.post-badge.important {
    background: #ffe6e6;
    color: #ff6b6b;
}

.post-badge.board-humors {
    background: var(--brand-light);
    color: var(--brand-primary);
}

.post-badge.board-community {
    background: var(--brand-light);
    color: var(--brand-secondary);
}

.post-badge.board-codnews {
    background: var(--brand-light);
    color: var(--brand-dark);
}

.post-badge.hot {
    background: #fff7ed;
    color: #f97316;
}

.post-badge.new {
    background: #fef3c7;
    color: #f59e0b;
}

.post-time {
    font-size: 11px;
    color: #999;
}

/* 파일 및 링크 아이콘 스타일 */
.post-title .icon-file,
.post-title .icon-link {
    font-size: 14px;
    margin-left: 5px;
    opacity: 0.7;
    display: inline-block;
}

.post-main h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.post-preview {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.post-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.tag {
    background: #f1f3f4;
    color: #5f6368;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 500;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #f1f3f4;
}

.author-name {
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
}

.post-stats {
    display: flex;
    gap: 12px;
}

.post-stats .stat {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* 빈 게시글 메시지 */
.no-posts-message {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.no-posts-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.no-posts-message h3 {
    margin: 0 0 8px 0;
    color: #666;
    font-weight: 600;
}

.no-posts-message p {
    margin: 0;
    font-size: 14px;
}

/* ========================================
   모달 스타일 (글 작성/상세보기)
   ======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    animation: modalSlideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* 상세보기 모달의 스크롤 설정 */
.post-detail-modal .modal-content {
    overflow-y: auto !important;
    padding: 24px !important;
}

.modal-content.large {
    max-width: 600px;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
    text-align: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--brand-primary);
}

/* 기본 모달 닫기 버튼 (글쓰기 등) */
.modal .modal-close {
    background: var(--brand-primary);
    border: 2px solid white;
    font-size: 24px;
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.modal .modal-close:hover {
    background: var(--brand-dark);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* 상세보기 모달 전용 닫기 버튼 - 우측 상단 고정 */
.post-detail-modal .modal-close {
    position: fixed !important; /* absolute에서 fixed로 변경 */
    top: 16px !important;
    right: 16px !important;
    z-index: 1001 !important;
    background: var(--brand-primary) !important;
    border: 2px solid white !important;
    font-size: 24px !important;
    color: white !important;
    cursor: pointer !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    font-weight: bold !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
}

.post-detail-modal .modal-close:hover {
    background: var(--brand-dark) !important;
    color: white !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.4) !important;
}

.modal-body {
    padding: 24px 32px 32px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    padding: 20px 32px 32px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    background: var(--bg-primary);
    background: #fafbfc;
}

/* 폼 스타일 */
.form-group {
    margin-bottom: 20px;
}

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

.required {
    color: #ff6b6b;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.form-help {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    display: block;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* 모달 버튼 */
.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
}

.modal-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 40, 160, 0.3);
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-primary) 100%);
}

.modal-btn.secondary {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e9ecef;
}

.modal-btn.secondary:hover {
    background: #e9ecef;
    color: #333;
}

/* ========================================
   게시글 상세 모달 스타일 (전용 클래스)
   ======================================== */

/* 상세보기 모달 전체 화면 설정 */
.post-detail-modal {
    /* 기본 modal 스타일 완전 오버라이드 */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 1000 !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    animation: modalFadeIn 0.3s ease !important;
    transition: all 0.3s ease !important;
}

.post-detail-modal.show {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 모바일: 전체 화면에서 상하단 여백 추가 */
@media (max-width: 767px) {
    .post-detail-modal .modal-content {
        position: relative !important; /* X 버튼 절대 위치의 기준점 */
        width: 100vw !important;
        max-width: 100vw !important;
        height: calc(100vh - 160px) !important; /* 상단 60px + 하단 100px = 160px */
        max-height: calc(100vh - 160px) !important;
        margin-top: 60px !important; /* 상단 여백 */
        margin-bottom: 100px !important; /* 하단 탭을 위한 여백 (늘림) */
        border-radius: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-shadow: none !important;
    }
}

/* 태블릿 이상에서는 기본 설정 */
@media (min-width: 768px) {
    .post-detail-modal .modal-content {
        position: relative !important;
        width: calc(100vw - 40px) !important;
        max-width: calc(100vw - 40px) !important;
        height: calc(100vh - 40px) !important;
        max-height: calc(100vh - 40px) !important;
        border-radius: 16px !important;
        margin: auto !important;
        box-shadow: 0 25px 50px rgba(0,0,0,0.2) !important;
    }
}

/* 태블릿에서는 약간의 여백 추가 */
@media (min-width: 768px) {
    .post-detail-modal {
        padding: 20px !important;
    }
}

/* 데스크톱에서는 적당한 크기로 제한 */
@media (min-width: 1024px) {
    .post-detail-modal .modal-content {
        position: relative !important; /* X 버튼 절대 위치의 기준점 */
        width: 90vw !important;
        max-width: 1200px !important;
        height: 85vh !important;
        max-height: 85vh !important;
    }
}

/* 큰 데스크톱에서는 더 제한 */
@media (min-width: 1400px) {
    .post-detail-modal .modal-content {
        position: relative !important; /* X 버튼 절대 위치의 기준점 */
        width: 80vw !important;
        max-width: 1400px !important;
        height: 80vh !important;
        max-height: 80vh !important;
    }
}

/* 상세보기 모달 헤더 및 푸터 패딩 조정 */
.post-detail-modal .modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0; /* 헤더 크기 고정 */
    position: relative;
    z-index: 10;
}

.post-detail-modal .modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* 플렉스 아이템이 줄어들 수 있도록 */
}

.post-detail-modal .modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0; /* 푸터 크기 고정 */
}

/* 모바일에서 헤더 고정 및 최적화 */
@media (max-width: 767px) {
    .post-detail-modal .modal-header {
        padding: 16px 20px;
        position: sticky;
        top: 0;
        background: var(--bg-primary);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        z-index: 100;
    }
    
    .post-detail-modal .modal-body {
        padding: 20px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* iOS 부드러운 스크롤 */
    }
    
    .post-detail-modal .modal-footer {
        padding: 16px 20px;
        position: sticky;
        bottom: 0;
        background: var(--bg-primary);
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    }
    
    /* 모바일에서 닫기 버튼 크기 및 위치 조정 */
    .post-detail-modal .modal-close {
        top: 12px !important;
        right: 12px !important;
        width: 36px !important;
        height: 36px !important;
        font-size: 20px !important;
    }
}

/* ========================================
   상세보기 모달 이미지 자동 크기 조정
   ======================================== */

/* 상세페이지 내 모든 이미지 자동 크기 조정 */
.post-detail-modal .post-content img,
.post-detail-modal .post-image img {
    max-width: 100% !important;
    height: auto !important;
    width: auto !important;
    display: block !important;
    margin: 16px auto !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    object-fit: contain !important; /* 비율 유지하며 완전히 보이도록 */
}

/* 이미지 컨테이너 스타일 */
.post-detail-modal .post-image {
    width: 100% !important;
    text-align: center !important;
    margin: 16px 0 !important;
    overflow: hidden !important;
}

/* 매우 큰 이미지도 모달 너비를 넘지 않도록 */
.post-detail-modal .modal-body img {
    max-width: calc(100% - 40px) !important; /* 좌우 패딩 고려 */
    height: auto !important;
    display: block !important;
    margin: 16px auto !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

/* 모바일에서 이미지 최적화 */
@media (max-width: 767px) {
    .post-detail-modal .post-content img,
    .post-detail-modal .post-image img,
    .post-detail-modal .modal-body img {
        max-width: calc(100% - 20px) !important; /* 모바일 패딩 고려 */
        margin: 12px auto !important;
        border-radius: 6px !important;
    }
}

/* ========================================
   상세페이지 모던 UI 스타일
   ======================================== */

/* 상세페이지 헤더 섹션 */
/* 상세페이지 기본 스타일 */
.post-detail-modal h2 {
    margin-bottom: 16px;
    color: var(--brand-primary);
    font-size: 24px;
    font-weight: 600;
}

.post-meta {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    color: #666;
    font-size: 14px;
}

.post-content {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    word-break: break-word;
}

.post-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 16px auto;
    border-radius: 8px;
}

/* 기존 상세보기 스타일은 기본 형태로 대체됨 */

/* 삭제 버튼 기본 스타일 */
.delete-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 16px;
}

.delete-btn:hover {
    background: #ff5252;
}

/* 상세페이지 모바일 반응형 */
@media (max-width: 767px) {
    .post-detail-modal h2 {
        font-size: 20px;
    }
    
    .post-content {
        font-size: 15px;
    }
    
    .post-detail-modal .modal-content {
        -webkit-overflow-scrolling: touch !important;
        overflow-y: scroll !important;
    }
}

/* 기존 상세보기 스타일은 새로운 모던 UI로 대체됨 */

/* ========================================
   반응형 스타일
   ======================================== */
@media (max-width: 768px) {
    .board-header {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: center !important;
        text-align: center !important;
        padding: 12px !important;
    }
    
    .board-header .header-brand h1 {
        font-size: 24px !important;
    }
    
    .board-header .header-actions {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .write-post-btn span {
        display: none !important;
    }
    
    .board-categories {
        /* 모바일에서도 가로 유지 - 더 사용자 친화적 */
        flex-direction: row !important;
        gap: 3px !important;
        padding: 3px !important;
    }
    
    .category-tab {
        padding: 8px 6px !important;
        font-size: 12px !important;
        min-height: 40px !important;
        gap: 4px !important;
    }
    
    .category-tab .tab-desc {
        display: none !important;
    }
    
    .board-description {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .board-stats {
        justify-content: center;
    }
    
    .posts-list {
        padding: 0 10px 15px;
    }
    
    .post-item {
        padding: 12px;
    }
    
    .post-footer {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    /* 글쓰기 모달만 적용 (상세보기 모달 제외) */
    .modal:not(.post-detail-modal) {
        padding: 10px;
    }
    
    .modal:not(.post-detail-modal) .modal-content {
        max-height: 95vh;
        display: flex;
        flex-direction: column;
    }
    
    .modal:not(.post-detail-modal) .modal-body {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }
    
    .modal:not(.post-detail-modal) .modal-footer {
        flex-direction: column;
    }
    
    .post-actions {
        flex-wrap: wrap;
        margin-right: 0;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .board-header .header-actions {
        gap: 6px;
    }
    
    .board-header .header-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .write-post-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .category-tab {
        min-width: 60px;
        padding: 8px 10px;
    }
    
    .category-tab .tab-icon {
        font-size: 16px;
    }
    
    .category-tab .tab-text {
        font-size: 11px;
    }
    
    .post-item {
        padding: 10px;
    }
    
    .post-main h3 {
        font-size: 15px;
    }
    
    .post-preview {
        font-size: 13px;
    }
}

/* ========================================
   로딩 애니메이션
   ======================================== */
.loading-posts {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '...';
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* ========================================
   페이지네이션 스타일
   ======================================== */
.pagination-container {
    margin: 30px 0;
    text-align: center;
}

.pagination {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    border: 1px solid #e0e0e0;
    background: white;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-decoration: none;
}

.page-btn:hover {
    border-color: #007bff;
    color: #007bff;
    background: #f8f9fa;
}

.page-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.page-btn.active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.prev-btn, .next-btn {
    padding: 0 16px;
    font-weight: 600;
}

.pagination-dots {
    color: #999;
    font-weight: bold;
    margin: 0 4px;
}

.pagination-info {
    color: #666;
    font-size: 14px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .pagination {
        gap: 4px;
    }
    
    .page-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
    
    .prev-btn, .next-btn {
        padding: 0 12px;
        font-size: 12px;
    }
    
    .pagination-info {
        font-size: 13px;
        flex-direction: column;
        gap: 4px;
    }
}

/* 이미지 레이지 로딩 스타일 */
.post-thumbnail img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-thumbnail img.lazy[src] {
    opacity: 1;
}