/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90d9;
    --primary-hover: #357abd;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --bg-color: #f5f6f7;
    --sidebar-bg: #2c3e50;
    --sidebar-width: 250px;
    --header-height: 60px;
    --border-color: #e0e0e0;
    --text-color: #333;
    --text-muted: #666;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 认证页面样式 */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 10px;
}

.auth-header p {
    color: var(--text-muted);
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.auth-form input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-checkbox {
    display: flex;
    align-items: center;
}

.form-checkbox input {
    width: auto;
    margin-right: 8px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-block {
    width: 100%;
    padding: 12px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.alert {
    padding: 12px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* 应用主布局 */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
    gap: 10px;
}

.nav-item:hover,
.nav-item.active {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.storage-info {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.storage-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 8px;
}

.storage-bar {
    height: 6px;
    background-color: rgba(255,255,255,0.2);
    border-radius: 3px;
    overflow: hidden;
}

.storage-progress {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: width 0.3s;
}

.storage-percent {
    text-align: right;
    font-size: 12px;
    margin-top: 5px;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.username {
    font-size: 14px;
}

.logout-btn {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.logout-btn:hover {
    color: white;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
}

/* 视图切换 */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.toolbar-left {
    display: flex;
    gap: 10px;
}

.toolbar-right {
    display: flex;
    align-items: center;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.search-box input {
    border: none;
    padding: 8px 12px;
    width: 200px;
    outline: none;
}

.search-box button {
    background: none;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-muted);
}

/* 面包屑导航 */
.breadcrumb {
    margin-bottom: 20px;
    font-size: 14px;
}

.breadcrumb-item {
    color: var(--primary-color);
    cursor: pointer;
}

.breadcrumb-item:hover {
    text-decoration: underline;
}

/* 文件列表 */
.file-list-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.file-list {
    width: 100%;
    border-collapse: collapse;
}

.file-list th,
.file-list td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.file-list th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.file-list tr:hover {
    background-color: #f8f9fa;
}

.file-list tr:last-child td {
    border-bottom: none;
}

.col-name {
    width: 15%;
}

.col-size,
.col-progress {
    width: 7.5%;
}

.col-md5 {
    width: 20%;
}

.col-date,
.col-actions {
    width: 12.5%;
}

.file-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-name i {
    font-size: 20px;
    color: var(--primary-color);
}

.file-name .folder-icon {
    color: #f4d03f;
}

.file-name .local-directory {
    color: #3498db;
}

.file-list tr:has(.local-directory) {
    background-color: #f0f7ff;
}

.file-list tr:has(.local-directory):hover {
    background-color: #e8f4ff;
}

.file-actions {
    display: flex;
    gap: 5px;
}

.file-actions button {
    background: none;
    border: none;
    padding: 5px 8px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 3px;
    transition: all 0.3s;
}

.file-actions button:hover {
    background-color: var(--primary-color);
    color: white;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
}

/* 个人中心 */
.profile-container {
    max-width: 600px;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.profile-container h2 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.profile-form .form-group {
    margin-bottom: 20px;
}

.profile-form input[disabled] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* 分享页面 */
.share-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.share-container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
}

.share-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.share-header {
    text-align: center;
    margin-bottom: 30px;
}

.share-header h1 {
    color: var(--primary-color);
    font-size: 24px;
}

.share-icon {
    text-align: center;
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.share-box h2 {
    text-align: center;
    margin-bottom: 30px;
    word-break: break-all;
}

.share-info {
    margin-bottom: 30px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-item .label {
    color: var(--text-muted);
}

.password-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.password-form input {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 5px;
}

.error-msg {
    color: var(--danger-color);
    text-align: center;
    margin-top: 10px;
}

.share-result {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #333;
    color: white;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 2000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* 文件夹树 */
.folder-tree {
    max-height: 300px;
    overflow-y: auto;
}

.folder-tree-item {
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.folder-tree-item:hover {
    background-color: #f8f9fa;
}

.folder-tree-item.selected {
    background-color: var(--primary-color);
    color: white;
}

.folder-tree-item i {
    color: #f4d03f;
}

.folder-tree-item.selected i {
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-header h1 span,
    .nav-item span,
    .storage-info,
    .username {
        display: none;
    }

    .main-content {
        margin-left: 60px;
    }

    .toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
    }

    .file-list th,
    .file-list td {
        padding: 8px 10px;
        font-size: 13px;
    }

    .col-date,
    .col-size {
        display: none;
    }
}

/* 预览弹窗样式 */
.preview-modal-content {
    max-width: 80%;
    max-height: 90vh;
}

#preview-content {
    width: 100%;
    min-height: 400px;
}

.preview-image {
    text-align: center;
}

.preview-image img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
}

.preview-video video {
    width: 100%;
    max-height: 60vh;
}

.preview-audio audio {
    width: 100%;
}

.preview-pdf iframe {
    width: 100%;
    height: 60vh;
}

.preview-text {
    max-height: 60vh;
    overflow-y: auto;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 15px;
}

.preview-text pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
}

.preview-error {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* 文件名点击样式 */
.file-name span {
    cursor: pointer;
    transition: color 0.3s;
}

.file-name span:hover {
    color: var(--primary-color);
}

/* 离线下载样式 */
.offline-task-list {
    margin-top: 20px;
}

.col-url {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-progress {
    width: 150px;
    text-align: center;
    vertical-align: middle;
}

.progress-bar {
    width: 100%;
    max-width: 100px;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 5px auto;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-waiting {
    background-color: var(--warning-color);
    color: #212529;
}

.status-downloading {
    background-color: #17a2b8;
    color: white;
}

.status-completed {
    background-color: var(--success-color);
    color: white;
}

.status-failed {
    background-color: var(--danger-color);
    color: white;
}

/* 上传任务样式 */
.upload-task {
    background-color: #f8f9fa;
    border-left: 4px solid var(--primary-color);
}

.upload-progress-container {
    position: relative;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 0 10px;
    max-width: 130px;
    /* 添加兼容性样式 */
    box-sizing: border-box;
}

.upload-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 10px;
    /* 使用更兼容的过渡效果 */
    transition: width 0.3s;
    z-index: 1;
    /* 添加兼容性样式 */
    box-sizing: border-box;
}

.upload-progress-text {
    position: relative;
    z-index: 2;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-color);
    margin-right: 10px;
}

.upload-status {
    position: relative;
    z-index: 2;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: auto;
}

.upload-status.success {
    color: var(--success-color);
}

.upload-status.error {
    color: var(--danger-color);
}
