/* gallery/detail.css - 갤러리 상세 페이지 스타일 (슬라이드 방식 + 본문 이미지 확대 기능) */

/* 게시글 헤더 스타일 */
.post-header {
    margin-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
}

.post-title {
    font-size: 24px;
    color: var(--text-main);
    margin: 0 0 15px;
    word-break: break-word;
}

.post-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--text-sub2);
    gap: 15px;
}

.post-status {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: normal;
    color: #fff;
    background-color: #dc3545;
    border-radius: 4px;
    vertical-align: middle;
}

.post-author {
    font-weight: 500;
    color: var(--text-sub1);
}

/* 갤러리 컨테이너 스타일 */
.gallery-container {
    margin-bottom: 40px;
}

.gallery-view-switch {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 16px;
}

.gallery-view-button {
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid #d7dce1;
    border-radius: 999px;
    background: #fff;
    color: #4b5563;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.gallery-view-button:hover,
.gallery-view-button:focus-visible {
    border-color: var(--main-color);
    color: var(--main-color);
}

.gallery-view-button.active {
    border-color: var(--main-color);
    background: var(--main-color);
    color: #fff;
}

[data-gallery-panel][hidden] {
    display: none !important;
}

.gallery-continuous {
    display: grid;
    gap: 24px;
}

.gallery-continuous-item {
    margin: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #f5f6f7;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

.gallery-continuous-item img {
    display: block;
    width: 100%;
    height: auto;
    cursor: zoom-in;
}

/* 메인 이미지 슬라이더 */
.gallery-main {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.gallery-main .swiper-slide {
    width: 100%;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f8f8;
}

.gallery-main img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

/* 이미지 줌 컨테이너 */
.swiper-zoom-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 네비게이션 버튼 */
.swiper-button-next,
.swiper-button-prev {
    color: var(--main-color);
    background-color: rgba(255, 255, 255, 0.8);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.swiper-button-next:after,
.swiper-button-prev:after {
    font-size: 20px;
    font-weight: bold;
}

/* 슬라이드 카운터 */
.slide-counter {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 10;
}

/* 썸네일 컨테이너 - 중요: 아래 스타일이 썸네일이 화면을 벗어나지 않게 함 */
.thumbnails-container {
    position: relative;
    width: 100%;
    margin-top: 15px;
    padding: 0 40px; /* 네비게이션 버튼 공간 확보 */
}

/* 썸네일 슬라이더 */
.gallery-thumbs {
    width: 100%;
    height: 80px; /* 썸네일 높이 고정 */
    overflow: hidden; /* 중요: 썸네일이 화면을 벗어나지 않게 함 */
}

.gallery-thumbs .swiper-slide {
    width: 100px; /* 썸네일 너비 조정 */
    height: 100%;
    opacity: 0.6;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.gallery-thumbs .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: var(--main-color);
    box-shadow: 0 0 8px rgba(255, 127, 42, 0.5);
}

/* 썸네일 네비게이션 버튼 */
.thumbs-button-next,
.thumbs-button-prev {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    z-index: 10;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: all 0.3s ease;
}

.thumbs-button-next:hover,
.thumbs-button-prev:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

.thumbs-button-prev {
    left: 0;
}

.thumbs-button-next {
    right: 0;
}

.thumbs-button-prev:after {
    content: "‹";
}

.thumbs-button-next:after {
    content: "›";
}

.post-content {
    margin-top: 30px;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    line-height: 1.6;
}

.post-content p {
    margin-bottom: 15px;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
    cursor: pointer;
}


/* 이미지 확대 모달 스타일 */
.image-zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-zoom-modal.active {
    display: flex;
    opacity: 1;
}

.image-zoom-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: zoom-out;
}

.image-zoom-modal .modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 1;
    animation: zoomIn 0.3s ease-out;
}
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-zoom-modal img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    object-fit: contain;
    margin: 0 auto;
}

.image-zoom-modal .close-btn {
    position: absolute;
    top: -40px;
    right: 0;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    transition: transform 0.2s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-zoom-modal .close-btn:hover {
    transform: scale(1.2);
}

/* 버튼 컨테이너 */
.post-actions-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

/* SNS 공유 버튼 */
.post-share {
    display: flex;
    gap: 10px;
}

.btn-share {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-share svg {
    width: 16px;
    height: 16px;
}

.btn-share-x {
    background-color: #f8f9fa;
    color: #000;
    border: 1px solid #e0e0e0;
}

.btn-share-x:hover {
    background-color: #000;
    color: #fff;
}

.btn-share-facebook {
    background-color: #f8f9fa;
    color: #1877F2;
    border: 1px solid #e0e0e0;
}

.btn-share-facebook:hover {
    background-color: #1877F2;
    color: #fff;
}

/* 액션 버튼 스타일 */
.post-actions {
    display: flex;
    gap: 10px;
}

.btn-edit,
.btn-delete,
.btn-hide,
.btn-list {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    height: 38px;
    min-width: 80px;
}

.btn-edit {
    background-color: #4A90E2;
    color: white;
    border: none;
}

.btn-edit:hover {
    background-color: #3A7EC9;
    box-shadow: 0 2px 5px rgba(74, 144, 226, 0.3);
}

.btn-delete {
    background-color: #E53935;
    color: white;
    border: none;
}

.btn-delete:hover {
    background-color: #D32F2F;
    box-shadow: 0 2px 5px rgba(229, 57, 53, 0.3);
}

.btn-hide {
    background-color: #FF9800;
    color: white;
    border: none;
}

.btn-hide:hover {
    background-color: #FB8C00;
    box-shadow: 0 2px 5px rgba(255, 152, 0, 0.3);
}

.btn-list {
    background-color: #ECEFF1;
    color: #455A64;
    border: 1px solid #CFD8DC;
}

.btn-list:hover {
    background-color: #CFD8DC;
    color: #263238;
    box-shadow: 0 2px 5px rgba(69, 90, 100, 0.1);
}

/* 이미지 모달 스타일 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.image-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1;
}

.modal-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-image-container {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modalImage {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: background-color 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.modal-controls {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
    z-index: 3;
}

.modal-prev, .modal-next {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.modal-prev:hover, .modal-next:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* 본문 이미지 확대 기능 */
.image-zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.image-zoom-modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 2;
}

#zoomedImage {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
}

.close-btn {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* 갤러리 메인 이미지 클릭 가능 표시 */
.gallery-main .swiper-slide img {
    cursor: pointer;
}

/* 본문 확대 가능 이미지 표시 */
.post-content img.zoomable {
    cursor: pointer;
    transition: transform 0.2s;
}

.post-content img.zoomable:hover {
    transform: scale(1.03);
}

/* 반응형 스타일 */
@media (max-width: 768px) {
    .post-title {
        font-size: 20px;
    }

    .thumbnails-container {
        padding: 0 30px; /* 좁은 화면에서 네비게이션 버튼 여백 줄임 */
    }

    .gallery-thumbs {
        height: 60px; /* 모바일에서 썸네일 높이 줄임 */
    }

    .gallery-thumbs .swiper-slide {
        width: 80px; /* 모바일에서 썸네일 너비 줄임 */
    }

    .post-actions-container {
        flex-direction: column;
        align-items: stretch;
    }

    .post-share {
        justify-content: center;
        order: 2;
    }

    .post-actions {
        flex-direction: column;
        order: 1;
        width: 100%;
    }

    .btn-edit,
    .btn-delete,
    .btn-hide,
    .btn-list {
        width: 100%;
    }

    .image-zoom-modal .close-btn {
        top: -30px;
        right: 0;
    }

    .modal-close {
        top: 10px;
        right: 10px;
    }

    .modal-controls {
        padding: 0 10px;
    }

    .modal-prev, .modal-next {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .close-btn {
        top: 10px;
        right: 10px;
    }
}
