/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background-color: var(--background-white);
    z-index: 1002;
    transition: left 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar.open { left: 0; }

.sidebar-header {
    background-color: var(--main-purple);
    padding: 14px;
    display: flex;
    justify-content: flex-end; /* 닫기 아이콘을 우측 정렬 */
    align-items: center;       /* 수직 중앙 정렬 */
}

.sidebar-close {
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 0;            /* 버튼 기본 라인하이트 제거 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.sidebar-menu { list-style: none; flex-grow: 1; }

.sidebar-menu li {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-gray);
    font-size: 1rem;
    cursor: pointer;
    position: relative;        /* 활성 항목 띠 표시용 기준 */
    transition: background-color 0.15s ease-in-out;
}

.sidebar-menu li:hover { background-color: var(--purple-hover); }
.sidebar-menu li.active { font-weight: bold; }
.sidebar-menu li.active::before {
    content: "";
    position: absolute;
    left: 0; top: 0;
    width: 4px; height: 100%;
    background-color: var(--main-purple);
}

.sidebar-menu li i {
    width: 30px;
    text-align: center;
    margin-right: 15px;
    color: var(--icon-color);
}

/* Sidebar submenu */
.sidebar-menu .has-submenu { padding: 0; flex-direction: column; align-items: stretch; cursor: default; }
.sidebar-menu .menu-item { display: flex; align-items: center; padding: 18px 20px; text-decoration: none; color: var(--text-primary); transition: background-color 0.15s ease-in-out; cursor: pointer; }
.sidebar-menu .menu-item:hover { background-color: var(--purple-hover); }
.sidebar-menu .menu-item .fa-chevron-down { margin-left: auto; transition: transform 0.3s ease; font-size: 0.8em; }
.sidebar-menu .has-submenu.open > .menu-item .fa-chevron-down { transform: rotate(180deg); }
.submenu { list-style: none; padding-left: 0; display: none; background-color: var(--background-page); }
.has-submenu.open .submenu { display: block; }
.submenu li { padding-left: 30px; }
.submenu li:last-child { border-bottom: none; }

.sidebar-footer { padding: 20px; border-top: 1px solid var(--border-gray); }
.sidebar-auth { display: flex; justify-content: center; margin-bottom: 15px; }
.sidebar-auth a { text-decoration: none; color: var(--text-primary); margin: 0 10px; font-size: 0.9rem; }
.sidebar-links { text-align: center; font-size: 0.8rem; }
.sidebar-links a { text-decoration: none; color: var(--text-gray); margin: 0 5px; }

/* Dim background for sidebar */
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--background-dim); z-index: 1001; display: none; }
.overlay.show { display: block; }

/* Mobile: disable hover effects in sidebar */
@media (hover: none), (pointer: coarse) {
  .sidebar-menu li:hover,
  .sidebar-menu .menu-item:hover {
    background-color: transparent;
  }
}
