/* ======================================
 * 모바일 상단바
 * ====================================== */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    z-index: 1001;
    align-items: center;
    padding: 0 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.mobile-topbar-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.mobile-topbar-logo img {
    height: 28px;
}

@media (max-width: 991px) {
    .mobile-topbar {
        display: flex;
    }
}

/* ======================================
 * 사이드바 스타일
 * ====================================== */
.sidebar {
    width: 260px;
    height: 100vh;
    background-color: #ffffff;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

/* 모바일에서 사이드바 숨김 */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        top: 0;
    }

    .sidebar.sidebar-active {
        transform: translateX(0);
    }
}

.sidebar-logo {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
}

.sidebar-logo img {
    height: 36px;
}

/* 사이드바 메뉴 */
.sidebar-menu {
    padding: 0;
    margin: 0;
    list-style-type: none;
}

.sidebar-menu-category {
    margin: 20px 0 10px;
    padding: 0 20px;
    color: #666;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-menu-item {
    margin: 5px 0;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sidebar-menu-link:hover,
.sidebar-menu-link.active {
    background-color: rgba(255, 77, 141, 0.1);
    color: #ff4d8d;
}

.sidebar-menu-icon {
    width: 24px;
    margin-right: 12px;
    text-align: center;
}

.sidebar-menu-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    font-size: 12px;
}

.sidebar-menu-item.has-submenu.open .sidebar-menu-arrow {
    transform: rotate(180deg);
}

/* 서브메뉴 */
.sidebar-submenu {
    padding: 0;
    margin: 0;
    list-style-type: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-menu-item.has-submenu.open .sidebar-submenu {
    max-height: 500px;
}

.sidebar-submenu-link {
    display: block;
    padding: 10px 20px 10px 58px;
    color: #666;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar-submenu-link:hover,
.sidebar-submenu-link.active {
    background-color: rgba(255, 77, 141, 0.05);
    color: #ff4d8d;
}

/* 사이드바 사용자 섹션 */
.sidebar-user-section {
    margin-top: auto;
    padding: 20px;
}

.sidebar-user-card {
    background: linear-gradient(145deg, #ffffff, #f0f2f5);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 77, 141, 0.1);
}

.sidebar-user-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 77, 141, 0.15) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(45deg, #ff4d8d, #ff6b8b);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    margin-right: 12px;
}

.user-name {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 3px;
}

.user-role {
    font-size: 13px;
    color: #666;
}

/* 내정보 버튼 */
.sidebar-user-actions {
    margin-top: 12px;
}

.sidebar-account-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    color: #ff4d8d;
    background: rgba(255, 77, 141, 0.06);
    border: 1px solid rgba(255, 77, 141, 0.18);
    box-shadow: 0 2px 8px rgba(255, 77, 141, 0.05);
    transition: all 0.3s ease;
}

.sidebar-account-link:hover,
.sidebar-account-link:focus {
    background: rgba(255, 77, 141, 0.12);
    border-color: rgba(255, 77, 141, 0.28);
    transform: translateY(-1px);
}

/* 모바일 오버레이 */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 모바일 토글 버튼 — 상단바 안에 위치 */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 1002;
    transition: background-color 0.2s ease;
}

.mobile-menu-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.mobile-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #333;
    margin: 3px 0;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: flex;
    }
}

/* ======================================
 * 메인 컨텐츠 스타일
 * ====================================== */
.main-content {
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

@media (max-width: 991px) {
    .main-content {
        margin-left: 0;
        padding-top: 85px; /* 상단바 높이(56px) + 여백 */
    }
}

/* ======================================
 * 사이드바 Badge 스타일
 * ====================================== */

/* badge가 있는 서브메뉴 링크: flex 정렬 */
.sidebar-submenu-link--badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* badge가 있는 상위 메뉴 링크: arrow 앞에 badge 끼워넣기 */
.sidebar-menu-link--badge {
    position: relative;
}

.sidebar-menu-link--badge .sidebar-badge {
    margin-left: auto;
    margin-right: 8px;
}

.sidebar-menu-link--badge .sidebar-menu-arrow {
    margin-left: 0;
}

/* 원형 badge 공통 */
.sidebar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    background-color: #ff4d8d;
    flex-shrink: 0;
}

/* 0건일 때 회색 톤 */
.sidebar-badge--zero {
    background-color: #c0c0c0;
}

/* 스켈레톤 로딩 상태 */
.sidebar-badge--skeleton {
    width: 20px;
    height: 20px;
    padding: 0;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: sidebar-badge-shimmer 1.5s infinite ease-in-out;
    color: transparent;
    pointer-events: none;
}

@keyframes sidebar-badge-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}