/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #eee;
    --main-bg: #f5f7fa;
    --card-bg: #fff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--main-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ===== 布局容器 ===== */
.container {
    display: flex;
    min-height: 100vh;
}

/* ===== 左侧边栏 ===== */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #16213e 100%);
    color: var(--sidebar-text);
    padding: 2rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-header {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

.sidebar-header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 300;
}

/* 返回按钮 */
.nav-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    margin: 0 1rem 1rem 1rem;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    justify-content: center;
}

.nav-back:hover {
    transform: translateX(-5px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.nav-back .icon {
    font-size: 1.3rem;
}

/* 上传区域 */
.upload-section {
    padding: 0 1.5rem;
    margin-bottom: 2rem;
}

.upload-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1rem;
}

.upload-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    justify-content: center;
}

.upload-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
}

.upload-trigger .icon {
    font-size: 1.3rem;
}

/* 统计信息 */
.stats-section {
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ===== 右侧内容区 ===== */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem 3rem;
    max-width: 1200px;
}

.content-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.content-section:hover {
    box-shadow: var(--shadow-hover);
}

.content-section h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* ===== 工具栏 ===== */
.toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s;
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.sort-box select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.sort-box select:focus {
    border-color: var(--primary-color);
}

/* ===== 文件列表 ===== */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #f7fafc;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s;
    cursor: pointer;
}

.file-item:hover {
    background: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
    transform: translateX(5px);
}

.file-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.file-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.file-size {
    color: var(--primary-color);
    font-weight: 600;
}

.file-date {
    color: var(--text-secondary);
}

.file-download {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s;
}

.file-item:hover .file-download {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ===== 加载状态 ===== */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* ===== 说明框 ===== */
.info-boxes {
    display: grid;
    gap: 1rem;
}

.info-box {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid;
}

.info-box.download {
    background: #f0fdf4;
    border-left-color: #22c55e;
}

.info-box.upload {
    background: #eff6ff;
    border-left-color: #3b82f6;
}

.info-box.security {
    background: #fef3c7;
    border-left-color: #eab308;
}

.box-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.box-content h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.box-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ===== 模态框 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: block;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    margin: 50px auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f7fafc;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.close-btn:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

/* ===== 密码验证 ===== */
.password-section {
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    text-align: left;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    margin-bottom: 1rem;
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.verify-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.verify-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.error-msg {
    color: #e53e3e;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* ===== 文件拖放区域 ===== */
.file-drop-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-drop-area:hover,
.file-drop-area.dragover {
    border-color: var(--primary-color);
    background: #f7fafc;
}

.file-drop-area input[type="file"] {
    display: none;
}

.drop-content {
    pointer-events: none;
}

.drop-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.drop-content p {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.drop-content small {
    color: var(--text-secondary);
}

/* ===== 已选文件列表 ===== */
.selected-files {
    margin-top: 1.5rem;
}

.selected-file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.selected-file-icon {
    font-size: 1.5rem;
}

.selected-file-info {
    flex: 1;
    min-width: 0;
}

.selected-file-name {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-file-size {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.selected-file-remove {
    padding: 0.25rem 0.5rem;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.selected-file-remove:hover {
    background: #fecaca;
}

/* ===== 上传进度 ===== */
.upload-progress {
    margin-top: 1.5rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    transition: width 0.3s;
}

/* ===== 上传操作按钮 ===== */
.upload-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.upload-btn,
.reset-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.upload-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.reset-btn {
    background: #e2e8f0;
    color: var(--text-primary);
}

.reset-btn:hover {
    background: #cbd5e0;
}

/* ===== Toast 提示 ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 2000;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid #22c55e;
}

.toast.error {
    border-left: 4px solid #e53e3e;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
    .main-content {
        padding: 1.5rem 2rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .content-section {
        padding: 1.5rem;
    }

    .toolbar {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }

    .file-item {
        flex-wrap: wrap;
    }

    .file-download {
        width: 100%;
        text-align: center;
    }
}
