.sidebar {
    width: 250px;
    height: 100%;
    position: fixed;
    top: 0;
    left: -250px;
    /* 닫힌 상태 */
    background-color: #111;
    overflow-x: hidden;    
    transition: left 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* 자연스러운 전환 효과 */
    padding-top: 60px;
}

.sidebar.open {
    left: 0;
}

#sidebar-box {
    top: 0px;
    height: 100%;
    position: fixed;
    z-index: 99998;
    background: #fff;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* 자연스러운 전환 효과 */
}

#sidebar-box.open {
    width: calc( 100% - 45px );
    max-width: 330px;
    box-shadow: 0px 0px 13px rgb(0 0 0 / 34%);
}

#sidebar-box .sidebar-common {
    display: flex;
    justify-content: space-around;
    background: #3f414c;
}

#sidebar-box .sidebar-common .item {
    padding: 10px 5px;
    color: white;
    font-size: 1.2em;
}

#sidebar-box .sidebar-content {
    position: relative;
    padding: 0px 0px;
    overflow: auto;
    overflow-x: hidden;
    height: calc(100% - 105px); /* 헤더 및 공통메뉴 높이 고려, 필요시 조정 */
    -webkit-overflow-scrolling: touch;
    background: white;
}

#sidebar-box .sidebar-head {
    display: flex;
    width: 100%;
    background: #3f414d; /* 기존 색상 유지 */
    height: 50px; /* 헤더 높이 명시적 지정 */
    align-items: center;
}

#sidebar-box .sidebar-head .title-name {
    color: white;
    font-size: 1.2em; /* 약간 줄임 */
    font-weight: bold;
    padding-left: 15px;
    flex-grow: 1;
}

#sidebar-box .sidebar-head .title-close-btn {
    padding: 15px;
    color: white;
    font-size: 1.2em; /* 약간 줄임 */
    cursor: pointer;
}

#sidebar-box .div-title-underline-thin {
    margin-bottom: 8px;
}

#sidebar-box .sidebar-sns-login img {
    margin: 5px 0px 0px;
    width: 20%;
    float: left;
}

#sidebar-box .sidebar-icon-tbl {
    display: table;
    width: 100%;
    table-layout: fixed;
}

#sidebar-box .sidebar-icon-cell {
    display: table-cell;
    text-align: center;
    vertical-align: top;
    padding: 0px 0px 10px;
}

#sidebar-box .sidebar-icon-cell span {
    display: block;
    font-size: 12px;
    letter-spacing: -1px;
    margin-top: 6px;
}

#sidebar-box-mask {
    display: none;
    position: fixed;
    z-index: 99997;
    background: rgba(0,0,0,0.75);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

/* === Sidebar Menu Styles START === */
#sidebar-box .sidebar-menu {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid #ddd; /* 상단 구분선 */
}

/* Removed general rule: #sidebar-box .sidebar-menu a */

#sidebar-box .sidebar-menu .panel {
    background: none;
    margin-top: 0px;
    /* line-height: 24px; -- Removed, padding on 'a' will handle spacing */
}

#sidebar-box .sidebar-menu .ca-head {
    padding: 0px;
    /* border-bottom: 1px solid #eee; -- Moved to 'a' tag */
}

#sidebar-box .sidebar-menu .ca-head > a {
    display: flex; /* Flexbox for text and icon alignment */
    justify-content: space-between; /* Text left, icon right */
    align-items: center; /* Vertical centering */
    padding: 12px 15px; /* Increased padding for better touch/click area */
    text-decoration: none;
    color: #333; /* Default menu text color */
    font-size: 1em; /* 기본 메뉴 폰트 크기 */
    border-bottom: 1px solid #f0f0f0; /* Lighter separator between items */
    transition: background-color 0.2s ease, color 0.2s ease;
}

#sidebar-box .sidebar-menu .panel:last-child > .ca-head > a {
    border-bottom: none; /* Remove border for the very last menu item in the list */
}

#sidebar-box .sidebar-menu .ca-head > a:hover {
    background-color: #f5f5f5; /* Subtle hover background */
    color: #007bff; /* Highlight color on hover */
}

#sidebar-box .sidebar-menu .ca-head.active > a {
    font-weight: bold;
    color: #007bff; /* Active menu item color */
    background-color: #eef5ff; /* Light blue background for active item */
}

/* Icon for expandable menu items (the <span> tag) */
#sidebar-box .sidebar-menu .ca-head > a > .ca-href {
    width: 20px; /* Width for the icon container */
    text-align: center; /* Center the icon content */
    font-size: 0.9em; /* Relative size for the icon */
    color: #555; /* Icon color */
}

/* Pseudo-element for the actual icon (expandable items) */
#sidebar-box .sidebar-menu .ca-head > a > .ca-href::after {
    content: "\f0fe"; /* FontAwesome plus-square icon */
    font-family: "FontAwesome";
    display: inline-block;
    transition: transform 0.3s ease;
}

#sidebar-box .sidebar-menu .ca-head.active > a > .ca-href::after {
    content: "\f146"; /* FontAwesome minus-square icon when active */
    /* transform: rotate(45deg); Example rotation */
}

/* Icon for menu items without sub-menu (right arrow) */
#sidebar-box .sidebar-menu .ca-head > a.no-sub::after {
    content: "\f105"; /* FontAwesome chevron-right icon */
    font-family: "FontAwesome";
    font-size: 0.9em;
    color: #777; /* Color for the chevron icon */
}

/* Sub-menu container */
#sidebar-box .sidebar-menu .ca-sub {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fdfdfd; /* Slightly off-white background for sub-menu block */
    /* padding-left: 15px; */ /* Indent the whole sub-menu block slightly */
    display: none; /* Hidden by default */
    border-top: 1px dotted #e8e8e8; /* Separator for sub-menu block */
}

#sidebar-box .sidebar-menu .ca-head.active + .ca-sub {
    display: block; /* Show sub-menu when parent .ca-head is active */
}

/* Sub-menu list items */
#sidebar-box .sidebar-menu .ca-sub li {
    margin: 0;
}

#sidebar-box .sidebar-menu .ca-sub li a {
    display: block;
    padding: 10px 15px 10px 20px; /* Top/Right/Bottom/Left padding (indented more) */
    text-decoration: none;
    color: #444; /* Sub-menu item text color */
    font-size: 0.9em; /* Slightly smaller font for sub-menu items */
    border-bottom: 1px dotted #e8e8e8; /* Dotted separator for sub-items */
    transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

#sidebar-box .sidebar-menu .ca-sub li:last-child a {
    border-bottom: none; /* No border for the last sub-item in its block */
}

#sidebar-box .sidebar-menu .ca-sub li a:hover {
    background-color: #f0f0f0; /* Hover background for sub-menu items */
    color: #0056b3; /* Darker blue on hover for sub-menu items */
    padding-left: 25px; /* Slightly more indent on hover for feedback */
}

/* Style for the currently active/on page sub-menu item */
#sidebar-box .sidebar-menu .ca-sub li.on a {
    font-weight: bold;
    color: #007bff; /* Active sub-menu item color (matches main active) */
    background-color: #eef5ff; /* Active sub-menu item background (matches main active) */
}

#sidebar-box .sidebar-menu .ca-line { /* This class was in original, seems for special items */
    border: 0px;
    background: #fff;
    font-weight: bold;
    padding: 10px 15px; /* Ensure it has padding if used as a separator title */
    color: #777;
    font-size: 0.9em;
    text-transform: uppercase;
}
/* === Sidebar Menu Styles END === */


#sidebar-box .sidebar-search {
    border: 1px solid #eee;
    background: #fafafa;
    padding: 8px;
    margin-bottom: 10px;
}

#sidebar-box .sidebar-search .row {
    margin-left: -3px;
    margin-right: -3px;
}

#sidebar-box .sidebar-search .row > div {
    padding-left: 3px;
    padding-right: 3px;
}

#sidebar-box .sidebar-media {
    border-bottom: 1px solid #eee;
    margin: 0px 0px 8px;
    padding: 0px 0px 8px;
    line-height: 20px;
}

#sidebar-box .sidebar-media .media-photo i {
    background: #eee;
    border-radius: 50%;
    padding: 8px;
    width: 40px;
    height: 40px;
    text-align: center;
    font-size: 22px;
    display: inline-block;
}

#sidebar-box .sidebar-media .media-photo img {
    border-radius: 50%;
    width: 40px !important;
    height: 40px !important;
    display: inline-block;
}

#sidebar-box .sidebar-media .media-info {
    font-size: 12px;
    color: #888;
}

#sidebar-box .sidebar-media .media-info i {
    margin-left: 10px;
}

#sidebar-box .sidebar-login label {
    line-height: 12px !important;
    font-weight: normal;
    cursor: pointer;
}

#sidebar-box .sidebar-login .profile .photo {
    margin-right: 12px;
}

#sidebar-box .sidebar-login .profile .photo img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 0;
}

#sidebar-box .sidebar-login .profile .photo i {
    width: 60px;
    height: 60px;
    font-size: 30px;
    padding: 15px 0px 0px;
    text-align: center;
    background: #ddd;
    color: #fff;
    border-radius: 50%;
}

#sidebar-box .sidebar-login .profile h3 {
    font-size: 18px;
    line-height: 32px;
    padding: 0px;
    margin: 0px;
    letter-spacing: -1px;
    display: block;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-wrap: normal;
    overflow: hidden;
}

#sidebar-box .sidebar-login .form-group {
    margin-bottom: 10px;
}

#sidebar-box .sidebar-list {
    padding: 0px;
    margin: 0px;
    list-style: none;
}

#sidebar-box .sidebar-list a {
    display: block;
    padding: 4px 15px;
    border-bottom: 1px solid #eee;
}

#sidebar-box .sidebar-list.list-links a::after {
    top: 0px;
    font-family: "FontAwesome";
    float: right;
    position: relative;
    content: "\f105";
}

#sidebar-box .sidebar-list.list-links a.no-fa::after {
    content: "";
}

#sidebar-box .progress {
    position: relative;
    border-radius: 0px;
    height: 28px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0px 1px 2px rgba(0,0,0,0.1);
    background-color: rgb(245, 245, 245);
    -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

#sidebar-box .progress .sr-only {
    margin: 0px 15px;
    left: 0px;
    width: auto;
    height: 28px;
    line-height: 28px;
    font-size: 12px;
    clip: auto;
}

#sidebar-box .sr-score {
    height: 28px;
    line-height: 28px;
    font-size: 12px;
    padding-right: 8px;
}

#sidebar-box .sr-secret {
    display: inline-block;
    padding: 0px;
    margin: 0px;
    line-height: 12px;
    vertical-align: middle;
    background-repeat: no-repeat;
    background-position: 0px 0px;
    width: 12px;
    height: 12px;
    background-image: url('./img/icon_secret.gif');
}

#sidebar-box .sidebar-wing {
    position: absolute;
    width: 36px;
    z-index: 1;
    text-align: center;
    display: none; /* 기본적으로 숨김, JS 또는 미디어쿼리로 제어 */
}

#sidebar-box .sidebar-wing-close {
    background: #fff;
    font-size: 18px;
    font-weight: 300 !important;
    width: 36px;
    height: 50px;
    line-height: 50px !important;
    cursor: pointer;
    border: 1px solid #ddd; /* 테두리 추가하여 구분 */
}

#sidebar-box .sidebar-wing-icon {
    width: 34px;
}

#sidebar-box .sidebar-wing-icon a {
    display: block;
}

#sidebar-box .sidebar-wing-btn {
    position: relative;
    display: block;
    font-size: 18px;
    height: 40px;
    line-height: 40px !important;
}

#sidebar-box .sidebar-wing-label {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    width: 18px;
    height: 18px;
    line-height: 18px !important;
    font-size: 11px;
    text-align: center;
    letter-spacing: -1px;
}

#sidebar-box .sidebar-wing-icon .sidebar-scrollup {
    display: none;
}

#sidebar-box .item-content {
    display: flex;
    flex-direction: column;
    font-size: 1.3em;
}

#sidebar-box .item-content .item {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    cursor: pointer;
}

#sidebar-box .item-content .item .explain {
    flex-grow: 1; /* 설명 부분이 남은 공간을 차지하도록 */
}

#sidebar-box .item-content .item strong {
    /* flex-grow: 1; -- Removed, explain will take space */
    text-align: right;
    margin-left: 10px; /* 설명과 값 사이 간격 */
}

#sidebar-box .item-content .item.point strong {
    color: red;
}

#sidebar-box .item-content .item.profile {
    display: flex;
    align-items: center;
}

#sidebar-box .item-content .item.profile .name {
    padding-left: 15px;
}

#sidebar-box .item-content .item.profile .profile_img img {
    width: 40px; /* 프로필 이미지 크기 조정 */
    height: 40px;
    border-radius: 50%;
}

/* 쪽지 목록 스타일 시작 */
#sidebar-response {
    padding: 10px;
}

.sidebar-memo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.memo-item {
    border-bottom: 1px solid #eee;
    padding: 10px 5px;
}

.memo-item:last-child {
    border-bottom: none;
}

.memo-item.unread .memo-sender,
.memo-item.unread .memo-content a {
    font-weight: bold;
    color: #000; /* 안 읽은 쪽지 강조 색상 */
}

.memo-item.read .memo-sender,
.memo-item.read .memo-content a {
    color: #777; /* 읽은 쪽지 색상 */
}


.memo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.memo-sender {
    flex-grow: 1;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px; /* 보낸 사람 이름 최대 너비 */
}

.memo-time {
    color: #888;
    margin-left: 8px;
    white-space: nowrap;
}

.memo-status {
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
}

.memo-item.unread .memo-status {
    background-color: #ffc107; /* 안읽음 상태 배경색 */
    color: #333; /* 안읽음 상태 텍스트 색상 변경 */
}

.memo-item.read .memo-status {
    background-color: #e0e0e0; /* 읽음 상태 배경색 변경 */
    color: #555;  /* 읽음 상태 텍스트 색상 변경 */
}

.memo-content a {
    display: block; /* 링크 영역을 전체로 확장 */
    white-space: nowrap; /* 내용을 한 줄로 처리 */
    overflow: hidden; /* 넘치는 내용 숨김 */
    text-overflow: ellipsis; /* 말줄임표(...) 적용 */
    color: #555;
    text-decoration: none;
    font-size: 0.95em;
    line-height: 1.4;
}

.memo-content a:hover {
    text-decoration: underline;
}

.no-memos {
    padding: 20px;
    text-align: center;
    color: #777;
}

.memo-more-link {
    text-align: center;
    padding: 10px 0;
    margin-top: 10px;
    border-top: 1px solid #eee;
}

.memo-more-link a {
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
}

.memo-more-link a:hover {
    text-decoration: underline;
}

/* 쪽지 목록 스타일 끝 */


/* 미디어 쿼리 */
@media (min-width: 481px) { /* 데스크탑 등 넓은 화면 */
    #sidebar-box {
        right: -100%; /* 기본적으로 숨김 */
        border-left: 1px solid #ddd;
        /* margin-left: 40px; -- Removed, wing button will be part of the main box flow or absolutely positioned */
    }

    #sidebar-box.open { /* 열렸을 때 */
        right: 0;
    }

    #sidebar-box .sidebar-wing {
        display: none; /* 넓은 화면에서는 윙 버튼 표시 */
        left: 0;
        margin-left: -35px; /* 사이드바 바깥으로 살짝 나오도록 */
        top: 20px; /* 상단에서의 위치 */
    }

    #sidebar-box .sidebar-wing-close {
        border-right: 0px;
    }
}

@media (max-width: 480px) { /* 모바일 등 좁은 화면 */
    #sidebar-box {
        left: -100%; /* 기본적으로 숨김 */
        border-right: 1px solid #ddd;
        width: calc(100% - 40px); /* 모바일에서 열렸을 때 너비, 오른쪽 약간의 여백 */
        max-width: 300px; /* 최대 너비 제한 */
        /* margin-right: 40px; -- Removed */
    }

    #sidebar-box.open {
        left: 0; /* 열렸을 때 */
    }

    #sidebar-box .sidebar-wing { /* 모바일에서는 윙 버튼을 다른 방식으로 처리하거나 숨길 수 있음 */
        display: none; /* 모바일에서는 윙 버튼 숨김 (햄버거 메뉴 등으로 대체 가정) */
        /* 만약 모바일에서도 윙을 사용한다면 아래 스타일 적용 */
        /* right: 0;
        margin-right: -35px; */
    }

    #sidebar-box .sidebar-wing-close {
        border-left: 0px;
    }

    #sidebar-box .sidebar-head .title-name {
        font-size: 1.1em;
    }
    #sidebar-box .sidebar-head .title-close-btn {
        font-size: 1.1em;
    }
}

/* 추가적인 미디어 쿼리 (예: 1200px 이상)는 필요에 따라 기존 스타일 유지 또는 수정 */
@media (min-width: 1201px) {
    #sidebar-box .sidebar-wing {
        top: 20%; /* 기존 스타일 유지 */
    }
    /* #sidebar-btn 관련 스타일은 sidebar.php 구조에 따라 달라지므로 일단 유지 */
}

@media (max-width: 1200px) {
    #sidebar-box {
        /* padding-bottom:40px; -- sidebar-content height로 조절 */
    }
    /* #sidebar-btn 관련 스타일 유지 */
}
