/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1a1d23;
    --sidebar-text: #a0a6b1;
    --sidebar-active: #4f8cff;
    --primary: #4f8cff;
    --primary-hover: #3a7af0;
    --success: #28c76f;
    --danger: #ea5455;
    --danger-hover: #d43d3e;
    --warning: #ff9f43;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #2d3748;
    --text-secondary: #718096;
    --text-muted: #a0aec0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 4px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* ========== 登录页 ========== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-size: 48px;
    margin-bottom: 8px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.login-header p {
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: var(--card-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.15);
}

.text-muted {
    color: var(--text-muted);
    font-weight: normal;
    font-size: 12px;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #22b863;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e8ecf1;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    font-size: 28px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.nav-item.active {
    background: rgba(79, 140, 255, 0.1);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 14px;
}

.sidebar-footer {
    padding: 12px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-bottom-nav {
    padding: 8px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.nav-item-upgrade {
    color: #d7e6ff;
}

.nav-item-upgrade .nav-icon {
    color: var(--sidebar-active);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 14px;
}

.user-avatar {
    font-size: 20px;
}

.user-name {
    color: #fff;
    font-weight: 500;
}

.nav-item.logout {
    color: var(--danger);
}

.nav-item.logout:hover {
    background: rgba(234, 84, 85, 0.1);
}

/* ========== 主内容 ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========== 顶部栏 ========== */
.topbar {
    background: var(--card-bg);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    color: var(--text);
}

.breadcrumb {
    flex: 1;
    font-size: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
}

.breadcrumb-link {
    color: var(--text-secondary);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.breadcrumb-link:hover {
    background: var(--bg);
    color: var(--primary);
}

.breadcrumb-sep {
    color: var(--text-muted);
    margin: 0 2px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.item-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* ========== 工具栏 ========== */
.toolbar {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========== 文件列表 ========== */
.file-container {
    flex: 1;
    padding: 16px 24px;
    overflow-x: auto;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.file-table thead th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.file-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}

.file-table tbody tr:last-child td {
    border-bottom: none;
}

.file-table tbody tr:hover {
    background: #f8fafc;
}

.col-check {
    width: 40px;
    text-align: center;
}

.col-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.col-icon {
    width: 36px;
    text-align: center;
    font-size: 20px;
}

.col-name {
    min-width: 200px;
}

.col-size {
    width: 100px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: "SF Mono", Monaco, Consolas, monospace;
}

.col-time {
    width: 170px;
    color: var(--text-secondary);
    font-size: 13px;
}

.col-actions {
    width: 120px;
    text-align: center;
    white-space: nowrap;
}

.file-link {
    color: var(--text);
    font-weight: 450;
}

.file-link:hover {
    color: var(--primary);
}

.dir-link {
    font-weight: 500;
}

.btn-action {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-action:hover {
    background: var(--bg);
    transform: scale(1.15);
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 16px;
}

/* ========== 拖拽上传 ========== */
.drop-zone {
    display: none;
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: rgba(79, 140, 255, 0.1);
    z-index: 200;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.drop-zone.active {
    display: flex;
}

.drop-zone-content {
    background: var(--card-bg);
    padding: 60px 80px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 3px dashed var(--primary);
}

.drop-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
}

.drop-zone-content p {
    font-size: 18px;
    color: var(--text-secondary);
}

/* ========== 模态框 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease-out;
}

.modal-sm {
    max-width: 400px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ========== 上传区域 ========== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(79, 140, 255, 0.03);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(79, 140, 255, 0.08);
}

.upload-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.upload-list {
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
}

.upload-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.upload-item:last-child {
    border-bottom: none;
}

.upload-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 12px;
}

.upload-item-size {
    color: var(--text-muted);
    font-family: "SF Mono", Monaco, Consolas, monospace;
    white-space: nowrap;
}

.upload-item-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--danger);
    font-size: 16px;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.upload-item-remove:hover {
    background: rgba(234, 84, 85, 0.1);
}

/* ========== 进度条 ========== */
.upload-progress {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
    width: 0;
}

.progress-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    min-width: 40px;
    text-align: right;
}

/* ========== 提示框 ========== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(234, 84, 85, 0.1);
    color: var(--danger);
    border: 1px solid rgba(234, 84, 85, 0.2);
}

.alert-success {
    background: rgba(40, 199, 111, 0.1);
    color: var(--success);
    border: 1px solid rgba(40, 199, 111, 0.2);
}

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--card-bg);
    padding: 14px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: toastIn 0.3s ease-out;
    min-width: 280px;
    max-width: 420px;
    border-left: 4px solid var(--primary);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    font-size: 18px;
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 18px;
    padding: 2px;
}

/* ========== 用户管理表格 ========== */
.content-area {
    padding: 24px;
    flex: 1;
}

.user-table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.user-table th,
.user-table td {
    padding: 14px 16px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .topbar {
        padding: 12px 16px;
    }

    .toolbar {
        padding: 10px 16px;
        flex-wrap: wrap;
    }

    .file-container {
        padding: 12px 16px;
    }

    .col-time,
    .col-size {
        display: none;
    }

    .file-table thead th:nth-child(4),
    .file-table thead th:nth-child(5),
    .file-table tbody td:nth-child(4),
    .file-table tbody td:nth-child(5) {
        display: none;
    }

    .modal-content {
        width: 95%;
        margin: 16px;
    }

    .content-area {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }

    .toolbar {
        flex-direction: column;
    }

    .col-actions {
        display: none;
    }

    .file-table thead th:nth-child(6),
    .file-table tbody td:nth-child(6) {
        display: none;
    }
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #c1c7d0;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a6b1;
}

/* ========== 选中行高亮 ========== */
.file-row.selected {
    background: rgba(79, 140, 255, 0.06) !important;
}

/* ========== 底部状态栏 ========== */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    position: sticky;
    bottom: 0;
    z-index: 40;
    gap: 16px;
}

.status-path {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.status-size {
    white-space: nowrap;
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-weight: 500;
    color: var(--primary);
}

/* ========== 侧边栏快捷方式 ========== */
.sidebar-shortcuts {
    padding: 8px 0;
    border-top: 1px solid rgba(255,255,255,0.04);
}

.shortcut-item {
    font-size: 13px;
}

.shortcut-item .nav-icon {
    font-size: 14px;
}

.shortcut-item:hover {
    background: rgba(79, 140, 255, 0.08);
}

/* ========== 打印隐藏 ========== */
@media print {
    .sidebar, .toolbar, .topbar { display: none; }
    .main-content { margin-left: 0; }
}
