/*!
 * 侧边栏控制器样式 - 实现平滑的动画效果和美观的界面
 */

/* 侧边栏基础样式 - 确保完全靠左 */
.sidebar,
body .sidebar,
html body .sidebar,
.container .sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 300px !important;
    min-width: 300px !important;
    max-width: 300px !important;
    height: 100vh !important;
    z-index: 1000 !important; /* 恢复正常层级 */
    margin: 0 !important;
    padding: 20px !important;
    padding-top: 120px !important; /* 给蓝色三角形装饰元素留出空间 */
    box-sizing: border-box !important;
    transition: transform 0.3s ease !important;
    will-change: transform !important;
    /* 添加阴影效果，与主内容区域分离 */
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1) !important;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

/* 主内容区域样式 */
.main {
    transition: margin-left 0.3s ease;
    /* 确保主内容区域不被侧边栏遮挡 */
    margin-left: 320px !important; /* 侧边栏宽度 + 一些间距 */
    min-height: 100vh;
    padding-left: 20px;
    box-sizing: border-box;
}

/* 侧边栏切换按钮样式 */
.sidebar-toggle-btn {
    position: absolute;
    right: -15px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    z-index: 2; /* 在侧边栏上方但在装饰元素下方 */
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
    transform: translateY(-50%) scale(1.1);
}

.sidebar-toggle-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* 左移提示样式 */
.left-move-hint {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    z-index: 2; /* 在侧边栏上方但在装饰元素下方 */
    box-shadow: 0 2px 6px rgba(255, 68, 68, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 移除提示样式 */
.remove-hint {
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 2; /* 在侧边栏上方但在装饰元素下方 */
    box-shadow: 0 2px 6px rgba(255, 68, 68, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 脉冲动画 */
@keyframes pulse {
    0% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.05);
    }
    100% { 
        opacity: 1; 
        transform: scale(1);
    }
}

.left-move-hint,
.remove-hint {
    animation: pulse 2s infinite;
}

/* 侧边栏内容样式优化 */
.sidebar .social-links {
    transition: opacity 0.3s ease;
}

.sidebar .calendar-container {
    transition: opacity 0.3s ease;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar-toggle-btn {
        width: 25px;
        height: 25px;
        right: -12px;
        font-size: 12px;
    }
    
    .left-move-hint {
        left: -35px;
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .remove-hint {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* 滚动条样式优化 */
.sidebar::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: transparent;
}

/* 主内容区域滚动条样式 */
.main::-webkit-scrollbar {
    width: 8px;
}

.main::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.main::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.main::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 页面整体滚动条样式 */
body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 侧边栏悬停效果 */
.sidebar:hover .sidebar-toggle-btn {
    opacity: 1;
}

.sidebar-toggle-btn {
    opacity: 0.8;
}

/* 加载状态指示器 */
.sidebar-loading {
    position: relative;
}

.sidebar-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 - 移动设备 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%; /* 默认隐藏 */
        width: 280px;
        transition: left 0.3s ease;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main {
        margin-left: 0 !important;
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* 移动端侧边栏切换按钮 */
    .sidebar-toggle-btn {
        position: fixed;
        left: 10px;
        top: 10px;
        right: auto;
        z-index: 2; /* 在侧边栏上方但在装饰元素下方 */
    }
}

/* 侧边栏内容靠左对齐 */
.sidebar .profile,
.sidebar .social-links,
.sidebar .calendar-container {
    text-align: left;
    margin-left: 0;
    padding-left: 0;
}

/* 头像位置调整 - 避免被蓝色三角形装饰元素遮挡 */
.sidebar .profile,
body .sidebar .profile,
html body .sidebar .profile,
.container .sidebar .profile {
    margin-left: 180px !important;
    padding-left: 180px !important;
    text-align: center !important; /* 确保头像居中 */
    position: relative !important;
    z-index: 1001 !important; /* 确保在装饰元素上方 */
}

/* 强制头像位置 - 使用transform确保生效 */
.sidebar .profile {
    transform: translateX(180px) !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* 修复日历被截断的问题 */
.sidebar .calendar-container,
body .sidebar .calendar-container,
html body .sidebar .calendar-container,
.container .sidebar .calendar-container {
    margin-bottom: 60px !important; /* 给底部留出更多空间 */
    position: relative !important;
    z-index: 1001 !important;
}

/* 确保侧边栏内容完整显示 */
.sidebar,
body .sidebar,
html body .sidebar,
.container .sidebar {
    overflow-y: auto !important; /* 如果内容过多，允许滚动 */
    padding-bottom: 60px !important; /* 底部增加内边距 */
    max-height: 100vh !important;
}

/* 强制显示滚动条 */
.sidebar::-webkit-scrollbar {
    width: 8px !important;
    background: rgba(0, 0, 0, 0.1) !important;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05) !important;
    border-radius: 4px !important;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 123, 255, 0.5) !important;
    border-radius: 4px !important;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 123, 255, 0.7) !important;
} 