/* 커뮤니티 게시판 CSS */

.community-board {
    margin: 2rem 0;
}

/* 헤더 */
.board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 2rem 0;
    border-bottom: 2px solid #e9ecef;
}

/* 헤더 콘텐츠 영역 */
.header-content {
    flex: 1;
}

.board-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

.board-description {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* 헤더 내 글쓰기 버튼 */
.board-header .write-btn {
    background-color: #0066cc;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.board-header .write-btn:hover {
    background-color: #0052a3;
    color: white;
    text-decoration: none;
}

/* 제목 텍스트 영역 */
.board-title-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}



.board-description {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* 상단 컨트롤 */
.board-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

/* 탭 메뉴 */
.tab-menu {
    display: flex;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    width: fit-content; /* 내용에 맞는 크기로 */
}

.tab-item {
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    color: #666;
    background: #fff;
    border-right: 1px solid #ddd;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap; /* 줄바꿈 방지 */
}

.tab-item:last-child {
    border-right: none;
}

.tab-item:hover {
    background: #f8f9fa;
    color: #333;
}

.tab-item.active {
    background: #0066cc;
    color: #fff;
}

/* 검색 및 액션 */
.board-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-form {
    display: flex;
    justify-content: flex-start;
}

/* 검색 박스 - notice와 동일한 스타일 */
.search-box {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    width: 100%;
    max-width: 400px;
    font-size: 14px;
}

.search-type {
    background-color: #f8f9fa;
    border: none;
    border-right: 1px solid #dee2e6;
    padding: 10px 14px;
    font-size: 13px;
    color: #495057;
    outline: none;
    min-width: 80px;
    cursor: pointer;
}

.search-input {
    flex: 1;
    border: none;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    background: #fff;
    min-width: 0;
}

.search-input::placeholder {
    color: #6c757d;
}

.search-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    outline: none;
    transition: background-color 0.15s ease-in-out;
}

.search-btn:hover {
    background-color: #0056b3;
}

.search-btn:active {
    background-color: #004085;
}

.write-btn {
    padding: 0.6rem 1.2rem;
    background: #0066cc;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s;
}

.write-btn:hover {
    background: #0052a3;
    color: #fff;
}

.write-btn.primary {
    background: #28a745;
}

.write-btn.primary:hover {
    background: #218838;
}

/* 게시판 테이블 */
.board-table-container {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.board-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.board-table th,
.board-table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #f1f3f4;
}

.board-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
    border-bottom: 2px solid #e9ecef;
}

/* 컬럼 너비 */
.col-no { width: 80px; text-align: center; }
.col-title { width: auto; }
.col-author { 
    width: 150px; 
    text-align: center;
}
.col-date { width: 120px; text-align: center; white-space: nowrap; }
.col-views { width: 80px; text-align: center; }
.col-likes { width: 80px; text-align: center; }

/* 게시글 행 */
.board-row {
    cursor: pointer;
    transition: all 0.2s;
}

.board-row:hover {
    background: #f8f9fa;
}

.board-row.notice-row {
    background: #fffbea;
}

.board-row.notice-row:hover {
    background: #fff3cd;
}

/* 공지 배지 */
.notice-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: #ffc107;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
}

/* 제목 링크 */
.title-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.title-link:hover {
    color: #0066cc;
}

/* 댓글 수 */
.comment-count {
    color: #dc3545;
    font-size: 0.8rem;
    font-weight: 600;
}

/* 추천 배지 */
.hot-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: #dc3545;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 3px;
}

/* 작성자 정보 */
.author-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.author-name {
    font-size: 0.85rem;
    color: #666;
}

.author-name.admin {
    color: #dc3545;
    font-weight: 600;
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: #333;
}

.empty-description {
    margin: 0 0 2rem 0;
    font-size: 0.9rem;
}

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

.pagination {
    display: flex;
    gap: 0.2rem;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.8rem;
    text-decoration: none;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
    min-width: 40px;
    height: 40px;
}

.page-link:hover {
    background: #f8f9fa;
    color: #333;
}

.page-link.active {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

.page-link.first,
.page-link.prev,
.page-link.next,
.page-link.last {
    font-size: 0.8rem;
}

/* 모바일 카드 뷰 (기본적으로 숨김) */
.mobile-card-list {
    display: none;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    /* 헤더 모바일 최적화 */
    .board-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.5rem 0;
        text-align: left;
    }
    
    .header-content {
        width: 100%;
    }
    
    .board-header .write-btn {
        align-self: flex-end;
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .board-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    /* 탭 메뉴와 액션 분리 */
    .tab-menu {
        justify-content: flex-start;
    }
    
    .board-actions {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    /* 검색 박스 모바일 최적화 - notice 스타일 */
    .search-box {
        max-width: none;
        font-size: 12px;
    }
    
    .search-type {
        min-width: 50px;
        padding: 8px 8px;
        font-size: 11px;
    }
    
    .search-input {
        padding: 8px 10px;
        font-size: 12px;
        min-width: 120px;
    }
    
    .search-btn {
        padding: 8px 10px;
        font-size: 11px;
    }
    
    /* 글쓰기 버튼 크기 고정 */
    .write-btn {
        padding: 8px 16px;
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* 모바일에서 테이블 숨기고 카드 보이기 */
    .board-table {
        display: none;
    }
    
    .mobile-card-list {
        display: block;
        padding: 0;
    }
    
    .empty-state {
        padding: 2rem 1rem;
    }
}

/* 모바일 카드 스타일 */
@media (max-width: 768px) {
    .post-card {
        background: #fff;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 16px;
        cursor: pointer;
        transition: all 0.2s ease;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .post-card:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        transform: translateY(-1px);
    }
    
    .post-card.notice-card {
        border-color: #0066cc;
        background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    }
    
    .card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
    }
    
    .notice-badge {
        display: inline-block;
        padding: 4px 8px;
        background: #0066cc;
        color: white;
        font-size: 11px;
        font-weight: 600;
        border-radius: 12px;
        text-transform: uppercase;
    }
    
    .post-number {
        display: inline-block;
        padding: 4px 8px;
        background: #6c757d;
        color: white;
        font-size: 11px;
        font-weight: 600;
        border-radius: 12px;
    }
    
    .card-meta {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 12px;
        color: #666;
    }
    
    .card-author {
        font-weight: 500;
    }
    
    .card-author.admin {
        color: #0066cc;
        font-weight: 600;
    }
    
    .card-date {
        color: #999;
    }
    
    .card-title {
        margin-bottom: 10px;
    }
    
    .card-title .title-link {
        display: block;
        font-size: 15px;
        font-weight: 600;
        color: #333;
        text-decoration: none;
        line-height: 1.4;
    }
    
    .card-title .title-link:hover {
        color: #0066cc;
    }
    
    .comment-count {
        display: inline-block;
        margin-left: 6px;
        font-size: 12px;
        color: #0066cc;
        font-weight: 500;
    }
    
    .hot-badge {
        display: inline-block;
        margin-left: 6px;
        padding: 2px 6px;
        background: #ff4757;
        color: white;
        font-size: 10px;
        font-weight: 600;
        border-radius: 8px;
    }
    
    .card-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 12px;
        color: #666;
        border-top: 1px solid #f1f3f4;
        padding-top: 10px;
        margin-top: 10px;
    }
    
    .card-views,
    .card-likes {
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    .card-views i,
    .card-likes i {
        font-size: 12px;
    }
    
    .card-likes {
        color: #0066cc;
    }
}

/* 아주 좁은 화면 (320px 이하) - notice와 동일 */
@media (max-width: 320px) {
    .board-controls {
        flex-direction: column;
        gap: 10px;
        padding: 0 5px;
    }
    
    .search-area {
        width: 100%;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-type {
        min-width: 45px;
        padding: 6px 6px;
        font-size: 10px;
    }
    
    .search-input {
        padding: 6px 8px;
        font-size: 11px;
        min-width: 100px;
    }
    
    .search-btn {
        padding: 6px 8px;
        font-size: 10px;
    }
}

/* 키보드 네비게이션 및 접근성 스타일 */
.board-row.keyboard-focus {
    background-color: #e3f2fd !important;
    outline: 2px solid #2196f3;
    outline-offset: -1px;
}

.board-row:focus {
    outline: 2px solid #2196f3;
    outline-offset: -1px;
}

.tab-item:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

/* YouTube 반응형 스타일 */
.youtube-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 비율 */
    margin: 15px 0;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
}

.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* 기존 iframe들을 위한 반응형 처리 */
.post-content iframe[src*="youtube.com/embed"] {
    max-width: 100%;
    height: auto;
    aspect-ratio: 16/9;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .youtube-container {
        margin: 10px 0;
        border-radius: 6px;
    }
    
    .post-content iframe[src*="youtube.com/embed"] {
        width: 100%;
        min-height: 200px;
    }
}
