/* ==========================================================================
   1. 기본 설정 및 변수
   ========================================================================== */
:root {
    --main-blue: #003366;
    --point-red: #e60012;
    --food-orange: #f76707;
    --bg-gray: #f8f9fa;
    --border-gray: #eee;
    --text-dark: #333;
    --text-muted: #888;
    --shadow-sm: 0 4px 15px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 40px rgba(0,51,102,0.1);
    --container-width: 1200px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: 'Pretendard', -apple-system, sans-serif; 
    color: var(--text-dark); 
    line-height: 1.6; 
    background-color: #fff;
}
a { text-decoration: none; color: inherit; }

/* ==========================================================================
   2. 레이아웃 (좌우 여백 유지)
   ========================================================================== */
.container, .content-body, .main-split-container, .grid-container, .section-header { 
    max-width: var(--container-width); 
    margin-left: auto !important; 
    margin-right: auto !important; 
    padding-left: 20px; 
    padding-right: 20px; 
    width: 100%;
}

.section-header { margin-bottom: 20px }

.content-body { margin-top: 30px; min-height: 70vh; }

/* ==========================================================================
   3. 헤더 및 GNB
   ========================================================================== */
.header-wrapper { border-bottom: 1px solid var(--border-gray); background: #fff; position: sticky; top: 0; z-index: 1000; }
.header-container { max-width: var(--container-width); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; height: 70px; padding: 0 20px; }
.logo { padding-left: 40px; padding-right: 40px; }

.main-nav ul { display: flex; gap: 10px; list-style: none; align-items: center; }
.nav-group { position: relative; }
.main-cate { font-weight: 600; color: #555; font-size: 15px; padding: 10px 15px; cursor: pointer; display: block; }
.main-cate:hover, .main-cate.active { color: var(--main-blue); }

.sub-menu { 
    display: none !important; position: absolute; top: 100%; left: 0; 
    background: #fff; box-shadow: var(--shadow-lg); min-width: 180px; 
    z-index: 1001; padding: 10px 0; border-radius: 8px; border: 1px solid var(--border-gray);
}
.sub-menu li a { display: block; padding: 10px 20px; color: #666; font-size: 14px; font-weight: 500; }
.sub-menu li a:hover { background: var(--bg-gray); color: var(--main-blue); }

@media (min-width: 769px) {
    .nav-group:hover .sub-menu { display: block !important; }
}

@media (max-width: 768px) {
    /* ==========================================================================
       1. 첫 번째 줄: 로고 중앙 배치 + 우측 여백에 [다국어(위) / 날씨(아래)] 2단 적재 구조
       ========================================================================== */
    .header-wrapper {
        overflow: visible !important;
        z-index: 999999 !important; 
    }

    .header-container { 
        height: auto !important; 
        flex-direction: column !important; /* 첫 줄 로고 영역, 둘째 줄 GNB 분리 */
        padding: 12px 15px 6px 15px !important; 
        gap: 0 !important; 
        justify-content: center !important;
        align-items: center !important;
        overflow: visible !important;
        position: relative !important; /* 우측 유틸 절대 좌표계 유지 */
    }
    
    /* 로고 정중앙 배치 */
    .logo { 
        padding: 0 !important; 
        width: max-content !important; 
        display: flex !important;
        justify-content: center !important; 
        align-items: center !important;
        margin-bottom: 12px !important; /* 둘째 줄 메뉴바와의 수직 간격 */
    }


    /* [구조 개조] 날씨와 다국어가 우측에서 상하 세로 2단 배열로 쌓이도록 column 전환 */
    .header-util { 
        display: flex !important; 
        flex-direction: column !important; /* 가로 가 아닌 세로 축 쌓기 정렬 */
        align-items: flex-end !important; /* 우측 끝선에 맞춰 이쁘게 정렬 */
        position: absolute !important;
        top: 14px !important; /* 다국어 상자가 시작될 기준 천장 높이 */
        right: 15px !important; /* 우측 끝단 정밀 밀착 */
        gap: 7px !important; /* 다국어(위)와 날씨(아래) 사이의 정갈한 수직 마진 */
        flex-shrink: 0 !important;
        transform: scale(0.85) !important; /* 폰트 깨짐 없는 15% 슬림 스케일 압축 */
        transform-origin: right top !important; /* 우측 상단 기준 수축 */
        background: none !important;
        border: none !important;
        width: auto !important;
    }
    
    /* [다국어 콤보박스 - 상단 배치 완료] */
    .lang-select-box { 
        display: inline-block !important; 
        padding: 3px 5px !important; 
        font-size: 11px !important; 
        max-width: 90px !important; 
        height: 24px !important;
        line-height: 1 !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        background: #fff !important;
        margin: 0 !important;
    }

    /* [실시간 서울 날씨 - 하단 top:45px 핏 동기화 완료] */
    #weather-widget {
        display: flex !important;
        align-items: center !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: var(--text-dark) !important;
        white-space: nowrap !important;
        margin: 0 !important;
        padding-right: 2px !important; /* 다국어 박스와 우측 라인을 정교하게 맞추는 미세 보정 마진 */
    }

    /* ==========================================================================
       2. 두 번째 줄: 메뉴 개수에 상관없이 화면 가로 폭을 빈틈없이 100% 가득 채우는 스펙
       ========================================================================== */
    .main-nav {
        position: relative !important;
        width: 100% !important;
        height: 44px !important; 
        background: #ffffff !important;
        border-bottom: 1px solid var(--border-gray) !important;
        border-top: 1px solid #f5f5f5 !important;
        overflow: visible !important; 
        display: block !important;
    }
    
    .main-nav > ul { 
        display: flex !important;
        flex-direction: row !important; 
        width: 100% !important; 
        padding: 0 !important;
        margin: 0 !important;
        height: 100% !important;
        align-items: center !important;
        overflow: visible !important;
    }
    
    .nav-group { 
        flex: 1 !important; /* 자동 N분의 1 화면 꽉 채움 공식 */
        width: auto !important;
        flex-shrink: 0 !important; 
        position: relative !important; 
        text-align: center !important;
        overflow: visible !important;
    }
    
    .main-cate { 
        padding: 8px 4px !important; 
        font-size: 13px !important; 
        white-space: nowrap !important; 
        cursor: pointer !important;
        display: block !important;
        width: 100% !important;
    }

    /* ==========================================================================
       3. 서브메뉴: 본문과 슬라이더를 완벽히 밟고 최상단 공중에 둥둥 뜨는 팝업 핏
       ========================================================================== */
    .sub-menu {
        position: absolute !important;
        top: 36px !important; 
        left: 50% !important;
        transform: translateX(-50%) !important; 
        min-width: 130px !important; 
        background: #ffffff !important; 
        box-shadow: 0 12px 35px rgba(0,0,0,0.18) !important; 
        border: 1px solid var(--border-gray) !important;
        padding: 6px 0 !important;
        border-radius: 8px !important;
        z-index: 99999999 !important; 
        display: none !important; 
        visibility: hidden !important;
    }

    .sub-menu.show { 
        display: block !important; 
        visibility: visible !important;
    }
    
    .sub-menu li { width: 100% !important; display: block !important; }
    .sub-menu li a { 
        display: block !important; 
        padding: 10px 15px !important; 
        font-size: 12.5px !important; 
        color: #333 !important;
        background: none !important;
        border-radius: 0 !important;
        border: none !important;
        text-align: center !important; 
        font-weight: 600 !important;
    }
    
    .sub-menu li a:active, .sub-menu li a:hover {
        background: var(--bg-gray) !important;
        color: var(--main-blue) !important;
    }

    /* 1. 레이아웃 전체 가이드 폭을 지탱하는 컨테이너 여백 다이어트 */
    .container, 
    .header-container, 
    .main-premium-banner-zone {
        padding-left: 10px !important;  /* 기존 20~25px에서 12px로 축축 수축 */
        padding-right: 10px !important; /* 모바일 좌우 여백을 시원하게 개방 */
    }

    /* 2. 본문 아티클 및 매거진 텍스트 그릇 영역 밀착 핏 조정 */
    .content-body, 
    .article-detail-wrap, 
    .comment-section {
        padding-left: 5px !important;  /* 내부 알맹이 상자의 불필요한 마진 파괴 */
        padding-right: 5px !important;
    }
    
    /* 3. [꿀팁] 모바일 격자 그리드 카드가 찢어지지 않게 간격 세밀 조율 */
    .main-trends-grid, 
    .rec-fest-grid {
        gap: 10px !important; /* 카드와 카드 사이 틈새를 좁혀 사진을 더 크게 표출 */
    }

    body, html { overflow: auto !important; overflow-x: hidden !important; }
}

/* ==========================================================================
   4. 메인 2분할 배너 (K-TOUR vs K-VIDEO)
   ========================================================================== */
.main-split-container { display: flex; gap: 20px; margin-top: 20px; margin-bottom: 40px; min-height: 400px; }
.main-category-group { flex: 1; display: flex; flex-direction: column; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-sm); transition: 0.4s; }
.main-category-group:hover { transform: translateY(-10px); box-shadow: var(--shadow-lg); }
.category-banner { flex: 1; position: relative; background-size: cover; background-position: center; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; text-align: center; }
.category-banner::before { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.3); transition: 0.3s; }
.category-banner:hover::before { background: rgba(0,0,0,0.5); }
.banner-content { position: relative; z-index: 2; }
.banner-content h2 { font-size: 2.2rem; font-weight: 800; margin-bottom: 5px; text-shadow: 0 2px 10px rgba(0,0,0,0.3); }

/* 배경 이미지 (경로 재확인 필수) */
.tour-bg { background-image: url('/assets/img/main_tour.jpg'); background-color: var(--main-blue); }
.video-bg { background-image: url('/assets/img/main_video.jpg'); background-color: var(--point-red); }

/* ==========================================================================
   5. 그리드 카드 시스템 (Festival, Food, Video 통합)
   ========================================================================== */
.grid-container { 
    display: grid; 
    gap: 20px; 
    margin-bottom: 50px; 
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); 
}

.base-card { position: relative; height: 320px; border-radius: 15px; overflow: hidden; background: #222; display: flex; flex-direction: column; justify-content: flex-end; }
.card-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; z-index: 1; opacity: 0.7; transition: 0.5s; }
.base-card:hover .card-bg { transform: scale(1.1); }

/* 텍스트 가시성 강화 (그라데이션 암전 처리) */
.card-content, .card-overlay {
    position: relative !important; width: 100% !important; padding: 40px 20px 20px !important;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 60%, rgba(0,0,0,0) 100%) !important;
    z-index: 5 !important; display: block !important;
}

.base-card .title, .base-card .name {
    color: #ffffff !important; font-size: 1.15rem !important; font-weight: 700 !important;
    line-height: 1.4 !important; margin-bottom: 5px !important; display: block !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8) !important;
}

.base-card .addr, .base-card .sub-text {
    color: rgba(255,255,255,0.9) !important; font-size: 0.85rem !important; display: block !important;
}

/* ==========================================================================
   6. 지역 선택 버튼 (Selection Card)
   ========================================================================== */
.selection-card { background: #fff !important; height: 100px !important; border: 1px solid var(--border-gray) !important; justify-content: center !important; align-items: center !important; }
.selection-card .card-content { background: none !important; padding: 10px !important; text-align: center !important; }
.selection-card .name { color: var(--text-dark) !important; text-shadow: none !important; text-align: center !important; }

/* PC 데스크탑 화면에서 가로 4개 강제 고정 */
@media (min-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px !important;
    }
}

/* 태블릿 화면에서 가로 3개로 조정 */
@media (min-width: 769px) and (max-width: 1023px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ==========================================================================
   7. 모바일 대응
   ========================================================================== */
@media (max-width: 768px) {
    .main-split-container { flex-direction: column; min-height: auto; padding: 0 5px; }
    .category-banner { height: 180px; }
    .grid-container { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; padding: 0 5px; }
    .base-card { height: 240px; }
    .banner-content h2 { font-size: 1.8rem; }
}

/* 비디오 모달 팝업 */
.video-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}
.modal-content { width: 90%; max-width: 1000px; position: relative; }
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 비율 */
    height: 0;
}
.video-container iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 10px;
}

/* ==========================================================================
   8. 카테고리 필터 및 비디오 메타 정보
   ========================================================================== */
/* 필터 활성화 스타일 */
.active-filter {
    background: var(--main-blue) !important;
    border-color: var(--main-blue) !important;
}
.active-filter .name {
    color: #fff !important;
}

/* K-VIDEO 리스트 메타 데이터 정돈 */
.video-meta {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7); /* 살짝 투명한 화이트 */
}

.channel-name {
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.divider {
    font-size: 10px;
    opacity: 0.5;
}

.publish-date {
    font-weight: 300;
}

/* ==========================================================================
   9. [최종] 순수 HTML/CSS 연동형 구글 날개 광고판 (Floating Wings)
   ========================================================================== */
.fixed-wing {
    position: fixed !important;
    top: 160px !important; /* 헤더 바 아래 정위치 고정 */
    width: 120px !important;
    height: 600px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05) !important;
    z-index: 999999 !important; /* 본문 위에 둥둥 뜸 */
    padding: 0 !important;
    box-sizing: border-box !important;
    display: block !important;
}

/* 1200px 본문 좌우 여백 정밀 마진 고정 (1920 해상도 최적화) */
.wing-left-box {
    left: 50% !important;
    margin-left: -750px !important;
}

.wing-right-box {
    left: 50% !important;
    margin-left: 630px !important;
}

/* 브라우저 해상도가 1400px 이하로 줄어들면 본문 글자를 가리지 않게 자동 숨김 */
@media (max-width: 1400px) {
    .fixed-wing {
        display: none !important;
    }
}

/* ==========================================================================
   [항공 패치] 모바일 해상도 항공(air) 페이지 좌우 여백 최소화 및 짤림 분쇄
   ========================================================================== */
@media (max-width: 768px) {

    /* ==========================================================================
       1. [AIR & TABLE] 항공 페이지 / 검색 폼 여백 최소화 및 테이블 가로 롤링 
       ========================================================================== */
    /* 좌우 여백 극한 다이어트 통합 (양옆 40px 버려지는 도화지 면적 전면 차단) */
    .content-body.air-body, #air-container, .air-schedule-wrapper, .air-table-responsive {
        width: 100% !important; box-sizing: border-box !important;
    }
    .content-body.air-body, #air-container, .air-schedule-wrapper {
        padding-left: 5px !important; padding-right: 5px !important;
    }

    /* 항공 검색 인풋 및 셀렉트 핏 축소 */
    .air-search-form { display: flex !important; gap: 6px !important; padding: 10px 5px !important; }
    .air-search-form input, .air-search-form select { padding: 6px 4px !important; font-size: 12px !important; }

    /* 데이터 짤림 방지용 터치 가로 스크롤 및 셀 밀착 자석 정렬 */
    .air-table-responsive { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    .air-table, .air-grid { width: 100% !important; table-layout: fixed !important; font-size: 11px !important; }
    .air-table th, .air-table td, .air-card-item { padding: 6px 3px !important; text-align: center !important; letter-spacing: -0.5px !important; }

    /* [텍스트 안전망] 글자가 길어 이탈할 때 자동으로 뒤에 점(...)이 붙는 공통 말줄임표 유틸 */
    .airline-name, .flight-number, .channel-name {
        display: block !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important;
    }

    /* ==========================================================================
       2. [HEADER] 대제목(h1) 모바일 2줄 줄바꿈 깨짐 절대 방지 및 슬림화
       ========================================================================== */
    .section-header { margin-bottom: 25px !important; text-align: left !important; }
    
    /* 대제목이 화면 가로폭을 찢고 뚱뚱하게 2줄로 깨져 내려앉는 현상 원천 차단 */
    .section-header h1 {
        font-size: 1.4rem !important; font-weight: 800 !important; letter-spacing: -0.5px !important; line-height: 1.2 !important;
        white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; color: #111111 !important;
    }
    .section-header p {
        font-size: 12px !important; color: #666666 !important; margin-top: 4px !important; line-height: 1.4 !important; letter-spacing: -0.3px !important;
    }
}