/* ==========================================================================
   1. 기존 레이아웃 및 헤더 기본 CSS (원본 보존)
   ========================================================================== */
.rows_gnb_wrap {border-top:1px solid rgba(255,255,255,0.2); padding-top: 10px; margin-top: 20px;}
.row_gnbs {position: relative;}
.row_gnbs .cbp-hrmenu > ul, .cbp-hrmenu .cbp-hrsub-inner {padding-left: 0px; padding-right: 0px;}
.row_gnbs .cbp-hrmenu > ul > li {padding-left: 0px; padding-right: 30px;}
.row_gnbs .cbp-hrmenu > ul {float:none !important; line-height: 100%;}
.gnb_wrap .row_gnbs nav {float:none;}
.row_gnbs .cbp-hrmenu .cbp-hrsub {top:40px;}

.search_top_wrap {float:left; position: relative; width: 280px;}
.search_top_wrap input {border:0px; background-color: #fff; border-radius: 60px; height:40px; width: 100%; color:#000;}
.search_top_wrap input::placeholder{font-family:'font-R',sans-serif; color:#999;}
.search_top_wrap button {position: absolute; top:11px; right:15px;}
.search_top_wrap input:focus {border:0px !important;}
.search_top_wrap_inner {position: relative;}

/* 게시판 fixed 버튼 위치조정 */
.rb_bbs_wrap .btns_gr_wrap {top:185px !important;}

.co_header0 .rows_gnb_wrap {border-top:1px solid rgba(0,0,0,0.05);}
.co_header0 .search_top_wrap input {background-color: rgba(0,0,0,0.05);}
.ser_display_none .search_top_wrap_inner {display: none;}

.cbp-hrmenu .cbp-hrsub-inner > div {min-width: 140px;}
.cbp-hrmenu .cbp-hrsub {margin-left: -30px;}
#cbp-hrmenu .cbp-hrsub .cbp-hrsub-inner > div > ul > li{position: relative; min-height:32.2px;}
#cbp-hrmenu .cbp-hropen .cbp-hrsub {padding-left: 30px; padding-right: 30px; padding-top: 20px; padding-bottom: 20px;}
.cbp-hrmenu .cbp-hrsub-inner > div i {position: absolute; top:-5px; right:-5px; opacity: 0.5; transition: transform 220ms ease, opacity 220ms ease;}
#cbp-hrmenu .cbp-hrsub .cbp-hrsub-inner > div > ul > li:hover i {opacity: 0;}
.cbp-hrmenu .cbp-hrsub-inner > div a {padding-right: 20px;}

#cbp-hrmenu .cbp-hrsub-3{
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    position: absolute;
    left: 90%;
    top: -10px;
    background-color: #fff;
    min-width: 120px;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.05);
    transform: translate3d(0, 6px, 0);
    transition: transform 220ms ease, opacity 220ms ease;
    z-index: 9
}

#cbp-hrmenu .cbp-hrsub > .cbp-hrsub-inner ul > li:hover > .cbp-hrsub-3{
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
}

#cbp-hrmenu .cbp-hrsub > .cbp-hrsub-inner ul > li:hover > .cbp-hrsub-3 a {padding-top: 4px; padding-bottom: 4px; font-family: 'font-R'; font-size: 13px; padding-right: 0px;}
#cbp-hrmenu .cbp-hrsub > .cbp-hrsub-inner ul > li:hover {position: relative;}

.gnb_all_menu .cbp-hrsub .cbp-hrsub-inner > div > ul > li {min-height: auto !important;}


/* ==========================================================================
   2. 전체분류 메가메뉴 레이아웃 개선 (여백 균등 최적화 버전)
   ========================================================================== */

/* 메뉴 항목(부모) 기준점 */
.gnb_all_menu { position: relative; }

/* 너비 시원하게 확장 및 우측 맞춤 */
.gnb_all_menu .cbp-hrsub {
    width: 1250px !important; /* 가로폭을 넓혀 시각적 쾌적함 부여 */
    right: 0 !important; 
    left: auto !important; 
    margin-left: 0 !important;
    padding: 0 !important; /* 플러그인 기본 패딩 제거하여 여백 불균형 해소 */
    overflow: hidden !important; /* 외부 껍데기 스크롤 흔적 완전 차단 */
    border: 0 !important;
}

/* 내부 중간 박스 잔여 스크롤/여백 버그 해결 */
.gnb_all_menu .cbp-hrsub-inner {
    overflow: hidden !important; 
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

/* 4단 그리드 균등 배치 및 좌우 가로 여백 대폭 확장 */
.gnb_all_menu .mega_menu_wrap {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 깔끔하게 4열 균등 분할 */
    gap: 30px 70px; /* 세로 간격 30px, 가로 간격 70px로 균형 분리 */
    padding: 50px 60px !important; /* 안쪽 여백을 넓혀 우측 쏠림 현상 방지 */
    max-height: 70vh; 
    overflow-y: auto !important; /* 오직 여기서만 스크롤바 생성 */
    overflow-x: hidden !important;
    box-sizing: border-box;
    width: 100% !important;
}

/* 기존 플러그인의 최소 너비 강제 해제 */
.gnb_all_menu .mega_menu_col {
    min-width: auto !important; 
    margin: 0 !important;
    width: 100% !important;
}

/* 세련되고 얇은 우측 스크롤바 디자인 */
.gnb_all_menu .mega_menu_wrap::-webkit-scrollbar { width: 6px; }
.gnb_all_menu .mega_menu_wrap::-webkit-scrollbar-track { background: transparent; }
.gnb_all_menu .mega_menu_wrap::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 3px; }

/* 1차 카테고리(대분류) */
.mega_depth1 { 
    font-size: 16px; 
    font-weight: 800; 
    color: #09244B; 
    padding-bottom: 12px; 
    margin-bottom: 20px; 
    border-bottom: 2px solid #f4f4f4; 
    cursor: pointer; 
}

/* 2차 카테고리(중분류) */
.mega_depth2 { 
    font-size: 14px; 
    font-weight: 600; 
    color: #222; 
    display: block; 
    margin-top: 25px; 
    padding: 0; 
}
.mega_depth2:hover { color: #09244B; }

/* 3차 카테고리(소분류) */
.mega_depth3_wrap { 
    padding-left: 0; 
    margin-top: 8px; 
    margin-bottom: 10px; 
}
.mega_depth3 { 
    font-size: 13px; 
    color: #888; 
    display: block; 
    padding: 4px 0; 
    transition: all 0.2s; 
}
.mega_depth3:hover { 
    color: #000; 
    font-weight: 600; 
}


/* ==========================================================================
   3. 모바일 반응형 CSS (원본 유지 + 메가메뉴 대응 추가)
   ========================================================================== */
@media all and (max-width:1024px) {
    .rows_gnb_wrap {display: none;}
    .search_top_wrap {width: 30%;}
    .gnb_wrap .snb_wrap .qm_wrap a {width: auto; padding-left: 0px; margin-left: 20px;}
    .gnb_wrap .tog_wrap {margin-right: 20px;}
    
    .mobile_cb {clear: both;}
    .search_top_wrap {display: block; float:none !important; width: 100%; margin-top: 10px;}
    .gnb_wrap .snb_wrap .my_btn_wrap {display: block;margin-left: 20px;}
    .gnb_wrap .snb_wrap .my_btn_wrap .btn_round.arr_bg {display: none;}
    .gnb_wrap .snb_wrap .my_btn_wrap .btn_round {padding-left: 15px; padding-right: 15px; height:35px;}
    .gnb_wrap .snb_wrap .qm_wrap a span {left: 10px;}
    
    .gnb_wrap .inner {padding-left: 0px !important; padding-right: 0px !important;}

    /* 모바일 전용 1열 배치 복구 */
    .gnb_all_menu .cbp-hrsub { width: 100% !important; right: auto !important; left: 0 !important; }
    .gnb_all_menu .mega_menu_wrap { grid-template-columns: 1fr; max-height: none; overflow-y: visible !important; padding: 15px; }
}