/* 사이드바 기본 스타일 */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 50%, #5a4fcf 100%);
    color: white;
    z-index: 1000;
    overflow-y: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 32px rgba(102, 126, 234, 0.25);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.sidebar-logo {
    font-size: 26px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.5px;
}

.sidebar-logo i {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.3));
    font-size: 28px;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-section {
    margin-bottom: 30px;
}

.menu-section-title {
    padding: 14px 20px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 1.2px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;
}

.menu-section-title:hover {
    color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-bottom-color: rgba(255, 255, 255, 0.15);
}

.menu-section-title i {
    font-size: 14px;
    opacity: 0.9;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    margin: 2px 12px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.sidebar-menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #ffd700, #ffed4e);
    opacity: 0;
    transition: all 0.3s ease;
    border-radius: 0 4px 4px 0;
}

.sidebar-menu-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    text-decoration: none;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.sidebar-menu-item.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    color: white;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.sidebar-menu-item.active::before {
    opacity: 1;
    width: 6px;
}

.sidebar-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sidebar-menu-item:hover .sidebar-icon {
    transform: scale(1.1);
}

.sidebar-text {
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 1;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar-badge {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: auto;
    display: flex;
    align-items: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.logout-item {
    color: #ff6b6b !important;
}

.logout-item:hover {
    background: rgba(255, 107, 107, 0.1) !important;
    border-left-color: #ff6b6b !important;
}

/* 모바일 토글 버튼 */
.mobile-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 14px;
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
    backdrop-filter: blur(20px);
}

.mobile-toggle:hover {
    background: linear-gradient(135deg, #764ba2, #5a4fcf);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

/* 메인 레이아웃 */
.main-layout {
    margin-left: 280px;
    min-height: 100vh;
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 데스크톱 축소 상태 */
.sidebar-collapsed {
    width: 80px;
    overflow: visible;
}

.sidebar-collapsed .sidebar-text {
    opacity: 0;
    transform: translateX(-10px);
    width: 0;
    overflow: hidden;
}

.sidebar-collapsed .menu-section-title {
    opacity: 0;
    pointer-events: none;
    height: 0;
    margin: 0;
    padding: 0;
}

.sidebar-collapsed .sidebar-logo {
    font-size: 0;
    justify-content: center;
}

.sidebar-collapsed .sidebar-logo i {
    font-size: 28px;
}

.sidebar-collapsed .sidebar-badge {
    display: none;
}

.sidebar-collapsed .sidebar-menu-item {
    margin: 2px 8px;
    padding: 12px;
    justify-content: center;
    border-radius: 12px;
    position: relative;
}

.sidebar-collapsed .sidebar-menu-item .sidebar-icon {
    margin: 0;
    width: auto;
    height: auto;
}

.sidebar-collapsed .sidebar-menu-item::before {
    display: none;
}

.sidebar-collapsed .bookmark-toggle {
    display: none;
}

.sidebar-collapsed .sidebar-footer {
    justify-content: center;
    padding: 20px 8px;
}

.sidebar-collapsed .sidebar-footer .sidebar-text {
    display: none;
}

.sidebar-collapsed .sidebar-footer img {
    margin-right: 0;
}

.sidebar-collapsed + .main-layout {
    margin-left: 80px;
}

/* 축소된 사이드바 툴팁 */
.sidebar-collapsed .sidebar-menu-item {
    position: relative;
}

.sidebar-collapsed .sidebar-menu-item:hover::after {
    content: attr(data-menu-title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 1000;
    margin-left: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease forwards;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* 메뉴 섹션 간격 조정 */
.sidebar-collapsed .menu-section {
    margin-bottom: 8px;
}

/* 축소 상태에서 특별 섹션 스타일 */
.sidebar-collapsed .auth-section {
    margin: 8px;
    padding: 8px;
    border-radius: 12px;
}

.sidebar-collapsed .auth-section .sidebar-menu-item {
    margin: 2px 0;
    padding: 10px;
    justify-content: center;
}

.sidebar-collapsed .bookmark-section .menu-section-title,
.sidebar-collapsed .auth-section .menu-section-title {
    opacity: 0;
    pointer-events: none;
    height: 0;
    margin: 0;
    padding: 0;
}

.sidebar-collapsed .bookmark-item {
    margin: 2px 8px;
    padding: 12px;
    justify-content: center;
    border-radius: 12px;
    position: relative;
}

.sidebar-collapsed .bookmark-item .sidebar-icon {
    margin: 0;
    width: auto;
    height: auto;
}

.sidebar-collapsed .bookmark-item::before {
    display: none;
}

.sidebar-collapsed .bookmark-item .bookmark-controls {
    display: none;
}

/* 태블릿 반응형 (768px ~ 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        width: 80px;
        overflow: visible;
    }
    
    .sidebar .sidebar-text {
        opacity: 0;
        transform: translateX(-10px);
        width: 0;
        overflow: hidden;
    }
    
    .sidebar .menu-section-title {
        opacity: 0;
        pointer-events: none;
        height: 0;
        margin: 0;
        padding: 0;
    }
    
    .sidebar .sidebar-logo {
        font-size: 0;
        justify-content: center;
    }
    
    .sidebar .sidebar-logo i {
        font-size: 28px;
    }
    
    .sidebar .sidebar-badge {
        display: none;
    }
    
    .sidebar .sidebar-menu-item {
        margin: 2px 8px;
        padding: 12px;
        justify-content: center;
        border-radius: 12px;
    }
    
    .sidebar .sidebar-menu-item .sidebar-icon {
        margin: 0;
        width: auto;
        height: auto;
    }
    
    .sidebar .sidebar-menu-item::before {
        display: none;
    }
    
    .sidebar .bookmark-toggle {
        display: none;
    }
    
    .sidebar .menu-section {
        margin-bottom: 8px;
    }
    
    .sidebar .bookmark-item {
        margin: 2px 8px;
        padding: 12px;
        justify-content: center;
        border-radius: 12px;
    }
    
    .sidebar .bookmark-item .sidebar-icon {
        margin: 0;
        width: auto;
        height: auto;
    }
    
    .sidebar .bookmark-item::before {
        display: none;
    }
    
    .sidebar .bookmark-item .bookmark-controls {
        display: none;
    }
    
    .main-layout {
        margin-left: 80px;
    }
}

/* 모바일 반응형 (768px 이하) */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 100%;
        max-width: 320px;
        box-shadow: none;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.mobile-open .sidebar-text {
        opacity: 1;
        transform: translateX(0);
    }
    
    .main-layout {
        margin-left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    /* 모바일에서는 항상 텍스트 표시 */
    .sidebar .sidebar-text {
        opacity: 1 !important;
        transform: translateX(0) !important;
        display: block !important;
    }
    
    .sidebar .menu-section-title {
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    .sidebar .sidebar-logo {
        font-size: 24px !important;
    }
    
    .sidebar .sidebar-badge {
        display: block !important;
    }
    
    .sidebar .sidebar-footer .sidebar-text {
        display: block !important;
    }
    
    /* 모바일에서 사이드바가 열렸을 때 오버레이 */
    .sidebar.mobile-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 320px;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
}

/* 스크롤바 스타일 */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* 애니메이션 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in {
    animation: slideIn 0.3s ease forwards;
}

/* 소형 모바일 (480px 이하) */
@media (max-width: 480px) {
    .sidebar {
        width: 100vw;
        max-width: none;
    }
    
    .sidebar-header {
        padding: 15px;
    }
    
    .sidebar-logo {
        font-size: 20px;
    }
    
    .sidebar-menu-item {
        padding: 15px 20px;
        font-size: 16px;
    }
    
    .sidebar-icon {
        font-size: 18px;
    }
    
    .mobile-toggle {
        top: 15px;
        left: 15px;
        padding: 10px;
    }
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    .sidebar {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
    
    .mobile-toggle {
        background: #1a1a2e;
    }
    
    .mobile-toggle:hover {
        background: #16213e;
    }
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
    .sidebar {
        background: #000;
        border-right: 2px solid #fff;
    }
    
    .sidebar-menu-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* 애니메이션 감소 모드 지원 */
@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .main-layout,
    .sidebar-menu-item,
    .mobile-toggle {
        transition: none;
    }
    
    .animate-slide-in {
        animation: none;
    }
}

/* 계정 섹션 특별 스타일 */
.auth-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
    border-radius: 16px;
    padding: 12px;
    margin: 12px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.auth-section .menu-section-title {
    color: white;
    font-weight: 600;
    margin-bottom: 8px;
}

.auth-section .sidebar-menu-item {
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 4px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.auth-section .sidebar-menu-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.auth-section .sidebar-menu-item.active {
    background: rgba(255, 255, 255, 0.3);
}

.auth-section .sidebar-icon,
.auth-section .sidebar-text {
    color: white;
}

.login-item {
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.register-item {
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* 즐겨찾기 섹션 스타일 - 기본 메뉴와 동일하게 */
.bookmark-section {
    margin-bottom: 30px;
}

.bookmark-section .menu-section-title {
    padding: 14px 20px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 1.2px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;
}

.bookmark-section .menu-section-title:hover {
    color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-bottom-color: rgba(255, 255, 255, 0.15);
}

.bookmark-section .menu-section-title i {
    color: #ffd700;
    font-size: 14px;
    opacity: 0.9;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.3));
}

.bookmark-section .sidebar-badge {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.bookmark-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    margin: 2px 12px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.bookmark-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #ffd700, #ffed4e);
    opacity: 0;
    transition: all 0.3s ease;
    border-radius: 0 4px 4px 0;
}

.bookmark-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    text-decoration: none;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bookmark-item:hover::before {
    opacity: 1;
}

.bookmark-item .sidebar-icon,
.bookmark-item .sidebar-text {
    color: rgba(255, 255, 255, 0.85);
}

.bookmark-item:hover .sidebar-icon,
.bookmark-item:hover .sidebar-text {
    color: white;
}

.bookmark-item:hover .bookmark-controls {
    opacity: 1 !important;
}

/* 즐겨찾기 토글 버튼 스타일 */
.bookmark-toggle {
    margin-left: auto;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-menu-item:hover .bookmark-toggle {
    opacity: 1;
}

.bookmark-toggle:hover {
    background: rgba(255, 215, 0, 0.2);
    border-radius: 6px;
}

.bookmark-toggle i {
    font-size: 14px;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
}

.bookmark-toggle i.bookmarked {
    color: #ffd700;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8));
}

.bookmark-toggle:hover i {
    color: #ffd700;
    transform: scale(1.2);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 1));
}

/* 즐겨찾기 제거 버튼 */
.bookmark-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.bookmark-remove-btn:hover {
    background: rgba(255, 107, 107, 0.15);
    transform: scale(1.1);
}

.bookmark-remove-btn:hover i {
    color: #ff6b6b !important;
    filter: drop-shadow(0 0 6px rgba(255, 107, 107, 0.8)) !important;
}

/* 모바일에서 즐겨찾기 토글 버튼 항상 표시 */
@media (max-width: 768px) {
    .bookmark-toggle {
        opacity: 1;
    }
}

