* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    color: #333;
    margin-bottom: 0; 
    border-bottom: none; 
    padding-bottom: 0; 
    font-size: 2em; 
}

/* 【新增】顶部栏容器，用于对齐标题和按钮 */
.header-bar {
    display: flex;
    justify-content: space-between; /* 标题和按钮两端对齐 */
    align-items: center; /* 垂直居中对齐 */
    margin-bottom: 20px;
    border-bottom: 1px solid #eee; /* 将分隔线移到整个 bar 的底部 */
    padding-bottom: 10px;
}

/* 登录表单样式 */
.login-form {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.login-form h2 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

.login-form button {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.login-form button:hover {
    background-color: #0056b3;
}

/* 上传按钮样式 */
.upload-btn {
    padding: 8px 15px;
    background-color: #28a745; /* 绿色按钮 */
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-right: 10px; /* 与登出按钮保持间距 */
}

.upload-btn:hover {
    background-color: #1e7e34;
}

/* 新建目录按钮样式 */
.create-dir-btn {
    padding: 8px 15px;
    background-color: #007bff; /* 蓝色按钮 */
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-right: 10px; /* 与上传按钮保持间距 */
}

.create-dir-btn:hover {
    background-color: #0056b3;
}

/* 登出按钮样式（原有） */
.logout-btn {
    padding: 8px 15px;
/* ... (保持不变) ... */
}

/* 验证码组 */
.captcha-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.captcha-group input[type="text"] {
    flex: 1;
    margin-right: 10px;
    margin-bottom: 0;
}

.captcha-img {
    width: 120px; /* 调整宽度以适应验证码图片 */
    height: 44px; /* 调整高度与输入框对齐 */
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}

/* 面包屑样式（修复对齐） */
.breadcrumb {
    margin: 15px 0;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.crumb {
    color: #007bff;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.crumb:hover {
    text-decoration: underline;
    background-color: #e9f2ff;
}

.crumb::after {
    content: "/";
    color: #666;
    margin-left: 8px;
    font-weight: normal;
}

.crumb:last-child::after {
    content: "";
}

/* 【新增】顶部控制区样式 */
.header-controls {
    display: flex;
    justify-content: flex-end; /* 靠右对齐 */
    margin-bottom: 10px;
}

.logout-btn {
    padding: 8px 15px;
    background-color: #dc3545; /* 红色按钮 */
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.logout-btn:hover {
    background-color: #c82333;
}

.breadcrumb {
    margin: 15px 0; /* 调整 margin 以适应新的 header-controls */
    padding: 12px 15px;
    /* ... (其余面包屑样式不变) ... */
}

/* 文件列表样式 */

/* 文件列表头部样式 */
.file-list-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #e9ecef; /* 浅灰色背景 */
    border-top: 1px solid #dee2e6;
    font-weight: bold;
    color: #333;
    font-size: 14px;
    border: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6; /* 只保留底部边框 */
    border-radius: 6px 6px 0 0;
}

/* 列表头图标占位，保持与列表项对齐 */
.file-icon-header {
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

/* 列表头列样式 */
.file-name-header {
    flex: 1;
}

.file-size-header {
    margin-right: 20px;
    width: 100px;
    text-align: right;
}

.file-modtime-header {
    width: 180px;
    text-align: right;
}

/* 操作列头部样式 */
.file-actions-header { 
    width: 80px;
    text-align: center;
}

/* 可排序列的样式 */
.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 20px; /* 留出空间给排序图标 */
}

.sortable:hover {
    color: #007bff;
}

/* 排序图标（使用 Unicode 箭头） */
.sortable::after {
    content: ''; /* 默认无图标 */
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #6c757d;
}

/* 升序图标 */
.sortable[data-order="asc"]::after {
    content: '▲';
}

/* 降序图标 */
.sortable[data-order="desc"]::after {
    content: '▼';
}

.file-list {
    margin: 0 0 20px 0;
    border: 1px solid #eee; /* 边框移回 file-list */
    border-radius: 0 0 6px 6px;
    overflow: hidden;
    border-top: none; /* 顶部边框由 list-header 承担 */
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
    border-left: 1px solid #eee; /* 列表项左右边框 */
    border-right: 1px solid #eee;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item:hover {
    background-color: #f8f9fa;
}

.file-item.dir {
    color: #007bff;
}

.file-item.file {
    color: #333;
}

.file-item.image {
    color: #28a745;
}

.file-item.video {
    color: #dc3545;
}

.file-item.audio { /* 【新增】音频文件样式 */
    color: #ffc107; /* 例如，使用黄色系 */
}

.file-icon {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.file-name {
    flex: 1;
    font-size: 14px;
}

.file-size {
    color: #666;
    margin-right: 20px;
    width: 100px;
    text-align: right;
    font-size: 13px;
}

.file-modtime {
    color: #666;
    width: 180px;
    font-size: 13px;
    text-align: right;
}

/* 操作列样式 */
.file-actions { 
    width: 120px; /* 调整宽度以容纳两个按钮 */
    text-align: center;
    display: flex; /* 使用 Flexbox 布局 */
    gap: 5px; /* 按钮之间的间距 */
    justify-content: flex-end; /* 按钮靠右对齐 */
}

/* 下载按钮样式 */
.download-btn {
    background-color: #17a2b8; /* 信息蓝/青色背景 */
    color: white;
    border: none;
    padding: 5px 8px; /* 略微调整 padding */
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
    line-height: 1; 
}

.download-btn:hover {
    background-color: #138496; 
}

/* 删除按钮样式 */
.delete-btn {
    background-color: #6c757d; 
    color: white;
    border: none;
    padding: 5px 8px; /* 略微调整 padding */
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
    line-height: 1; 
}

.delete-btn:hover {
    background-color: #5a6268;
}

/* 文件预览区域（支持文本/图片/视频） */
.file-preview {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: none;
    z-index: 1000;
    padding: 20px;
    overflow: auto;
}

.file-preview.show {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 1001;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background: #c82333;
}

.preview-content {
    max-width: 90%;
    max-height: 90%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preview-content pre {
    background: white;
    padding: 20px;
    border-radius: 6px;
    width: 100%;
    height: 100%;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
}

.preview-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
}

.preview-content video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
    background: black;
}

.preview-content audio { /* 【新增】音频播放器样式 */
    max-width: 90%;
    margin: 50px auto;
}

/* 空目录提示 */
.empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* 消息提示容器，固定在右上角，实现悬浮展示 */
.message-container {
    position: fixed; /* 固定定位，不随滚动条移动 */
    top: 20px;
    right: 20px;
    z-index: 10000; /* 确保在其他元素之上 */
    width: 300px; /* 设置固定宽度 */
    max-width: 90%; /* 移动端兼容 */
}

/* 消息框基础样式 */
.message {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 10px; /* 多个消息堆叠时保持间距 */
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0; /* 默认隐藏 */
    transform: translateX(100%); /* 默认移出屏幕右侧 */
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out; /* 过渡效果 */
}

/* 消息框显示时样式 */
.message.show {
    opacity: 1;
    transform: translateX(0); /* 滑入屏幕 */
}

/* 错误消息（红色） */
.message.error {
    color: #dc3545; /* 深红色文字 */
    background: #f8d7da; /* 浅红色背景 */
    border: 1px solid #f5c6cb;
}

/* 成功消息（绿色） */
.message.success {
    color: #155724; /* 深绿色文字 */
    background: #d4edda; /* 浅绿色背景 */
    border: 1px solid #c3e6cb;
}

/* 响应式 */
@media (max-width: 768px) {
    .file-size, .file-modtime, .file-actions,
    .file-size-header, .file-modtime-header, .file-actions-header { /* 隐藏列表头对应列 */
        display: none;
    }
    
    .breadcrumb {
        padding: 10px;
    }
    
    .file-item {
        padding: 10px;
    }
    
    .preview-content {
        max-width: 95%;
        max-height: 85%;
    }
}

/* 加载指示器容器 */
.file-preview .loader-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7); /* 半透明背景 */
    z-index: 1000; /* 确保在预览内容之下，在关闭按钮之下 */
    color: white;
    font-size: 20px;
}

/* 隐藏加载指示器 */
.file-preview .loader-container.hidden {
    display: none;
}

/* 简单的 CSS Spinner 动画 */
.loader-spinner {
    border: 4px solid #f3f3f3; /* Light grey */
    border-top: 4px solid #007bff; /* Blue */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

/* 自定义动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}