/* ===== 直链网盘样式表 ===== */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #e0e7ff;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --sidebar-w: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans CJK SC', 'WenQuanYi Micro Hei', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 18px; border: none; border-radius: 8px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all 0.2s; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: 0.9; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-link, .btn-danger-link {
    color: var(--primary); cursor: pointer; font-size: 13px; margin-right: 8px;
    background: none; border: none; padding: 0; font-weight: 500;
}
.btn-link:hover { text-decoration: underline; }
.btn-danger-link { color: var(--danger); }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
    font-size: 14px; font-weight: 500;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

/* ===== Login Page ===== */
.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
    background: #fff; border-radius: 16px; padding: 40px;
    width: 100%; max-width: 400px; box-shadow: var(--shadow-lg);
    text-align: center;
}
.login-logo { font-size: 56px; margin-bottom: 12px; }
.login-title { font-size: 26px; font-weight: 700; color: var(--text); }
.login-subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }
.login-form { text-align: left; }
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.login-form input {
    width: 100%; padding: 11px 14px; border: 2px solid var(--border);
    border-radius: 8px; font-size: 15px; transition: border-color 0.2s;
}
.login-form input:focus { outline: none; border-color: var(--primary); }
.login-back { display: inline-block; margin-top: 20px; font-size: 14px; color: var(--text-muted); }

/* ===== Form ===== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.form-group .hint { font-weight: 400; color: var(--text-muted); font-size: 13px; }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
    width: 100%; padding: 10px 14px; border: 2px solid var(--border);
    border-radius: 8px; font-size: 14px; transition: border-color 0.2s;
    font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none; border-color: var(--primary);
}
.form-group textarea { resize: vertical; }
.form-check label { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }

/* ===== Admin Layout ===== */
.admin-body { background: var(--bg); }
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); background: #1e293b; color: #cbd5e1;
    position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto;
    display: flex; flex-direction: column; z-index: 100;
}
.sidebar-brand {
    padding: 22px 20px; font-size: 18px; font-weight: 700; color: #fff;
    display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid #334155;
}
.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; margin-bottom: 4px; border-radius: 8px;
    color: #cbd5e1; font-size: 14px; font-weight: 500; transition: all 0.2s;
}
.nav-item:hover { background: #334155; color: #fff; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item span:first-child { font-size: 18px; }
.nav-logout { margin-top: auto; color: #f87171; }
.nav-logout:hover { background: #7f1d1d; color: #fff; }

.admin-main {
    margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column;
    min-height: 100vh;
}
.admin-topbar {
    background: #fff; padding: 16px 28px; display: flex;
    justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
.page-title { font-size: 20px; font-weight: 700; }
.admin-user { font-size: 14px; color: var(--text-muted); }
.admin-content { padding: 28px; flex: 1; }

/* ===== Stat Cards ===== */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 20px;
    display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
}
.stat-icon { font-size: 36px; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* ===== Panel ===== */
.panel {
    background: var(--bg-card); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden;
}
.panel-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.panel-header h2 { font-size: 16px; font-weight: 600; }
.panel > *:not(.panel-header) { padding: 20px; }
.panel-danger { border: 2px solid #fecaca; }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; padding: 0 !important; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
    text-align: left; padding: 12px 16px; background: #f8fafc;
    font-weight: 600; color: var(--text-muted); font-size: 13px;
    border-bottom: 2px solid var(--border); white-space: nowrap;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.data-table tr:hover td { background: #f8fafc; }
.data-table tr:last-child td { border-bottom: none; }
.empty-row { text-align: center; color: var(--text-muted); padding: 40px 16px !important; }
.file-name-cell { max-width: 320px; }
.file-name-cell span { margin-right: 6px; }
.file-icon-sm { font-size: 16px; }
.action-cell { white-space: nowrap; }

/* ===== Badges ===== */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-image { background: #dbeafe; color: #1d4ed8; }
.badge-video { background: #fce7f3; color: #be185d; }
.badge-audio { background: #fef3c7; color: #b45309; }
.badge-document { background: #d1fae5; color: #047857; }
.badge-code { background: #e0e7ff; color: #4338ca; }
.badge-other { background: #f1f5f9; color: #475569; }
.badge-public { background: #d1fae5; color: #047857; }
.badge-private { background: #fee2e2; color: #b91c1c; }

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-input, .filter-select {
    padding: 8px 12px; border: 2px solid var(--border); border-radius: 8px; font-size: 14px;
}
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--primary); }
.filter-count { font-size: 14px; color: var(--text-muted); }

/* ===== Pagination ===== */
.pagination {
    display: flex; justify-content: center; align-items: center; gap: 12px;
    padding: 20px;
}
.page-btn {
    padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; color: var(--text); font-size: 14px; cursor: pointer;
    transition: all 0.2s;
}
.page-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
.page-info { font-size: 14px; color: var(--text-muted); }

/* ===== Upload Dropzone ===== */
.dropzone {
    border: 3px dashed var(--border); border-radius: 12px;
    padding: 40px 20px; text-align: center; cursor: pointer;
    transition: all 0.2s; position: relative;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--primary-light); }
.dropzone-inner { pointer-events: none; }
.dropzone-icon { font-size: 48px; margin-bottom: 12px; }
.dropzone-inner p { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.dropzone-hint { font-size: 13px; color: var(--text-muted) !important; }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.file-list-display { margin-top: 12px; }
.selected-files { list-style: none; }
.selected-files li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; background: #f8fafc; border-radius: 6px; margin-bottom: 6px;
    font-size: 14px;
}
.file-size-tag { color: var(--text-muted); font-size: 13px; }

/* ===== Upload Result ===== */
.upload-result-item {
    padding: 14px; border: 1px solid var(--border); border-radius: 8px;
    margin-bottom: 12px; background: #f8fafc;
}
.ur-name { font-weight: 600; margin-bottom: 8px; }
.ur-links { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ur-links label { font-size: 13px; color: var(--text-muted); min-width: 70px; font-weight: 600; }
.copy-input {
    flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; font-family: monospace; background: #fff;
}
.btn-copy { white-space: nowrap; }

/* ===== Edit Form ===== */
.file-detail-header {
    display: flex; align-items: center; gap: 16px; padding: 20px;
    border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.file-icon-lg { font-size: 40px; }
.file-detail-name { font-size: 18px; font-weight: 600; word-break: break-all; }
.file-detail-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input {
    flex: 1; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: 6px; font-family: monospace; font-size: 13px;
}
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.danger-text { color: var(--danger); font-weight: 500; margin: 12px 0; }
.delete-confirm { padding: 20px; }
.delete-file-info {
    display: flex; align-items: center; gap: 12px; padding: 16px;
    background: #fef2f2; border-radius: 8px; margin: 16px 0;
}

/* ===== Info Table ===== */
.info-table { width: 100%; font-size: 14px; }
.info-table td { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.info-table td:first-child { font-weight: 600; color: var(--text-muted); width: 200px; }

/* ===== Public Pages ===== */
.public-body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }

.public-header {
    background: #fff; box-shadow: var(--shadow); padding: 14px 0;
    position: sticky; top: 0; z-index: 50;
}
.public-header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 20px; font-weight: 700; color: var(--text); }
.logo:hover { text-decoration: none; color: var(--primary); }
.header-link { font-size: 14px; font-weight: 500; }
.header-right { display: flex; gap: 12px; align-items: center; }

.public-main { flex: 1; padding: 32px 20px; }

.hero-section, .public-section-header { text-align: center; margin-bottom: 32px; }
.hero-section h1, .public-section-header h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.hero-section p, .section-desc { color: var(--text-muted); font-size: 16px; }
.hero-hint { margin-top: 12px; font-size: 14px; }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state p { color: var(--text-muted); font-size: 16px; margin-bottom: 20px; }

/* ===== File Grid ===== */
.file-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.file-card {
    background: #fff; border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); transition: all 0.2s;
    display: block; color: var(--text);
    border: 2px solid transparent;
}
.file-card:hover {
    text-decoration: none; color: var(--text);
    transform: translateY(-4px); box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.file-card-icon { font-size: 40px; margin-bottom: 12px; }
.file-card-name {
    font-size: 14px; font-weight: 600; margin-bottom: 8px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-card-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-muted); }
.file-card-time { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ===== View Page ===== */
.view-main { max-width: 900px; }
.view-header { margin-bottom: 24px; }
.view-file-info { display: flex; align-items: flex-start; gap: 16px; }
.view-file-name { font-size: 22px; font-weight: 700; word-break: break-all; }
.view-file-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.view-description { margin-top: 16px; padding: 12px 16px; background: #f8fafc; border-radius: 8px; font-size: 14px; color: var(--text-muted); }

.preview-section { margin-bottom: 24px; }
.preview-box {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden; text-align: center;
}
.preview-image-box { padding: 20px; }
.preview-image-box img { max-width: 100%; height: auto; border-radius: 8px; }
.preview-video-box video { width: 100%; max-height: 70vh; display: block; }
.preview-audio-box { padding: 40px 20px; }
.audio-cover { font-size: 64px; margin-bottom: 20px; }
.preview-audio-box audio { width: 100%; max-width: 500px; }
.preview-pdf-box iframe { width: 100%; height: 70vh; border: none; }
.preview-text-box { text-align: left; }
.code-block {
    padding: 20px; margin: 0; overflow: auto; max-height: 70vh;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px; line-height: 1.6; background: #1e293b; color: #e2e8f0;
    white-space: pre-wrap; word-break: break-word;
}
.preview-other-box { padding: 60px 20px; }
.other-preview-icon { font-size: 64px; margin-bottom: 16px; }
.preview-other-box h2 { margin-bottom: 8px; }
.preview-other-box p { color: var(--text-muted); margin-bottom: 8px; }

.view-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }
.view-link-section { margin-bottom: 24px; }
.view-link-section label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.link-input {
    flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-family: monospace; font-size: 13px; background: #f8fafc;
}

.public-footer {
    background: #1e293b; color: #94a3b8; text-align: center; padding: 20px; font-size: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar {
        position: fixed; width: 240px; transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .filter-form { width: 100%; }
    .view-file-info { flex-direction: column; }
}
