/* ═══════════════════════════════════════
   Download — 文件分享站点
   深色顶栏 + 清爽白底 (GitHub 风格)
   ═══════════════════════════════════════ */

:root {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --border: #d0d7de;
    --border-light: #e8eaed;
    --text: #1a1a2e;
    --text-secondary: #57606a;
    --text-muted: #8b949e;
    --accent: #0969da;
    --accent-hover: #0550ae;
    --header-bg: #1a1a2e;
    --header-text: #e8eaed;
    --dir-color: #0891b2;
    --doc-color: #0969da;
    --archive-color: #9a6700;
    --image-color: #1a7f37;
    --video-color: #7c3aed;
    --audio-color: #bf3989;
    --code-color: #57606a;
    --exe-color: #cf222e;
    --other-color: #57606a;
    --radius: 8px;
    --shadow: 0 1px 0 rgba(27,31,36,.04);
    --shadow-md: 0 3px 6px rgba(140,149,159,.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ═══ Login Page ═══════════════════ */

body.login-page {
    background: var(--header-bg);
    align-items: center;
    justify-content: center;
}

.login-wrap {
    width: 100%;
    max-width: 380px;
    padding: 1.5rem;
}

.login-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

.login-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.login-card h1 {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.login-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.login-error {
    font-size: 0.8125rem;
    color: var(--exe-color);
    background: #fff1f0;
    border: 1px solid #ffc0b8;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.login-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    outline: none;
    margin-bottom: 1rem;
    transition: border-color .15s, box-shadow .15s;
}

.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(9,105,218,.15);
}

.login-btn {
    width: 100%;
    padding: 0.625rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}

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

/* ═══ Header ══════════════════════ */

.header {
    background: var(--header-bg);
    border-bottom: 1px solid rgba(255,255,255,.08);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.25rem;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--header-text);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

.site-title svg {
    color: #58a6ff;
    flex-shrink: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    justify-content: flex-end;
}

/* ═══ Search ══════════════════════ */

.search-wrap {
    position: relative;
    max-width: 300px;
    flex: 1;
}

.search-wrap input {
    width: 100%;
    padding: 0.375rem 0.625rem 0.375rem 2rem;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    font-size: 0.8125rem;
    background: rgba(255,255,255,.08);
    color: var(--header-text);
    outline: none;
    transition: all .15s;
}

.search-wrap input::placeholder { color: rgba(255,255,255,.45); }

.search-wrap input:focus {
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.25);
}

.search-icon {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,.45);
    pointer-events: none;
    font-size: 0.75rem;
}

.clear-search {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,.45);
    font-size: 1rem;
    padding: 0.25rem;
    display: none;
    line-height: 1;
}

.clear-search.visible { display: block; }
.clear-search:hover { color: var(--header-text); }

/* ═══ User badge ══════════════════ */

.user-badge {
    font-size: 0.75rem;
    color: rgba(255,255,255,.6);
    white-space: nowrap;
}

.logout-link {
    font-size: 0.75rem;
    color: rgba(255,255,255,.5);
    text-decoration: none;
    transition: color .15s;
    white-space: nowrap;
}

.logout-link:hover { color: var(--header-text); }

/* ═══ Main ═══════════════════════ */

.main {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    flex: 1;
    width: 100%;
}

/* ═══ Breadcrumb ═════════════════ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.bread-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.bread-link:hover { text-decoration: underline; }

.bread-current {
    color: var(--text);
    font-weight: 500;
}

.breadcrumb .sep {
    color: var(--text-muted);
    user-select: none;
}

/* ═══ Stats ══════════════════════ */

.stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.stats-bar strong { color: var(--text); }

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
}

.back-link:hover { color: var(--accent); }

/* ═══ File card / Table ══════════ */

.file-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.file-table th:nth-child(1) { width: auto; }
.file-table th:nth-child(2) { width: 80px; }
.file-table th:nth-child(3) { width: 130px; }
.file-table th:nth-child(4) { width: 160px; }

.file-table thead {
    background: #f6f8fa;
    border-bottom: 1px solid var(--border);
}

.file-table th {
    padding: 0.5rem 1rem;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color .1s;
}

.file-table th:hover { color: var(--text); }

.file-table th .sort-arrow {
    font-size: 0.625rem;
    opacity: 0;
    transition: opacity .1s;
}

.file-table th.sorted .sort-arrow { opacity: 1; }

.file-table td {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.875rem;
    vertical-align: middle;
}

.file-table tbody tr { transition: background .1s; }
.file-table tbody tr:hover { background: #f6f8fa; }

/* ═══ File cell ══════════════════ */

.file-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    max-width: 100%;
}

.file-icon {
    font-size: 1.375rem;
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
}

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

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

.file-name a:hover {
    color: var(--accent);
    text-decoration: underline;
}

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

/* Type dot */
.type-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dir-dot  { background: var(--dir-color); }
.doc-dot  { background: var(--doc-color); }
.archive-dot { background: var(--archive-color); }
.image-dot { background: var(--image-color); }
.video-dot { background: var(--video-color); }
.audio-dot { background: var(--audio-color); }
.code-dot { background: var(--code-color); }
.exe-dot  { background: var(--exe-color); }
.other-dot { background: var(--other-color); }

/* ═══ Buttons ════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    background: #f6f8fa;
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.btn:hover {
    background: #eaeef2;
    border-color: var(--text-muted);
}

.btn-sm { font-size: 0.75rem; padding: 0.25rem 0.625rem; }

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.8125rem;
    transition: all .15s;
    flex-shrink: 0;
}

.share-btn:hover {
    border-color: var(--border);
    color: var(--dir-color);
    background: #f0fdff;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: all .15s;
    flex-shrink: 0;
}

.copy-btn:hover {
    border-color: var(--border);
    color: var(--accent);
}

.copy-btn.copied {
    background: #1a7f37;
    border-color: #1a7f37;
    color: #fff;
}

/* ═══ Empty state ════════════════ */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.9375rem; }

/* ═══ Footer ═════════════════════ */

.footer {
    text-align: center;
    padding: 1.25rem;
    color: var(--text-muted);
    font-size: 0.6875rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ═══ Actions ════════════════════ */

.actions-cell {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

/* ═══ Share Modal ════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-box {
    background: var(--surface);
    border-radius: 12px;
    padding: 2rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 16px 48px rgba(0,0,0,.2);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.375rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0.25rem;
}

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

.modal-box h3 {
    font-size: 1.0625rem;
    margin-bottom: 0.125rem;
}

#modal-dir-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    word-break: break-all;
    font-family: monospace;
}

.form-group { margin-bottom: 0.75rem; }

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(9,105,218,.15);
}

.password-row { display: flex; gap: 0.375rem; }
.password-row .form-input { flex: 1; }

.regen-btn {
    width: 2.25rem;
    height: 2.25rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all .15s;
}

.regen-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.share-result-box {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 6px;
    padding: 0.875rem;
    margin-bottom: 0.875rem;
    font-size: 0.8125rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ═══ Share Password Page ════════ */

.share-password-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 2rem;
}

.pass-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-md);
}

.pass-card h2 { font-size: 1.125rem; margin-bottom: 1.5rem; }
.pass-card a { color: var(--accent); text-decoration: none; }

.pass-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 1rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.pass-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(9,105,218,.15);
}

.pass-btn {
    width: 100%;
    padding: 0.625rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}

.pass-btn:hover { background: var(--accent-hover); }
.pass-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pass-btn.copied { background: #1a7f37; }

/* ═══ Responsive ═════════════════ */

@media (max-width: 640px) {
    .header-inner { padding: 0 0.75rem; }
    .header-right { gap: 0.5rem; }
    .search-wrap { max-width: 160px; }
    .user-badge { display: none; }

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

    .file-table th,
    .file-table td { padding: 0.5rem 0.625rem; }

    .main { padding: 1rem 0.75rem 2rem; }
}
