/* 필터 컨테이너 스타일 */
.board-filter-container {
    padding: 4rem 0.5rem 0rem 0.5rem;
    max-width: 100%;
    overflow-x: hidden; /* 컨테이너 자체는 스크롤 없음 */
}

.board-filter-container .posts-filter {
    display: flex;
    gap: 10px;
    max-width: 1200px;
    margin: 0 -1rem;
    padding: 0 1rem;
    overflow-x: auto; /* 필터만 가로 스크롤 */
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox 스크롤바 숨김 */
    -ms-overflow-style: none; /* IE/Edge 스크롤바 숨김 */
    white-space: nowrap; /* 줄바꿈 방지 */
}

.board-filter-container .posts-filter::-webkit-scrollbar {
    display: none; /* Chrome/Safari 스크롤바 숨김 */
}

.board-filter-container .filter-badge {
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    background: white;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    flex-shrink: 0; /* 필터 버튼이 줄어들지 않도록 */
}

.board-filter-container .filter-badge:hover {
    background: #f5f5f5;
    border-color: #ddd;
}

.board-filter-container .filter-badge.active {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

.board-filter-container .filter-badge.active:hover {
    background: #1557b0;
    border-color: #1557b0;
}

/* 게시글 목록 스타일 */
.board-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.post-card {
    position: relative;
    overflow: visible !important;
    cursor: pointer;
    user-select: none;
    touch-action: pan-y pinch-zoom;
}

.thumbnail-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 비율 */
    background-color: #f5f5f5;
    overflow: hidden;
    border-radius: 8px;
}

/* 썸네일 배경 이미지 (어두운 효과) */
.thumbnail-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.3);
    z-index: 1;
    display: none;
}

/* 메인 썸네일 이미지 */
.post-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: all 0.3s ease;
    opacity: 1;
    z-index: 2;
}

/* 비디오 썸네일: 기본 유튜브 썸네일은 cover로 전체 영역 채움 */
.post-card[data-type="video"] .post-thumbnail {
    object-fit: cover;
}

/* 커스텀 썸네일이 있는 비디오: 배경에 블러 처리된 cover 이미지 + 메인 이미지는 contain으로 표시 */
.post-card[data-type="video"].has-custom-thumbnail .post-thumbnail {
    object-fit: contain;
    background-color: rgba(0, 0, 0, 0.1);
}

/* 이미지 썸네일: 배경에 블러 처리된 cover 이미지 + 메인 이미지는 contain으로 표시 */
.post-card[data-type="image"] .post-thumbnail {
    object-fit: contain;
    background-color: rgba(0, 0, 0, 0.1);
}

.post-card[data-type="image"] .thumbnail-background {
    display: block;
}

/* 웹페이지 썸네일: 배경에 블러 처리된 cover 이미지 + 메인 이미지는 contain으로 표시 */
.post-card[data-type="webpage"] .post-thumbnail {
    object-fit: contain;
    background-color: rgba(0, 0, 0, 0.1);
}

.post-card[data-type="webpage"] .thumbnail-background {
    display: block;
}

/* 동적 스타일 클래스 */
.post-thumbnail.contain-fit {
    object-fit: contain;
    background-color: rgba(0, 0, 0, 0.1);
}

.post-thumbnail.cover-fit {
    object-fit: cover;
    background-color: transparent;
}

.thumbnail-background.visible {
    display: block;
}

.thumbnail-background.hidden {
    display: none;
}

.skeleton-thumbnail.hidden {
    display: none;
}

/* 프로필 링크 스타일 */
.profile-link {
    cursor: pointer;
}

.post-thumbnail.loading {
    opacity: 0;
}

/* default-thumbnail.png 이미지에 그라데이션 배경 적용 */
.post-thumbnail[src*="default-thumbnail.png"],
img[src*="default-thumbnail.png"] {
    background-image: radial-gradient(circle farthest-corner at center, rgba(255, 226, 204, 1) 45%, rgba(255, 255, 255, 1) 100%);
}

.post-title {
    font-size: 1.2rem;
    color: #333;
    transition: all 0.3s ease;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.post-info {
    padding-top: 0.5 rem;
}

.post-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding-top: 0.5rem;
}

.author-profile {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.post-meta {
    flex: 1;
}

.post-meta h3 {
    font-size: 1rem;
    color: #333;
}

.author-name {
    font-size: 0.9rem;
    color: #666;
    display: block;
    margin-bottom: -0.2rem;
}

.post-details {
    font-size: 0.8rem;
    color: #999;
}

.separator {
    margin: 0 0.1ㄴrem;
}

.error-message {
    text-align: center;
    color: #666;
    margin-top: 2rem;
}

.no-posts {
    text-align: center;
    color: #666;
    margin-top: 2rem;
}

/* 반응형 스타일 */

@media (max-width: 578px) {

    .board-filter-container .posts-filter {
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
    }

    .board-list {
        grid-template-columns: 1fr;
        padding: 0.5rem 0;
    }
    
    .post-header {
        padding: 0.5rem;
    }

    .thumbnail-container {
        border-radius: 0;
    }
}

/* 스켈레톤 UI 스타일 */
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton {
    pointer-events: none;
}

.skeleton-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        #f0f0f0 25%, 
        #e0e0e0 50%, 
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: 8px;
}

.skeleton-profile,
.skeleton-title,
.skeleton-author,
.skeleton-details {
    background: linear-gradient(90deg, 
        #f0f0f0 25%, 
        #e0e0e0 50%, 
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
}

.skeleton-profile {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-title {
    width: 80%;
    height: 24px;
    margin-bottom: 4px;
    border-radius: 4px;
}

.skeleton-author {
    width: 40%;
    height: 16px;
    margin-bottom: 4px;
    border-radius: 4px;
}

.skeleton-details {
    width: 60%;
    height: 16px;
    border-radius: 4px;
}

/* 게시글 메뉴 버튼 스타일 */
.post-actions {
    position: relative;
    margin-left: auto;
    align-self: flex-start;
}

.post-menu-button {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.post-menu-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #333;
}

.post-menu-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.post-menu-button:disabled:hover {
    background-color: transparent;
    color: inherit;
}

.menu-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    font-weight: 300;
}

/* 드롭다운 메뉴 스타일 */
.post-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 100px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 1100;
    display: none;
}

.post-menu-dropdown.active {
    display: block;
}

.post-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.post-menu-item:hover {
    background-color: #f5f5f5;
}

.post-menu-item .material-icons {
    font-size: 18px;
    color: #666;
    font-weight: normal;
}

/* 신고 모달 스타일 */
.report-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.report-modal-content {
    background-color: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

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

.report-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.report-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.report-modal-body {
    padding: 20px;
}

.report-modal-body p {
    margin-top: 0;
    margin-bottom: 12px;
    color: #555;
}

.report-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.report-option span {
    font-size: 14px;
    color: #333;
}

.report-other-reason {
    margin-top: 15px;
}

.report-other-reason.hidden {
    display: none;
}

.report-other-reason textarea.auto-height {
    height: auto;
    overflow: hidden;
}

.report-other-reason textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-height: 60px;
    resize: none;
    overflow: hidden;
    font-family: inherit;
    font-size: 14px;
    transition: height 0.2s;
}

.report-other-reason .char-count {
    text-align: right;
    font-size: 12px;
    color: #777;
    margin-top: 4px;
}

.report-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid #eee;
}

.report-submit-button {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    background-color: #ff6f00;
    color: white;
}

.report-submit-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.report-submit-button:not(:disabled):hover {
    background-color: #E65100;
}

/* 애니메이션 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 로그인 모달 스타일 */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.login-modal-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease;
}

.login-modal-header {
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.login-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
    font-weight: 600;
}

.login-modal-body {
    padding: 1rem 1.5rem;
}

.login-modal-body p {
    margin: 0;
    color: #666;
    font-size: 1rem;
    line-height: 1.5;
}

.login-modal-footer {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.login-modal-close {
    padding: 0.75rem 1.5rem;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.login-modal-close:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.login-modal-login {
    padding: 0.75rem 1.5rem;
    border: none;
    background: #ff6f00;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.login-modal-login:hover {
    background: #E65100;
}

/* 모바일에서 드롭다운 메뉴 스타일 조정 */
@media (max-width: 578px) {
    .post-menu-dropdown {
        right: -10px;
        min-width: 100px;
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
        margin-right: 16px;
    }

    .post-menu-item {
        padding: 12px 16px;
        font-size: 16px;
    }

    .post-menu-item .material-icons {
        font-size: 20px;
        font-weight: normal;
    }
}

/* 관리자 메시지 스타일 */
.admin-message {
    margin-top: 20px;
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.admin-message button {
    margin-top: 10px;
    padding: 5px 10px;
}

.admin-message button + button {
    margin-left: 10px;
}

/* 핀치줌 및 확대 방지 */
html, body {
    touch-action: pan-y;
    -ms-content-zooming: none;
    -ms-touch-action: pan-y;
}

/* 더블탭 확대 방지 */
* {
    -webkit-tap-highlight-color: transparent;
}