/* /resource/www/css/archive/archive.css */

:root {
    --bg-white: #fcfcfc;
    --bg-bright-60: rgba(237,237,237,0.6);
    --bg-bright: #ededed;
    --bg-brand-1: #00754a;
    --text-black: #222;
    --text-heavy: #a1a1a1;
    --text-white: #fcfcfc;
    --border-light: #d4d4d4;
    --border-black: #222;
}

.archive-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 120px 20px 80px;
    box-sizing: border-box;
}

/* 탭 및 검색 영역 */
.options-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.archive-tabs {
    display: flex;
    gap: 16px;
}

.tab-btn {
    padding: 10px 24px;
    border-radius: 999px;
    background-color: var(--bg-bright);
    color: var(--text-black);
    font-size: 16px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background-color: var(--bg-brand-1);
    color: var(--text-white);
}

.search-area {
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 12px 36px 12px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background-color: var(--bg-white);
    color: var(--text-black);
    background-image: url('/resource/www/images/common/icon-arrow-down.svg');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 22px;
    font-size: 16px;
    height: 48px;
    cursor: pointer;
    min-width: 82px;
}

.search-select option {
    color: var(--text-black);
    background-color: var(--bg-white);
}

.search-input-box {
    position: relative;
    width: 300px;
    height: 48px;
}

.search-input-box input {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background-color: var(--bg-white);
    padding: 12px 40px 12px 12px;
    font-size: 16px;
    box-sizing: border-box;
    outline: none;
}

.search-input-box .search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0;
}

.search-input-box .search-btn img {
    width: 22px;
    height: 22px;
}

/* 아카이브 레이아웃 (Split) */
.archive-layout {
    display: flex;
    gap: 40px;
    position: relative;
    height: calc(100vh - 280px); /* 탭/헤더 공간 제외한 화면 높이 */
    min-height: 600px;
}

.archive-list-section {
    flex: 0 0 418px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    overflow-y: auto;
    height: 100%;
    padding-right: 10px; /* 스크롤바 공간 */
}

/* 스크롤바 숨김 처리 */
.archive-list-section::-webkit-scrollbar,
.archive-detail-section::-webkit-scrollbar {
    display: none;
}
.archive-list-section,
.archive-detail-section {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}


.archive-card {
    background-color: var(--bg-bright-60);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.archive-card:hover {
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.archive-card.active {
    background-color: var(--bg-brand-1);
}

.card-thumb {
    width: 100%;
    height: 300px;
    position: relative;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    padding: 32px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card-info-top {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
}

.category-badge, .pin-badge {
    width: 32px;
    height: 32px;
    background-color: var(--bg-brand-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.archive-card.active .category-badge,
.archive-card.active .pin-badge {
    background-color: var(--bg-white);
    color: var(--bg-brand-1);
}

.pin-badge img {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
}

.archive-card.active .pin-badge img {
    filter: brightness(1) invert(0);
    filter: none;
}

.card-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-black);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.archive-card.active .card-title {
    color: var(--text-white);
}

.card-date {
    font-size: 16px;
    color: var(--text-heavy);
    text-align: right;
}

.archive-card.active .card-date {
    color: var(--text-white);
}

/* 더 보기 버튼 */
.more-btn-area {
    display: flex;
    justify-content: center;
    margin-top: 32px;
    flex-shrink: 0;
}

.btn-more {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 20px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background-color: var(--bg-white);
    font-size: 20px;
    font-weight: 500;
    color: var(--text-black);
    cursor: pointer;
    width: 250px;
    justify-content: center;
}

.btn-more img {
    width: 24px;
    height: 24px;
}

/* 상세 영역 */
.archive-detail-section {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    padding-right: 10px;
}

.detail-view {
    border-top: 2px solid var(--border-black);
}

.detail-header {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-bottom: 1px solid #d4d4d4;
}

.detail-title {
	margin: 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-black);
}

.detail-date {
	margin: 0;
    font-size: 18px;
    color: var(--text-heavy);
}

.detail-body {
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.detail-content {
    font-size: 20px;
    line-height: 1.5;
    color: var(--text-black);
}

.detail-visual {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    overflow: hidden;
    
    /* iOS Safari border-radius 버그 해결 */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}

.detail-visual img, .detail-visual iframe {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.detail-visual iframe {
	/* 부모와 동일한 border-radius 적용 */
    border-radius: 16px;
}

.detail-attachments {
    padding: 16px 32px;
    background-color: rgba(237,237,237,0.7);
}

.attach-label {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

.attach-list {
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attach-item {
    display: flex;
    align-items: center;
    gap: 32px;
}

.attach-link {
    font-size: 18px;
    color: var(--text-black);
    text-decoration: none;
}

.btn-download {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background-color: var(--bg-white);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-download img {
    width: 20px;
    height: 20px;
}

/* 모바일 팝업 */
.mobile-archive-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-white);
    z-index: 1000;
    overflow-y: auto;
}

.mobile-archive-popup.active {
    display: block;
}

.mobile-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    z-index: 1001;
    cursor: pointer;
}

.mobile-close-btn img {
    width: 16px;
    height: 16px;
}

/* 미디어 쿼리 */
@media (max-width: 1280px) {
    .archive-container {
        padding: 40px 0 60px 0;
        box-sizing: border-box;
    }
    
    .page-header {
        margin-bottom: 32px;
    }

    .page-title {
        font-size: 24px;
        letter-spacing: -0.96px;
    }
    
    .page-desc {
        font-size: 14px;
        letter-spacing: -0.56px;
    }
    
    .options-area {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        margin-bottom: 32px;
    }
    
    .archive-tabs {
        overflow-x: auto;
        padding-bottom: 4px;
        gap: 8px;
        -ms-overflow-style: none; /* IE and Edge */
        scrollbar-width: none; /* Firefox */
        padding-left: 20px;
    }

    .archive-tabs::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    
    .tab-btn {
        flex: 0 0 auto;
        padding: 10px 20px;
        font-size: 14px;
        border-radius: 30px;
    }
    
    .search-area {
        width: 100%;
        display: flex;
        gap: 6px;
        background: none;
        border: none;
        padding: 0 20px;
        height: auto;
        align-items: center;
        box-sizing: border-box;
    }
    
    .search-select {
        width: 82px;
        height: 48px;
        background-color: #fff;
        border: 1px solid var(--border-light);
        border-radius: 8px;
        padding: 0 24px 0 10px;
        font-size: 14px;
        background-image: url('/resource/www/images/common/icon-arrow-down.svg');
        background-repeat: no-repeat;
        background-position: right 8px center;
        background-size: 12px;
        appearance: none;
        -webkit-appearance: none;
        flex: 0 0 auto;
    }
    
    .search-input-box {
        flex: 1;
        height: 48px;
        background-color: #fff;
        border: 1px solid var(--border-light);
        border-radius: 8px;
        margin-left: 0;
        padding: 0;
        position: relative;
    }
    
    .search-input-box input {
        border: none;
        padding: 0 40px 0 12px;
        font-size: 14px;
        width: 100%;
        height: 100%;
        box-sizing: border-box;
        background: transparent;
    }

    .search-input-box .search-btn {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        padding: 0;
        display: flex;
        align-items: center;
    }
    
    .archive-layout {
        flex-direction: column;
        gap: 24px;
        padding: 0 20px;
        height: auto;
        min-height: auto;
    }
    
    .archive-list-section {
        flex: 1;
        width: 100%;
        gap: 20px;
        height: auto;
        overflow-y: visible;
        padding-right: 0;
    }

    
    .archive-detail-section {
        display: none;
    }
    
    .archive-card {
        width: 100%;
        background-color: #f3f3f3 !important; /* 이미지와 유사한 연한 회색 */
        border-radius: 20px;
        box-shadow: none;
    }
    
    .card-thumb {
        height: auto;
        aspect-ratio: 16 / 9;
        border-radius: 20px 20px 0 0;
        overflow: hidden;
    }

    .card-thumb img {
        border-radius: 20px 20px 0 0;
    }
    
    .card-info {
        padding: 24px 20px;
        gap: 12px;
        position: relative;
    }

    .card-info-top {
        position: absolute;
        top: 24px;
        right: 20px;
        z-index: 1;
    }

    .category-badge {
        display: none; /* 모바일 리스트에서 제외 */
    }

    .pin-badge {
        width: 24px;
        height: 24px;
        background-color: #00754a; /* 핀 아이콘 배경색 */
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .pin-badge img {
        width: 14px;
        height: 14px;
        filter: brightness(0) invert(1); /* 아이콘을 흰색으로 처리 */
    }
    
    .card-title {
        font-size: 18px;
        font-weight: 500;
        line-height: 1.4;
        color: #222;
        padding-right: 32px; /* 핀 아이콘 공간 확보 */
        margin-bottom: 8px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .card-date {
        font-size: 14px;
        color: #999;
        text-align: right;
    }
    
    .archive-card.active .card-title{
        color: #222;
    }

    .archive-card.active .card-date{
        color: #999;
    }

    .archive-card.active .pin-badge{
        background-color: #00754a;
    }

    .archive-card.active .pin-badge img {
        filter: brightness(0) invert(1);
    }

    .more-btn-area {
        margin-top: 24px;
    }

    .btn-more {
        width: 120px;
        height: 40px;
        font-size: 15px;
        padding: 0;
        border-radius: 20px;
    }

    .btn-more img {
        width: 18px;
        height: 18px;
    }

    /* 상세 팝업 내부 스타일 조정 */
    #popupContent {
        padding-top: 40px; /* 닫기 버튼 공간 */
        padding-bottom: 72px;
    }

    #popupContent .detail-header {
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 16px;
        border-bottom: 1px solid #d9d9d9;
    }

    #popupContent .detail-title {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        line-height: 1.5;
        color: #222;
    }

    #popupContent .detail-date {
        margin: 0;
        font-size: 14px;
        color: #a1a1a1;
        text-align: left;
    }

    #popupContent .detail-body {
        padding: 24px 16px;
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    #popupContent .detail-content {
        font-size: 14px;
        line-height: 1.6;
        color: #222;
        margin-top: 0;
    }

    #popupContent .detail-visual {
        aspect-ratio: 16 / 9;
        border-radius: 16px;
        overflow: hidden;
        
        /* iOS Safari border-radius 버그 해결 */
	    -webkit-mask-image: -webkit-radial-gradient(white, black);
	    mask-image: radial-gradient(white, black);
    }

    #popupContent .detail-attachments {
        padding: 16px;
        background-color: rgba(237, 237, 237, 0.7);
    }

    #popupContent .attach-label {
        font-size: 12px;
        font-weight: 700;
        margin-bottom: 16px;
        color: #222;
    }

    #popupContent .attach-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    #popupContent .attach-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    #popupContent .attach-link {
        font-size: 12px;
        color: #222;
        text-decoration: none;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
    }

    #popupContent .btn-download {
        width: 24px;
        height: 24px;
        min-width: 24px;
        background-color: #fcfcfc;
        border: 1px solid #d4d4d4;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #popupContent .btn-download img {
        width: 12px;
        height: 12px;
    }
}
