﻿*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: #4361ee; text-decoration: none; }
a:hover { text-decoration: underline; }
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    flex: 1;
}

/* Header */
header { text-align: center; margin-bottom: 24px; }
header h1 { font-size: 28px; color: #1a1a2e; }
header h1 a { color: inherit; }
.subtitle { color: #6c757d; margin-top: 4px; font-size: 14px; }

/* Upload Area */
.upload-area {
    background: #fff;
    border: 2px dashed #4361ee;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    margin-bottom: 24px;
    transition: background .15s;
}
.upload-area:hover { background: #f8f9ff; }
.upload-btn {
    display: inline-block;
    background: #4361ee;
    color: #fff;
    padding: 12px 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background .15s;
}
.upload-btn:hover { background: #3a56d4; text-decoration: none; }
#fileInput { display: none; }

/* Messages */
.msg {
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
}
.msg.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.msg.error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Link Box */
.link-box {
    width: 100%;
    max-width: 600px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    background: #f9f9f9;
    margin-top: 8px;
    cursor: pointer;
}
.link-mini {
    width: 170px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    background: #f9f9f9;
    cursor: pointer;
    vertical-align: middle;
}

/* File List */
.file-list {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.file-list h2 { font-size: 18px; margin-bottom: 12px; }
.empty { color: #999; text-align: center; padding: 40px 0; font-size: 15px; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 2px solid #eee;
    font-size: 13px;
    color: #666;
}
td { padding: 10px 8px; border-bottom: 1px solid #f0f0f0; }
tr:hover td { background: #fafbff; }
.fname { display: flex; align-items: center; gap: 6px; }
.fname .icon { font-size: 20px; }
.fsize, .ftime { white-space: nowrap; color: #666; font-size: 13px; }
.faction { white-space: nowrap; }

/* 统一操作按钮样式 */
.btn-dl, .btn-action {
    display: inline-block;
    padding: 6px 18px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    background: #4361ee;
    color: #fff;
    cursor: pointer;
    vertical-align: middle;
    line-height: 1.5;
    transition: background .15s;
    text-decoration: none;
}
.btn-dl:hover, .btn-action:hover { background: #3a56d4; text-decoration: none; }

/* File name link */
.url-link {
    color: #1a1a2e;
    font-size: 14px;
    word-break: break-all;
    text-decoration: none;
}
.url-link:hover {
    color: #4361ee;
    text-decoration: underline;
}

/* View Page */
.view-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.view-meta { text-align: center; margin-bottom: 20px; }
.icon-lg { font-size: 48px; display: block; margin-bottom: 8px; }
.view-meta h2 { font-size: 20px; }
.view-meta p { color: #666; font-size: 13px; margin-top: 4px; }
.view-links { margin-top: 12px; }
.view-links .link-box { max-width: 500px; }
.preview-img { max-width: 100%; border-radius: 8px; display: block; margin: 0 auto; }
.preview-video { max-width: 100%; border-radius: 8px; display: block; margin: 0 auto; }
.preview-text {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    max-height: 600px;
    overflow-y: auto;
}

/* Login */
.login-form { background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.login-form label { display: block; margin-bottom: 16px; font-size: 14px; }
.login-form input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-top: 4px;
    font-size: 14px;
}
.btn {
    display: inline-block;
    padding: 6px 18px;
    background: #4361ee;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    font-family: inherit;
    vertical-align: middle;
    transition: background .15s;
}
.btn:hover { background: #3a56d4; }
.btn.btn-secondary { background: #6c757d; }
.btn.btn-secondary:hover { background: #5a6268; }

/* Admin Editor */
.editor-area { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.editor-area h2 { font-size: 18px; margin-bottom: 12px; }
.editor {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}
.editor-actions { margin-top: 12px; display: flex; gap: 8px; }
.btn-sm {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    background: #e9ecef;
    color: #333;
    margin-right: 4px;
    font-size: 13px;
    text-decoration: none;
}
.btn-sm:hover { background: #dee2e6; text-decoration: none; }
.btn-danger { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #c82333; }

/* Footer */
footer {
    text-align: center;
    padding: 24px 0 12px;
    font-size: 13px;
    color: #999;
}
footer a { color: #999; }
footer a:hover { color: #4361ee; }

/* Upload Off Button (admin panel) */
.btn-upload-off {
    background: #dc3545 !important;
}
.btn-upload-off:hover {
    background: #c82333 !important;
}

/* Upload progress bar */
.progress-bar {
    position: relative;
    width: 100%;
    height: 24px;
    background: #e9ecef;
    border-radius: 12px;
    margin-top: 16px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4361ee, #3a56d4);
    border-radius: 12px;
    transition: width .3s ease;
    min-width: 0;
}
.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

/* Drag & drop */
.upload-area.drag-over {
    background: #eef0ff;
    border-color: #3a56d4;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}
.drop-hint {
    margin-top: 8px;
    font-size: 13px;
    color: #999;
}

/* Audio preview */
.preview-audio {
    text-align: center;
    padding: 32px 16px;
}
.preview-audio audio {
    border-radius: 8px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 16px 0 4px;
    font-size: 14px;
}
.page-link {
    display: inline-block;
    padding: 6px 16px;
    background: #4361ee;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background .15s;
}
.page-link:hover { background: #3a56d4; text-decoration: none; }
.page-info { color: #666; font-size: 13px; }

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    header h1 { font-size: 22px; }
    .subtitle { font-size: 12px; }

    /* Upload area */
    .upload-area { padding: 20px 16px; }
    .upload-btn { padding: 10px 24px; font-size: 14px; }

    /* Table: hide less important columns, compact buttons */
    .file-list { padding: 12px; }
    .file-list h2 { font-size: 16px; }

    table thead { display: none; }
    table, tbody, tr, td { display: block; width: 100%; }

    tr {
        padding: 12px 0;
        border-bottom: 1px solid #eee;
    }
    tr:last-child { border-bottom: none; }
    tr:hover td { background: transparent; }

    td {
        padding: 2px 0;
        border: none;
        font-size: 13px;
    }

    .fname {
        font-size: 14px;
        margin-bottom: 4px;
    }
    .fname a { word-break: break-all; }

    .fsize, .ftime {
        display: inline;
        font-size: 12px;
        margin-right: 10px;
    }

    .faction {
        white-space: normal;
        margin-top: 8px;
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }

    .btn-dl, .btn-action {
        padding: 5px 10px;
        font-size: 12px;
    }

    /* Pagination */
    .pagination { gap: 8px; font-size: 13px; }
    .page-link { padding: 5px 12px; font-size: 13px; }
}

@media (max-width: 400px) {
    .upload-area { padding: 16px 12px; }
    .upload-btn { padding: 8px 18px; font-size: 13px; width: 100%; text-align: center; }
    .btn-dl, .btn-action { padding: 5px 8px; font-size: 11px; }
    .drop-hint { font-size: 12px; }
}
