/* 基础样式重置 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --hover-bg: #f1f5f9;
    --success-color: #22c55e;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部 */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    margin: 0 -16px;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-content {
    max-width: 1168px;
    margin: 0 auto;
    padding: 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stats-item {
    background: var(--bg-color);
    padding: 6px 12px;
    border-radius: 20px;
}

/* 主体 */
.main {
    flex: 1;
    padding: 24px 0;
}

/* 面包屑 */
.breadcrumb {
    background: var(--card-bg);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.breadcrumb-item {
    color: var(--primary-color);
    cursor: pointer;
    transition: color 0.2s;
}

.breadcrumb-item:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

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

.breadcrumb-item:last-child {
    color: var(--text-secondary);
    cursor: default;
    pointer-events: none;
}

.breadcrumb-item:last-child:hover {
    text-decoration: none;
}

/* 文件列表容器 */
.file-list-container {
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* 文件列表表格 */
.file-list {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.file-list th {
    text-align: left;
    padding: 14px 16px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    font-size: 0.875rem;
    white-space: nowrap;
}

.file-list td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

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

.file-list tbody tr:hover {
    background: var(--hover-bg);
}

/* 列宽 */
.col-name {
    width: auto;
}

.col-size {
    width: 100px;
}

.col-time {
    width: 160px;
}

.col-action {
    width: 140px;
    min-width: 140px;
    text-align: right;
    white-space: nowrap;
}

/* 文件项 */
.file-item {
    cursor: pointer;
}

.file-item.directory {
    cursor: pointer;
}

.file-icon {
    margin-right: 10px;
    font-size: 1.25rem;
}

.file-name {
    color: var(--text-primary);
    font-weight: 500;
}

.file-name-text {
    word-break: break-all;
}

.file-size {
    color: var(--text-secondary);
    font-size: 0.875rem;
    white-space: nowrap;
}

.file-time {
    color: var(--text-muted);
    font-size: 0.875rem;
    white-space: nowrap;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

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

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

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

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8125rem;
}

/* 加载状态 */
.loading-row td {
    text-align: center;
    padding: 48px;
}

.loading {
    color: var(--text-muted);
}

/* 空状态 */
.empty-row td {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

/* 错误状态 */
.error-row td {
    text-align: center;
    padding: 48px;
    color: #dc2626;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

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

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

.modal-body {
    padding: 20px;
    overflow: auto;
    flex: 1;
}

/* 预览内容 */
.preview-text {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 60vh;
    overflow-y: auto;
}

.preview-pdf {
    width: 100%;
    height: 70vh;
    border: none;
    border-radius: 8px;
}

.preview-unsupported {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
}

.preview-truncated {
    margin-top: 12px;
    padding: 12px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 6px;
    font-size: 0.875rem;
}

/* 公告区域 */
.announcement {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 20px 24px;
    margin-top: 24px;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
}

.announcement-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #bae6fd;
}

.announcement-icon {
    font-size: 1.25rem;
}

.announcement-title {
    font-weight: 600;
    font-size: 1rem;
    color: #0369a1;
}

.announcement-content {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.announcement-content h1,
.announcement-content h2,
.announcement-content h3 {
    color: #0369a1;
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
}

.announcement-content h1 {
    font-size: 1.25rem;
}

.announcement-content h2 {
    font-size: 1.125rem;
}

.announcement-content h3 {
    font-size: 1rem;
}

.announcement-content p {
    margin-bottom: 12px;
}

.announcement-content ul,
.announcement-content ol {
    margin-bottom: 12px;
    padding-left: 24px;
}

.announcement-content li {
    margin-bottom: 4px;
}

.announcement-content code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
    color: #dc2626;
}

.announcement-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 12px;
}

.announcement-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.announcement-content blockquote {
    border-left: 4px solid #0ea5e9;
    padding-left: 16px;
    margin-left: 0;
    color: var(--text-secondary);
    font-style: italic;
}

.announcement-content a {
    color: #0284c7;
    text-decoration: none;
}

.announcement-content a:hover {
    text-decoration: underline;
}

/* 页脚 */
.footer {
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

.footer p {
    margin-bottom: 8px;
}

.footer p:last-child {
    margin-bottom: 0;
}

.beian a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.beian a:hover {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .file-list {
        font-size: 0.875rem;
    }

    .file-list th,
    .file-list td {
        padding: 12px;
    }

    /* 隐藏修改时间列 */
    .col-time,
    .file-list td:nth-child(3) {
        display: none;
    }

    .col-size {
        width: 80px;
    }

    .col-action {
        width: auto;
        min-width: 110px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 0.8125rem;
        white-space: nowrap;
    }

    .action-buttons {
        flex-direction: row;
        gap: 6px;
    }

    .modal-content {
        max-height: 95vh;
        margin: 8px;
    }

    .preview-text {
        font-size: 0.8125rem;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    /* 进一步简化 */
    .logo {
        font-size: 1.125rem;
    }

    .stats {
        font-size: 0.8125rem;
    }

    .file-list th,
    .file-list td {
        padding: 8px;
    }

    .file-icon {
        margin-right: 8px;
        font-size: 1.125rem;
    }

    .col-action {
        min-width: 90px;
    }

    .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
}
