/**
 * sidebar.css — 데스크탑 좌측 사이드바만 담당
 * .sidebar-nav, 게시판 목록, 인기 태그, 로그인 영역. 레이아웃/헤더는 layout.css
 */
:root {
    --sidebar-width: 240px;
    --sidebar-collapsed: 70px;
}

.sidebar-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-collapsed);
    height: 100vh;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-light);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar-nav:hover {
    width: var(--sidebar-width);
}

.sidebar-logo {
    margin-bottom: 0.5rem;
    padding: 0 1rem;
    border-bottom: 1px solid transparent;
    flex-shrink: 0;
}

.sidebar-middle {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Hide scrollbar for sidebar middle */
.sidebar-middle::-webkit-scrollbar {
    display: none;
}

.sidebar-middle {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1rem 0 1rem;
    flex-shrink: 0;
}

/* Dynamic adjustments based on height */
@media (max-height: 750px) {
    .sidebar-section {
        display: none !important;
        margin-top: 0.5rem;
    }
}

@media (max-height: 600px) {
    .sidebar-menu-item {
        padding: 0.5rem !important;
    }

    .sidebar-middle {
        gap: 1rem;
    }
}

.sidebar-logo a {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    text-align: left;
    padding: 0.5rem;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.sidebar-logo a:hover {
    opacity: 0.7;
}

/* Logo collapsed/expanded states */
.logo-collapsed {
    display: inline;
}

.logo-expanded {
    display: none;
}

.sidebar-nav:hover .logo-collapsed {
    display: none;
}

.sidebar-nav:hover .logo-expanded {
    display: inline;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
}

/* Sidebar Sections (e.g., Popular Tags) */
.sidebar-section {
    padding: 0 1rem;
    display: none;
    /* Hidden by default when collapsed */
}

.sidebar-nav:hover .sidebar-section {
    display: block;
    /* Show on hover */
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space for directory button */
    gap: 0.5rem;
    padding: 0.25rem;
    margin-bottom: 0.25rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.directory-link {
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: all 0.2s;
    padding: 2px;
}

.directory-link:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.sidebar-nav:hover .section-header {
    opacity: 1;
}

.section-header i {
    font-size: 0.875rem;
    color: #f59e0b;
}

.section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* Sidebar Boards List (게시판 목록 - 인기 태그와 동일 스타일) */
.sidebar-boards-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* 태그와 동일한 스타일 재사용: .tag-item-sidebar, .tag-name, .tag-count */
.board-item-sidebar .board-name-sidebar {
    /* tag-name과 동일 (해시 없이 이름만) */
}
.sidebar-nav:not(:hover) .board-item-sidebar .board-name-sidebar {
    display: none;
}

/* Popular Boards List (legacy) */
.popular-boards-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-menu-item.compact {
    padding: 0.35rem;
    font-size: 0.8125rem;
}

.activity-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    /* Green for activity */
    border-radius: 50%;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 0 0 2px var(--bg-primary);
}

.sidebar-nav:hover .activity-dot {
    opacity: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Popular Tags List */
.popular-tags-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tag-item-sidebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.2s;
    background: transparent;
}

.tag-item-sidebar:hover {
    background: var(--bg-secondary);
}

.tag-item-sidebar .tag-name {
    font-size: 0.8125rem;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-nav:hover .tag-item-sidebar .tag-name {
    opacity: 1;
}

.tag-item-sidebar .tag-count {
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    min-width: 20px;
    text-align: center;
}

/* Collapsed state - show only count */
.sidebar-nav:not(:hover) .tag-item-sidebar {
    justify-content: center;
}

.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

.sidebar-menu-item i {
    min-width: 20px;
    text-align: center;
    font-size: 1.125rem;
}

.sidebar-menu-item .menu-text {
    opacity: 0;
    transition: opacity 0.2s;
}

.sidebar-nav:hover .sidebar-menu-item .menu-text {
    opacity: 1;
}

/* 사이드바 사용자 프로필: 닉네임 20자 줄바꿈 */
.sidebar-user-profile .sidebar-menu-item {
    white-space: normal;
    align-items: flex-start;
}
.sidebar-user-profile .menu-text {
    overflow-wrap: break-word;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}

.sidebar-menu-item .menu-shortcut {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.sidebar-nav:hover .sidebar-menu-item .menu-shortcut {
    opacity: 0.5;
}

.sidebar-menu-item:hover,
.sidebar-menu-item.active {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* User Level Badge - Clean & Professional */
.user-level-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.level-1 {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

/* Bronze */
.level-2 {
    background: #f0f9ff;
    color: #0369a1;
    border-color: #bae6fd;
}

/* Silver */
.level-3 {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

/* Gold */
.level-4 {
    background: #faf5ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}

/* Platinum */
.level-5 {
    background: #1e293b;
    color: #f8fafc;
    border-color: #334155;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Diamond */

.sidebar-nav:not(:hover) .user-level-badge {
    display: none;
}