/* 左侧栏导航样式 */

/* 全局模态框样式 - 确保退出登录模态框居中显示 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
    will-change: transform;
}

/* 初始加载时禁用transition，避免闪烁 */
.sidebar.preload {
    transition: none !important;
}

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

/* 移动端时，show类优先级高于collapsed类 */
@media (max-width: 768px) {
    .sidebar.collapsed.show {
        transform: translateX(0) !important;
    }
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1001;
}

.sidebar-header h2 {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer !important;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.3s;
    line-height: 1;
    z-index: 1002;
    position: relative;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: auto !important;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle:active {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    font-size: 14px;
}

.sidebar-menu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 25px;
}

.sidebar-menu-link.active {
    background: rgba(102, 126, 234, 0.3);
    color: white;
    border-left: 4px solid #667eea;
}

.sidebar-menu-link .icon {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 20px;
}

.sidebar-menu-section {
    padding: 15px 20px 5px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-menu-section:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.section-toggle-icon {
    font-size: 18px;
    font-weight: bold;
    transition: transform 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-menu-section:hover .section-toggle-icon {
    color: rgba(255, 255, 255, 1);
}

/* 主内容区域调整 */
body.with-sidebar {
    padding-left: 250px;
}

body.with-sidebar .container {
    max-width: calc(100% - 250px);
}

/* 当侧边栏收起时，让右侧内容居中显示 */
body.with-sidebar.sidebar-collapsed {
    padding-left: 0 !important;
}

body.with-sidebar.sidebar-collapsed .container {
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding-left: 20px;
    padding-right: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%) !important;
        z-index: 1002 !important;
        width: 280px !important;
        transition: transform 0.3s ease !important;
    }

    .sidebar.show {
        transform: translateX(0) !important;
        z-index: 1002 !important;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3) !important;
        display: block !important;
        visibility: visible !important;
    }
    
    /* 确保show类优先级高于collapsed类 */
    .sidebar.collapsed.show {
        transform: translateX(0) !important;
        display: block !important;
        visibility: visible !important;
    }

    body.with-sidebar {
        padding-left: 0;
        padding-right: 0;
    }

    body.with-sidebar .container {
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* 移动端菜单按钮 */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: white;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    /* 移动端侧边栏确保在最上层 */
    .sidebar {
        z-index: 1002;
    }
    
    /* 侧边栏遮罩层 */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1001;
        opacity: 0;
        transition: opacity 0.3s ease;
        animation: fadeIn 0.3s ease forwards;
    }
    
    @keyframes fadeIn {
        to {
            opacity: 1;
        }
    }
}

/* ========== 全局退出登录确认模态框样式 ========== */
.confirm-modal {
    max-width: 450px;
}

.confirm-modal .modal-body {
    padding: 40px 30px;
}

.confirm-message {
    text-align: center;
}

.confirm-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.confirm-message p {
    font-size: 1.1em;
    color: #333;
    margin: 10px 0;
    font-weight: 500;
}

.confirm-hint {
    font-size: 0.9em !important;
    color: #999 !important;
    font-weight: 400 !important;
    margin-top: 10px !important;
}

.confirm-modal .modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 30px;
    border-top: 1px solid #f0f0f0;
}

.confirm-modal .modal-footer button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.confirm-modal .btn-secondary {
    background: #95a5a6;
    color: white;
}

.confirm-modal .btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

.confirm-modal .btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.confirm-modal .btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

/* 响应式 - 移动端 */
@media (max-width: 768px) {
    .confirm-modal .modal-footer {
        flex-direction: column;
    }
    
    .confirm-modal .modal-footer button {
        width: 100%;
    }
    
    .confirm-icon {
        font-size: 3em;
    }
}