/* ============================================================
   [최종 통합] grNavi Events 서비스 스타일 시트
   - 특징: 새로고침 시 왼쪽 쏠림(FOUC) 방지, 부모-자식 레이아웃 동기화
   - 수정사항: 자식 페이지 주석 처리에 대응하여 공통 탑패딩(Default Padding) 무조건 자동 작동하도록 원복
   - 추가사항: 모바일/앱 탭바 좌우 스크롤 자석 스냅 제어 포함
   ============================================================ */

/* 0. 모든 요소의 박스 사이징 기본값 설정 */
*, *::before, *::after {
    box-sizing: border-box !important;
}

/* 1. 전역 배경 및 레이아웃 기초 */
html, body {
    background: transparent !important;
    background-color: transparent !important;
    margin: 0 !important;
    padding: 0; 
    width: 100vw !important; 
    max-width: 100vw !important;
    overflow-x: hidden !important; 
}

/* ============================================================
   [탑패딩 강제 주입] 자식 페이지에 패딩이 없어도 공통에서 무조건 밀어주는 여백 설정
   ============================================================ */
html body { 
    padding-top: 160px !important;      /* 기본 PC 웹 환경 여백 */
}
@media screen and (max-width: 768px) { 
    html body { 
        padding-top: 85px !important;   /* 모바일 웹 환경 여백 */
    } 
}
html body.is-app { 
    padding-top: 65px !important;       /* 하이브리드 앱 환경 여백 */
}

/* ============================================================
   상단 슬라이드 탭바 래퍼 및 스크롤 스냅 제어
   ============================================================ */
body .sub-tab-wrapper {
    display: flex !important; 
    position: fixed !important;
    top: 0 !important; 
    left: 0 !important;
    width: 100% !important;
    height: 85px !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 4000 !important; 
    
    background: rgba(255, 249, 244, 0.85) !important; 
    backdrop-filter: blur(12px) !important;             
    -webkit-backdrop-filter: blur(12px) !important;     
    
    border-bottom: 1px solid rgba(111, 66, 193, 0.06) !important; 
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02) !important;
    transition: top 0.2s ease, background 0.3s ease; 
}

/* PC 웹 대응: 부모 페이지(has-main-menu)일 때 탭바 처리 */
body.has-main-menu .sub-tab-wrapper {
    top: 0 !important;          
    height: 145px !important;   
    padding-top: 60px !important; 
    box-sizing: border-box !important;
    background: #fff9f4 !important; 
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 1px solid #ebdcd0 !important; 
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

/* 탭 내부 슬라이드 컨테이너 */
.sub-tab-container {
    display: flex !important;
    background: transparent !important; 
    padding: 10px 4px !important; 
    margin-top: 12px !important; 
    margin-left: auto !important; 
    margin-right: auto !important;
    border-radius: 0 !important; 
    box-shadow: none !important; 
    border: none !important; 
    max-width: 94% !important; 
    overflow-x: auto !important;
    white-space: nowrap !important;
    scrollbar-width: none;
    gap: 2px; 
    
    /* 자석 스크롤 스냅 */
    scroll-snap-type: x mandatory !important;
    scroll-behavior: smooth !important;
    -webkit-overflow-scrolling: auto !important; 
}
.sub-tab-container::-webkit-scrollbar { display: none; }

/* 알약 버튼 */
.sub-tab-btn {
    all: unset !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 11px 18px !important; 
    margin: 0 4px !important;
    border-radius: 30px !important; 
    font-size: 14px !important;
    font-weight: 500 !important;
    background: #ffffff !important; 
    color: #475569 !important; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06) !important; 
    border: 1px solid rgba(0, 0, 0, 0.03) !important; 
    cursor: pointer !important;
    transition: all 0.2s ease;
    scroll-snap-align: start !important; /* 자석 앵커 */
    scroll-snap-stop: always !important;
}

.sub-tab-btn.active {
    background-color: #6f42c1 !important; 
    color: #ffffff !important; 
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.25) !important; 
}

/* 모바일 및 앱 환경 근본 대응 (미디어 쿼리) */
@media screen and (max-width: 768px) {
    header, nav, #site_navigation, .navbar, .site-header { 
        display: none !important; 
    }
    body .sub-tab-wrapper { 
        height: 70px !important;
        top: 0 !important; 
        padding-top: 0 !important; 
        background: rgba(255, 249, 244, 0.85) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
    }
    body.has-main-menu .sub-tab-wrapper {
        top: 0 !important;
        height: 70px !important;
        padding-top: 0 !important;
        background: rgba(255, 249, 244, 0.85) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
    }
    body .sub-tab-container {
        margin-top: 0 !important;
        padding: 6px 4px !important;
    }
}

/* 앱(is-app) 모드일 때 */
body.is-app .sub-tab-wrapper { 
    height: 50px !important; 
    top: 0 !important; 
    padding-top: 0 !important; 
    background: rgba(255, 249, 244, 0.85) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}
body.is-app.has-main-menu .sub-tab-wrapper {
    top: 0 !important;
    height: 50px !important;
    padding-top: 0 !important;
    background: rgba(255, 249, 244, 0.85) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}
body.is-app .sub-tab-container {
    margin-top: 0 !important;
    padding: 4px 4px !important;
}

/* 자식 페이지 내부 그리드 레이아웃 */
#event-container { 
    width: 100% !important; 
    max-width: 850px !important; 
    margin: 0 auto !important; 
    padding: 12px !important; 
    box-sizing: border-box !important;
}
.dist-grid { 
    display: grid !important; 
    grid-template-columns: repeat(2, 1fr) !important; 
    gap: 8px !important; 
    width: 100% !important;
    box-sizing: border-box !important;
}
@media (min-width: 600px) {
    .dist-grid { grid-template-columns: repeat(4, 1fr) !important; }
}