/* CSS Variables: 친환경 테마 컬러 설정 */
:root {
    --primary-color: #17b282; /* #2e7d32 */
    --secondary-color: #81c784;
    --bg-light: #f1f8e9;
    --text-dark: #333333;
    --text-light: #666666;
    --white: #ffffff;
    --transition: all 0.3s ease;
}

/* 기본 리셋 및 폰트 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body { font-family: 'GmarketSansMedium', sans-serif; color: var(--text-dark); overflow-x: hidden; position: relative; width: 100%; }
body.font-vi { font-family: 'Plus Jakarta Sans', sans-serif; }
body.font-en { font-family: 'Montserrat', sans-serif; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; height: auto; }

/* 본문 밀림(Off-canvas/SPA) 애니메이션을 위한 래퍼 */
#app-wrapper {
    position: relative;
    width: 100%;
    min-height: 100vh;
    left: 0;
    transition: transform 0.4s cubic-bezier(0.77, 0.2, 0.05, 1.0);
    background: var(--white);
    padding-top: 110px; /* fixed header의 높이만큼 상단 여백 확보 */
}

/* 메뉴 열림 시 본문과 고정 헤더를 동시에 좌측으로 280px 이동 */
body.menu-open {
    overflow: hidden;
}
body.menu-open header {
    transform: translateX(-280px);
}
body.menu-open #app-wrapper {
    transform: translateX(-280px);
}

/* 로딩 스크린 */
#loadingScreen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--white); z-index: 9999; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity 0.5s; }
.spinner { border: 4px solid #f3f3f3; border-top: 4px solid var(--primary-color); border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; margin-bottom: 15px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* 공통 레이어 팝업 CSS */
.custom-popup-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9990; display: none; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s; }
.custom-popup-overlay.show { display: flex; opacity: 1; }
.custom-popup-box { background: var(--white); padding: 30px; border-radius: 12px; width: 90%; max-width: 400px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.2); transform: translateY(-20px); transition: transform 0.3s; }
.custom-popup-overlay.show .custom-popup-box { transform: translateY(0); }
.custom-popup-msg { font-size: 16px; margin-bottom: 25px; line-height: 1.5; white-space: pre-wrap; }
.custom-popup-btns button { padding: 10px 20px; margin: 0 5px; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 14px; transition: var(--transition); }
.btn-confirm { background: var(--primary-color); color: var(--white); }
.btn-confirm:hover { background: #1b5e20; }
.btn-cancel { background: #e0e0e0; color: #333; }
.btn-cancel:hover { background: #bdbdbd; }

/* Header */
header { 
    position: fixed; 
    width: 100%; 
    top: 0; 
    left: 0; 
    background: var(--white); 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    z-index: 1000; 
    transition: transform 0.4s cubic-bezier(0.77, 0.2, 0.05, 1.0); 
}
.header-top { background: var(--primary-color); color: var(--white); padding: 8px 0; font-size: 13px; }
.header-top .container { display: flex; justify-content: space-between; align-items: center; }
.social-icons a { color: var(--white); margin-left: 15px; font-size: 16px; transition: var(--transition); }
.social-icons a:hover { color: var(--secondary-color); }

/* 커스텀 글래스모피즘 언어 선택 드롭다운 스타일 */
.custom-select-wrapper {
    position: relative;
    width: 140px;
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    user-select: none;
}
.custom-select-wrapper .select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    height: 34px; 
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.custom-select-wrapper .select-trigger:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}
.custom-select-wrapper .selected-value {
    display: flex;
    align-items: center;
    line-height: 1;
}
.custom-select-wrapper .arrow-icon {
    width: 12px;
    height: 12px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}
.custom-select-wrapper.open .arrow-icon {
    transform: rotate(180deg);
}
.custom-select-wrapper .options-container {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    border-radius: 8px;
    background: rgba(20, 20, 20, 0.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 25px 0 rgba(0, 0, 0, 0.25);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99;
}
.custom-select-wrapper.open .options-container {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.custom-select-wrapper .option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    line-height: 1;
}
.custom-select-wrapper .option:hover {
    background: rgba(255, 255, 255, 0.2);
}

.custom-select-wrapper .flag {
    width: 18px;
    height: 13px;
    display: inline-block;
    margin-right: 6px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    background-size: cover;
}

.header-main { padding: 15px 0; }
.header-main .container { display: flex; justify-content: space-between; align-items: center; }
.header-main .container > .logo {
    display: flex; align-items: center;
}
.header-main .container > .logo > span {
    display: inline-block; float: left; margin: 0 0 0 10px;
    max-width: auto;
    color: red; font-size: .8rem; font-weight: bold;
    white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}
.logo img { height: 40px; float: left; }

.desktop-nav { display: flex; gap: 30px; }
.desktop-nav a {
    font-weight: 600; font-size: 16px; color: var(--text-dark); transition: var(--transition);
    white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}
.desktop-nav a:hover, .desktop-nav a.active { color: var(--primary-color); }

.mobile-menu-btn { display: none; font-size: 24px; cursor: pointer; color: var(--primary-color); }

/* Mobile Nav & Off-canvas 스타일 */
.mobile-nav-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.5); z-index: 1001; 
    opacity: 0; visibility: hidden; 
    transition: opacity 0.4s ease, visibility 0.4s ease; 
}
.mobile-nav-overlay.active { opacity: 1; visibility: visible; }

.mobile-nav { 
    position: fixed; top: 0; right: 0; 
    width: 280px; height: 100%; 
    background: var(--white); z-index: 1002; 
    box-shadow: -5px 0 15px rgba(0,0,0,0.1); 
    display: flex; flex-direction: column; padding: 25px 20px; 
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.77, 0.2, 0.05, 1.0);
    touch-action: pan-y;
}
.mobile-nav.active { 
    transform: translateX(0); 
}

/* 모바일 네비 상단 헤더: 언어 선택 버튼 그룹 & 닫기 버튼 */
.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.mobile-lang-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.mobile-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.mobile-lang-btn .flag {
    width: 14px;
    height: 10px;
    display: inline-block;
    border-radius: 1px;
    background-size: cover;
}

.mobile-lang-btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.mobile-lang-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(23, 178, 130, 0.3);
}

.close-menu-btn { 
    font-size: 22px; 
    cursor: pointer; 
    color: var(--text-dark); 
    line-height: 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}
.close-menu-btn:hover {
    color: var(--primary-color);
}

.mobile-nav ul { display: flex; flex-direction: column; gap: 20px; }
.mobile-nav a { font-size: 18px; font-weight: 600; display: block; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.mobile-nav a.active { color: var(--primary-color); }

/* Container 공통 */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
section { padding: 80px 0; }
.sec-title { text-align: center; font-size: 32px; font-weight: 700; color: var(--primary-color); margin-bottom: 50px; position: relative; }
.sec-title::after { content: ''; display: block; width: 60px; height: 3px; background: var(--secondary-color); margin: 15px auto 0; }

/* Footer */
footer { background: #222; color: #fff; padding: 60px 0 20px; }
.footer-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 50px; margin-bottom: 40px; }
.footer-logo img { height: 50px; margin-bottom: 20px; }
.footer-cert { margin-top: 20px; }
.footer-cert img { max-height: 50px; }
.footer-info p { margin-bottom: 10px; font-size: 14px; color: #ccc; }
.footer-info i { width: 20px; color: var(--secondary-color); }
.footer-bottom { text-align: center; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 13px; color: #888; }

@media (max-width: 992px) {
    .desktop-nav { display: none; }
    .mobile-menu-btn { display: block; }
    .footer-grid { grid-template-columns: 1fr; }
    .custom-select-wrapper .option { padding: 12px; }
    #app-wrapper { padding-top: 105px; }
}