/* ===================================
   NEWS 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;
}

/* ===================================
   NEWS LIST PAGE STYLES
   =================================== */

.news-content {
    padding: 50px 0;
    width: 100%;
    max-width: 100%;
}

.news-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

.news-header {
    margin-bottom: 40px;
    text-align: center;
}

.news-header h2 {
    font-size: 32px;
    font-weight: 600;
}

/* 뉴스 그리드 - 너비 문제 해결 */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
    width: 100%;
    max-width: 100%;
}

.news-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

.news-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.news-item a {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.news-image {
    position: relative;
    width: 100%;
    padding-top: 60%;
    overflow: hidden;
}

.news-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-image img.default-image {
    object-fit: contain;
    padding: 20px;
    background: #f5f5f5;
}

.news-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.news-info h3 {
    font-size: 25px;
    font-weight: 600;
    margin: 12px 0;
    line-height: 1.4;
    color: #333;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
}

.news-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 15px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    flex-grow: 1;
}

.meta {
    margin-top: auto;
    font-size: 15px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.no-items {
    text-align: center;
    padding: 50px 0;
    color: #666;
}

/* ===================================
   NEWS VIEW PAGE STYLES
   =================================== */

.news-view-content {
    padding: 50px 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.news-view-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

.news-view-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.news-view-header h2 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 15px;
    line-height: 1.4;
    word-break: keep-all;
}

.news-meta {
    color: #666;
    font-size: 15px;
}

.news-meta span {
    display: inline-block;
    margin: 0 10px;
}

.news-main-image {
    margin-bottom: 40px;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
}

.news-main-image img {
    width: 100%;
    height: auto;
    display: block;
}

.news-view-content {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 40px;
    width: 100%;
    overflow-wrap: break-word;
}

.news-view-content img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
}

.news-image-gallery h4,
.news-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-item {
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
    position: relative;
    cursor: pointer;
    width: 100%;
    min-width: 0;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-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;
}

.news-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;
}

.news-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: 6px;
    font-size: 15px;
    transition: background 0.3s ease;
}

.btn-list:hover {
    background: #555;
}

/* ===================================
   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-wrapper {
    display: flex;
    justify-content: center;
    margin: 40px 0;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.pagination-item,
.pagination-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
}

.pagination-arrow {
    font-size: 14px;
}

.pagination-item:hover,
.pagination-arrow:hover {
    background-color: #f5f5f5;
    color: #333;
}

.pagination-item.active {
    background-color: #4A75E6;
    border-color: #4A75E6;
    color: #fff;
    font-weight: 500;
}

.pagination-arrow.disabled {
    opacity: 0.5;
    pointer-events: none;
    background-color: #f5f5f5;
}

.news-pagination li {
    list-style: none;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* 1200px 이하 */
@media (max-width: 1200px) {
    .news-inner,
    .news-view-inner {
        max-width: 900px;
    }
    
    .news-grid {
        gap: 25px;
    }
}

/* 992px 이하 - 태블릿 */
@media (max-width: 992px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .news-view-header h2 {
        font-size: 28px;
    }
    
    .image-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 768px 이하 - 모바일 */
@media (max-width: 768px) {


    .mobile-logo{
        background: white;
    }

    .news-content,
    .news-view-content {
        padding: 30px 0;
    }
    
    .news-inner,
    .news-view-inner {
        padding: 0 15px;
        max-width: 100%;
    }
    
    .news-view-header h2 {
        font-size: 24px;
    }
    
    .news-meta {
        font-size: 14px;
    }
    
    .news-view-content {
        font-size: 15px;
    }
    
    .image-gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-list {
        padding: 10px 30px;
        font-size: 14px;
    }
    
    .news-meta span {
        display: block;
        margin: 5px 0;
    }
    
    .news-attachments {
        padding: 20px;
    }
    
    .pagination-item,
    .pagination-arrow {
        min-width: 32px;
        height: 32px;
        padding: 0 10px;
        font-size: 13px;
    }
}

/* 576px 이하 - 작은 모바일 */
@media (max-width: 576px) {
    .news-grid {
        grid-template-columns: 1fr;
    }
    
    .news-info {
        padding: 15px;
    }
    
    .news-info h3 {
        font-size: 16px;
    }
    
    .news-excerpt {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
    
    .meta {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
    
    .news-view-header h2 {
        font-size: 20px;
    }
    
    .news-inner,
    .news-view-inner {
        padding: 0 10px;
    }
    
    .attachment-item {
        padding: 10px 12px;
        flex-wrap: wrap;
    }
    
    .image-gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
}