/* 사이드바 레이아웃 변수 설정 */
:root {
    --sidebar-width: 320px;
    --sidebar-bg: #fff;
    --sidebar-border: #eee;
    --primary-color: var(--rb-main-color);
    --header-height-mobile: 60px;
}

/* PC 레이아웃 */
@media (min-width: 1025px) {
    body { padding-left: var(--sidebar-width); }
    #mobile_header_bar { display: none !important; }
    #sidebar_main { transform: translate3d(0,0,0) !important; }
    .mobile_visible { display: none !important; }
    .pc_visible { display: block !important; }
}

/* 모바일 레이아웃 */
@media (max-width: 1024px) {
    body { padding-left: 0; }
    .pc_visible { display: none !important; }
    .mobile_visible { display: block !important; }
}

/* 모바일 헤더 */
#mobile_header_bar {
    position: fixed; top: 0; left: 0; width: 100%; height: var(--header-height-mobile);
    background: #fff; border-bottom: 1px solid #eee; z-index: 1000; display: flex; align-items: center;
}
.mobile_header_flex {
    display: flex; align-items: center; justify-content: flex-start; gap: 15px; 
    width: 100%; height: 60px; padding: 0 20px; box-sizing: border-box;
}
.btn_ham { background: none; border: none; padding: 0; cursor: pointer; display: flex; align-items: center; }
.m_logo { display: flex; align-items: center; }
.m_logo img { height: 40px; }

/* 사이드바 공통 */
#sidebar_main {
    position: fixed; top: 0; left: 0; width: var(--sidebar-width); height: 100vh;
    background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border); z-index: 1001;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
}
@media (max-width: 1024px) {
    #sidebar_main { transform: translate3d(-100%, 0, 0); }
    #sidebar_main.active { transform: translate3d(0, 0, 0); }
}

.sidebar_inner {
    display: flex; flex-direction: column; height: 100%; overflow-y: auto; overflow-x: visible; 
    padding: 25px; box-sizing: border-box;
}
.sidebar_inner::-webkit-scrollbar { width: 4px; }
.sidebar_inner::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* 1. 로고 */
.sidebar_logo { padding-bottom: 25px; display: flex; justify-content: space-between; align-items: center; }
.sidebar_logo img { max-width: 230px; height: auto; }
.btn_close { background: none; border: none; cursor: pointer; }

/* 2. GNB */
.sidebar_gnb { flex: 1; }
.sidebar_gnb ul { list-style: none; padding: 0; margin: 0; }
.sidebar_gnb a { text-decoration: none; color: #333; display: block; }

.depth1_li { margin-bottom: 10px; position: relative; }
.depth1_li .link_wrap {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0; font-weight: bold; font-size: 17px; cursor: pointer; border-radius: 8px;
    transition: background-color 0.2s;
}
.depth1_li .link_wrap:hover { background-color: #f4f6f8; }
.depth1_li .d1_link { flex: 1; padding: 12px 0 12px 10px; pointer-events: none; }

.toggle_icon {
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: #bbb; transition: transform 0.2s;
}
.depth1_li.open .link_wrap .toggle_icon { transform: rotate(180deg); color: var(--primary-color); }
.depth1_li.open .link_wrap { color: var(--primary-color); }

.gnb_depth2 { display: none; padding: 5px 0 10px 0; }
.depth1_li.open > .gnb_depth2 { display: block; }

.depth2_li { position: relative; }
.link_wrap_d2 {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px 8px 15px; border-radius: 6px;
    font-weight: normal; font-size: 15px; color: #555;
    cursor: pointer;
}
.link_wrap_d2:hover { background-color: #f9f9f9; color: var(--primary-color); }
.d2_link { width: 100%; }

.toggle_btn_d2 {
    background: none; border: none; width: 30px; height: 30px; 
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: transform 0.2s;
}
.depth2_li.open .toggle_btn_d2 { transform: rotate(180deg); }

@media (min-width: 1025px) {
    .gnb_depth3 {
        display: none; position: fixed; top: 0; left: var(--sidebar-width);
        width: 180px; background: #fff; border: 1px solid #eee; border-radius: 8px;
        box-shadow: 4px 4px 15px rgba(0,0,0,0.08); padding: 10px 0; z-index: 2000;
    }
    .gnb_depth3::before {
        content: ''; position: absolute; left: -30px; top: 0; width: 30px; height: 100%; background: transparent;
    }
    .depth2_li:hover > .gnb_depth3 { display: block; }
    .depth3_li a { padding: 8px 20px; font-size: 14px; color: #666; }
    .depth3_li a:hover { background-color: #f5f5f5; color: var(--primary-color); }
}
@media (max-width: 1024px) {
    .gnb_depth3 {
        display: none; position: static; width: 100%; background: #fcfcfc;
        border-left: 2px solid #eee; margin-left: 15px; padding: 5px 0; box-sizing: border-box;
    }
    .depth2_li.open > .gnb_depth3 { display: block; }
    .depth3_li a { padding: 10px 15px; font-size: 14px; color: #777; display: block;}
}

.sidebar_spacer { flex-grow: 1; min-height: 30px; }

/* 4. 아이콘 메뉴바 (색상 수정) */
.sidebar_icon_menu {
    display: flex; align-items: center; gap: 15px; padding: 15px 5px; border-top: 1px solid #eee; margin-top: 20px;
}
.icon_menu_btn {
    flex: 1; background: none; border: none; padding: 8px 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; transition: background-color 0.2s; position: relative; 
    color: #25282B; /* 기본 색상 */
    text-decoration: none;
}
.icon_menu_btn:hover { 
    background-color: #f5f5f5;
    color: var(--primary-color); /* 호버 시 포인트 컬러 */
}
/* SVG fill 상속 */
.icon_menu_btn svg path { fill: currentColor; }

/* 5. 회원 정보 영역 */
.sidebar_user_area { padding-top: 10px; position: relative; } 

.user_profile_card {
    display: flex; align-items: center; gap: 12px; padding: 10px 5px;
    cursor: pointer; border-radius: 8px; transition: background-color 0.2s;
}
.user_profile_card:hover { background-color: #f5f5f5; }
.user_thumb img {
    width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 1px solid #eee;
}
.user_info_text { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.u_nick { font-size: 15px; font-weight: bold; color: #333; line-height: 1.2; }
.u_level { font-size: 12px; color: #999; margin-top: 2px; }
.btn_user_more { background: none; border: none; padding: 0; cursor: pointer; }

.user_utils_row { margin-top: 5px; padding-left: 5px; }
.util_link {
    display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #666; text-decoration: none; padding: 5px 0;
}
.util_link:hover { color: var(--primary-color); }
.pt_color { color: var(--primary-color); font-weight: bold; }

.btn_login_sidebar {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 12px 0; background: var(--primary-color); color: #fff;
    border-radius: 8px; font-weight: bold; font-size: 15px;
}

.rb_my_panel.sidebar_popover {
    display: none; position: fixed; bottom: 90px; left: 15px; 
    width: calc(var(--sidebar-width) - 30px);
    background: #fff; border: 1px solid #ddd; border-radius: 12px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1); z-index: 1002; padding: 20px; box-sizing: border-box;
}
.rb_my_panel.is_open { display: block; }

.rb_my_panel_row { display: flex; align-items: center; gap: 10px; }
.rb_my_p_ul1 img { width: 50px; height: 50px; border-radius: 10px; object-fit: cover; }
.rb_my_p_ul2 li { list-style: none; }
.font-B { font-weight: bold; }
.font-R { font-weight: normal; }
.font-14 { font-size: 14px; }
.font-12 { font-size: 12px; }
.color-999 { color: #999; }
.color-888 { color: #888; }
.mt-3 { margin-top: 3px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.my_p_flex { gap: 8px; }
.rb_my_p_btn {
    flex: 1; background: #f4f6f8; border: none; border-radius: 6px; padding: 10px 0;
    font-size: 13px; color: #333; cursor: pointer; font-weight: 500;
}
.rb_my_p_btn:hover { background: #e9ecef; }
.rb_my_p_btn_w { background: #fff; border: 1px solid #ddd; color: #666; }
.flex_l { flex: 0 0 auto; }
.flex_r { margin-left: auto; list-style: none; padding: 0; }
.rb_my_panel_line { border-top: 1px solid #eee; margin: 15px 0; }

.sidebar_overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5);
    z-index: 1000; display: none;
}
.sidebar_overlay.active { display: block; }

.search_full_overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(26 35, 47, .9); backdrop-filter: blur(10px); z-index: 9999; align-items: center; justify-content: center;
}
.search_full_overlay.active { display: flex; animation: fadeIn 0.2s ease-out; }
.btn_close_overlay { position: absolute; top: 30px; right: 30px; background: none; border: none; cursor: pointer; padding: 10px; }
.overlay_inner { width: 100%; max-width: 800px; padding: 0 20px; }
.overlay_search_box { display: flex; border-bottom: 2px solid #fff; padding-bottom: 10px; align-items: center; }
input.overlay_input {
    width: 100%; height: 60px !important; background: transparent !important; border: none !important;
    color: #fff !important; font-size: 28px !important; font-weight: bold; padding: 0 10px !important;
    box-shadow: none !important; outline: none !important;
}
input.overlay_input::placeholder { color: rgba(255,255,255,0.5); }
input.overlay_input:focus, input.overlay_input:active { border: none !important; }
.overlay_submit { background: none; border: none; cursor: pointer; padding: 0 10px; }
.search_tip { color: rgba(255,255,255,0.7); text-align: center; margin-top: 20px; font-size: 14px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

#content_wrapper { position: relative; width: 100%; min-height: 100vh; box-sizing: border-box; }
@media (max-width: 1024px) {
    #content_wrapper { padding-top: var(--header-height-mobile); }
}