/* ===================================
   GALLERY BOARD - 통합 CSS
   =================================== */

/* 기본 컨테이너 스타일 - overflow-x 제거 */
body {
    width: 100%;
    max-width: 100vw;
}

html {
    width: 100%;
    max-width: 100vw;
}

* {
    box-sizing: border-box;
}

/* 모든 이미지 반응형 처리 */
img {
    max-width: 100%;
    height: auto;
}

/* 컨테이너 클래스 - overflow-x 제거하고 width 문제 해결 */
.container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 15px;
}

/* ===================================
   GALLERY LIST PAGE STYLES
   =================================== */

.gallery-content {
    padding: 50px 0;
    width: 100%;
    max-width: 100%;
}

.gallery-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

.gallery-header {
    margin-bottom: 30px;
    text-align: center;
}

.gallery-header h2 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* 카테고리 필터 스타일 */
.category-filter {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #333;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
    min-width: 0;
}

.filter-btn:hover,
.filter-btn:active {
    background: #e9ecef;
    border-color: #adb5bd;
}

.filter-btn.active {
    background: #ffc107;
    border-color: #ffc107;
    color: #000;
}

/* 갤러리 그리드 - 너비 문제 해결 */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
    width: 100%;
    max-width: 100%;
}

.gallery-item {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: opacity 0.3s ease;
    width: 100%;
    min-width: 0;
}

.gallery-item.hidden {
    display: none;
}

.gallery-item a {
    text-decoration: none;
    color: inherit;
}

.gallery-image {
    position: relative;
    padding-top: 75%; /* 4:3 비율 */
    overflow: hidden;
    width: 100%;
}

.gallery-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-image img.default-image {
    object-fit: contain;
    padding: 20px;
    background: #f5f5f5;
}

.gallery-info {
    padding: 15px;
    width: 100%;
}

.gallery-info h3 {
    font-size: 18px;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
}

.meta {
    font-size: 14px;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.meta span {
    margin-right: 0;
}

.category-badge {
    margin-left: auto;
}

.badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-primary {
    background-color: #007bff;
    color: white;
}

.badge-success {
    background-color: #28a745;
    color: white;
}

.no-items {
    text-align: center;
    padding: 50px 0;
    color: #666;
}

.gallery-pagination {
    text-align: center;
    margin-top: 30px;
}

/* ===================================
   GALLERY VIEW PAGE STYLES
   =================================== */

.gallery-view-content {
    padding: 50px 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.gallery-view-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

.gallery-view-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.gallery-view-header h2 {
    font-size: 32px;
    margin-bottom: 15px;
    word-break: keep-all;
    line-height: 1.4;
}

.gallery-meta {
    color: #666;
}

.gallery-meta span {
    margin: 0 10px;
    font-size: 15px;
}

.gallery-meta .badge {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

.gallery-meta .bg-primary {
    background-color: #007bff !important;
    color: white;
}

.gallery-meta .bg-success {
    background-color: #28a745 !important;
    color: white;
}

.gallery-content {
    margin-bottom: 40px;
    line-height: 1.8;
    width: 100%;
    overflow-wrap: break-word;
}

.gallery-images h4,
.gallery-attachments h4 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #ffc107;
    padding-bottom: 8px;
}

.image-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
    width: 100%;
}

.gallery-image-item {
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
    position: relative;
    cursor: pointer;
    width: 100%;
    min-width: 0;
}

.gallery-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-image-item.is-main-image {
    border: 3px solid #ffc107;
}

.main-image-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ffc107;
    color: #000;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.gallery-attachments {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin: 40px 0;
    width: 100%;
    box-sizing: border-box;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.attachment-item i {
    color: #17a2b8;
    font-size: 18px;
    flex-shrink: 0;
}

.attachment-item a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
}

.attachment-item a:hover {
    color: #ffc107;
}

.gallery-view-buttons {
    text-align: center;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.btn-list {
    display: inline-block;
    padding: 12px 40px;
    background: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.btn-list:hover {
    background: #555;
    color: #fff;
}

/* ===================================
   IMAGE MODAL STYLES
   =================================== */

.image-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    cursor: pointer;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
}

.modal-content img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 8px;
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: #ffc107;
}

/* ===================================
   PAGINATION STYLES
   =================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.pagination li {
    list-style: none;
}

.pagination li a,
.pagination li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    height: 35px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.pagination li.active span {
    background: #333;
    color: #fff;
    border-color: #333;
}

.pagination li a:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.pagination li.disabled span {
    color: #ccc;
    cursor: not-allowed;
}

.pagination li:first-child a,
.pagination li:last-child a {
    font-size: 13px;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* 1200px 이하 */
@media (max-width: 1200px) {
    .gallery-inner,
    .gallery-view-inner {
        max-width: 900px;
    }
}

/* 992px 이하 - 태블릿 */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .gallery-inner,
    .gallery-view-inner {
        max-width: 600px;
    }
    
    .image-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* 768px 이하 - 모바일 */
@media (max-width: 768px) {


    .mobile-logo{
        background: white;
    }

    .gallery-content,
    .gallery-view-content {
        padding: 30px 0;
    }
    
    .gallery-inner,
    .gallery-view-inner {
        padding: 0 15px;
        max-width: 100%;
    }
    
    .gallery-grid {
        gap: 20px;
    }
    
    .gallery-header h2,
    .gallery-view-header h2 {
        font-size: 24px;
    }
    
    .category-filter {
        flex-direction: column;
        gap: 5px;
    }
    
    .filter-btn {
        width: 100%;
        padding: 12px;
    }
    
    .meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .category-badge {
        margin-left: 0;
    }
    
    .gallery-meta span {
        display: block;
        margin: 5px 0;
    }
    
    .gallery-attachments {
        padding: 20px;
    }
    
    .image-gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* 576px 이하 - 작은 모바일 */
@media (max-width: 576px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .gallery-inner,
    .gallery-view-inner {
        margin-top: 50px;
        max-width: 400px;
        padding: 0 10px;
    }
    
    .gallery-info {
        padding: 12px;
    }
    
    .gallery-info h3 {
        font-size: 16px;
    }
    
    .gallery-view-header h2 {
        font-size: 20px;
    }
    
    .btn-list {
        padding: 10px 30px;
        font-size: 14px;
    }
    
    .pagination {
        gap: 3px;
    }

    .pagination li a,
    .pagination li span {
        min-width: 30px;
        height: 30px;
        padding: 0 8px;
        font-size: 13px;
    }
    
    .attachment-item {
        padding: 10px 12px;
        flex-wrap: wrap;
    }

    .image-gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
} 