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

/* ========== Theme Variables ========== */
:root {
    --accent: #4f7cff;
    --accent-hover: #3a6aef;
    --accent-ring: rgba(79, 124, 255, .15);
    --sidebar-bg: #001529;
    --sidebar-border: #1f2d3d;
    --sidebar-hover: #1f2d3d;
    --sidebar-text: #b7c0cd;
}
/* 6 extra themes: sidebar + accent, content stays light */
body.theme-lanlan {
    --accent: #5865e0; --accent-hover: #4653c9; --accent-ring: rgba(88, 101, 224, .16);
    --sidebar-bg: linear-gradient(165deg, #4353c9 0%, #6a5ce0 100%);
    --sidebar-border: rgba(255,255,255,.12); --sidebar-hover: rgba(255,255,255,.10); --sidebar-text: #ccd2f5;
}
body.theme-darknight {
    --accent: #5273d0; --accent-hover: #4061b8; --accent-ring: rgba(82, 115, 208, .16);
    --sidebar-bg: linear-gradient(165deg, #16181f 0%, #23262f 100%);
    --sidebar-border: #2b2f3a; --sidebar-hover: #2b2f3a; --sidebar-text: #9aa3b5;
}
body.theme-forest {
    --accent: #22b24c; --accent-hover: #1a9440; --accent-ring: rgba(34, 178, 76, .15);
    --sidebar-bg: linear-gradient(165deg, #123322 0%, #1d4a30 100%);
    --sidebar-border: rgba(255,255,255,.10); --sidebar-hover: rgba(255,255,255,.08); --sidebar-text: #b5d6c0;
}
body.theme-sunset {
    --accent: #f08b1e; --accent-hover: #d9770f; --accent-ring: rgba(240, 139, 30, .16);
    --sidebar-bg: linear-gradient(165deg, #331d0d 0%, #4a2a12 100%);
    --sidebar-border: rgba(255,255,255,.10); --sidebar-hover: rgba(255,255,255,.08); --sidebar-text: #e3c9a8;
}
body.theme-ocean {
    --accent: #18c1c1; --accent-hover: #12a5a5; --accent-ring: rgba(24, 193, 193, .16);
    --sidebar-bg: linear-gradient(165deg, #0d2a31 0%, #123c46 100%);
    --sidebar-border: rgba(255,255,255,.10); --sidebar-hover: rgba(255,255,255,.08); --sidebar-text: #a8d3d8;
}
body.theme-rose {
    --accent: #e8465f; --accent-hover: #d33550; --accent-ring: rgba(232, 70, 95, .15);
    --sidebar-bg: linear-gradient(165deg, #2e0f18 0%, #451723 100%);
    --sidebar-border: rgba(255,255,255,.10); --sidebar-hover: rgba(255,255,255,.08); --sidebar-text: #e2b3bd;
}

body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f0f2f5; color: #333; }

/* ========== Login ========== */
.login-body { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 40px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.login-logo { text-align: center; margin-bottom: 32px; }
.logo-icon-big { font-size: 56px; }
.login-logo h1 { font-size: 28px; margin: 8px 0 4px; color: #333; }
.login-subtitle { color: #888; font-size: 14px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; margin-bottom: 8px; font-size: 14px; color: #555; }
.login-form input { width: 100%; padding: 12px 16px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; transition: border-color .2s; }
.login-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.login-msg { min-height: 20px; margin-bottom: 12px; font-size: 14px; text-align: center; }
.login-msg.error { color: #e74c3c; }
.login-tip { text-align: center; margin-top: 20px; font-size: 13px; color: #999; }

/* ========== Buttons ========== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 18px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; transition: all .2s; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #d9363e; }
.btn-success { background: #52c41a; color: #fff; }
.btn-success:hover { background: #389e0d; }
.btn-default { background: #fff; color: #555; border: 1px solid #d9d9d9; }
.btn-default:hover { border-color: var(--accent); color: var(--accent); }
.btn-warning { background: #faad14; color: #fff; }
.btn-warning:hover { background: #d48806; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ========== Layout ========== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar-bg); color: #fff; flex-shrink: 0; transition: width .25s; overflow: hidden; }
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .nav-item span:not(.nav-icon), .sidebar.collapsed .logo-text { display: none; }
.sidebar-logo { padding: 20px; font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--sidebar-border); }
.logo-icon { font-size: 26px; }
.sidebar-nav { padding: 12px 0; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: var(--sidebar-text); text-decoration: none; font-size: 14px; transition: all .2s; white-space: nowrap; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-icon { font-size: 18px; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 10; }
.sidebar-toggle { background: none; border: none; font-size: 20px; cursor: pointer; color: #555; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-info { font-size: 14px; color: #555; display: inline-flex; align-items: center; gap: 8px; }
.topbar-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1px solid #eee; background: #f5f6fa; }
.topbar-btn { padding: 6px 14px; border-radius: 6px; font-size: 13px; text-decoration: none; color: #555; background: #f5f5f5; cursor: pointer; border: none; }
.topbar-btn:hover { color: var(--accent); }
.topbar-btn.logout { background: #fff1f0; color: #ff4d4f; }
.topbar-btn.logout:hover { color: #ff4d4f; background: #ffe3e2; }
.content { flex: 1; padding: 24px; }

/* ========== Cards & Tables ========== */
.card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.data-table th { background: #fafafa; color: #555; font-weight: 600; }
.data-table tr:hover { background: #f9f9fb; }
.data-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ========== Stats ========== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.stat-card .stat-label { color: #888; font-size: 13px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; color: #333; }
.stat-card .stat-icon { float: right; font-size: 32px; opacity: .3; }
.stat-card.wide { grid-column: span 2; }
.stat-card .stat-value { white-space: nowrap; }
.stat-card.wide .stat-value { font-size: 22px; }

/* ========== Tags ========== */
.tag { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.tag-video { background: #fff1f0; color: #ff4d4f; }
.tag-audio { background: #f6ffed; color: #52c41a; }
.tag-image { background: #f9f0ff; color: #722ed1; }
.tag-doc { background: #e6f7ff; color: #1890ff; }
.tag-compressed { background: #fff7e6; color: #fa8c16; }
.tag-folder { background: #fffbe6; color: #d48806; }
.tag-file { background: #f5f5f5; color: #888; }

/* 文件名预览按钮 */
.file-name-link { cursor: pointer; color: inherit; }
.file-name-link:hover { color: #4a7dff; text-decoration: underline; }

/* 图片预览 */
.preview-image-wrap { text-align: center; }
.preview-image-wrap img { max-width: 100%; max-height: 60vh; border-radius: 8px; object-fit: contain; }
.tag-shared { background: #f9f0ff; color: #722ed1; }

/* ========== Forms (美化搜索框/下拉框) ========== */
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: #555; }
input[type="text"], input[type="number"], input[type="password"], input[type="datetime-local"], select, textarea {
    padding: 9px 12px; border: 1px solid #dcdfe6; border-radius: 8px; font-size: 14px; color: #333;
    background: #fff; transition: border-color .2s, box-shadow .2s; font-family: inherit;
}
input[type="text"]:hover, input[type="number"]:hover, input[type="password"]:hover, input[type="datetime-local"]:hover, select:hover, textarea:hover { border-color: #b8c2d6; }
input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="datetime-local"]:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
input:disabled, input[readonly] { background: #f7f8fa; color: #999; cursor: not-allowed; }
select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none; cursor: pointer; padding-right: 34px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M2.2 4.2a.7.7 0 0 1 1-.06L6 7l2.8-2.86a.7.7 0 1 1 1 .98l-3.3 3.36a.7.7 0 0 1-1 0L2.2 5.12a.7.7 0 0 1 0-.92z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
textarea { line-height: 1.6; }
.form-group input, .form-group select, .form-group textarea { width: 100%; }
.form-inline { display: flex; gap: 8px; align-items: center; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); cursor: pointer; }

/* ========== Pagination ========== */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 20px; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid #d9d9d9; border-radius: 6px; text-decoration: none; color: #555; font-size: 14px; cursor: pointer; transition: all .2s; }
.pagination .active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

/* ========== Modal ========== */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 90%; max-width: 520px; max-height: 85vh; overflow: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #999; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #f0f0f0; text-align: right; }

/* ========== Upload ========== */
.upload-drop { border: 2px dashed #d9d9d9; border-radius: 10px; padding: 40px; text-align: center; color: #888; cursor: pointer; transition: all .2s; }
.upload-drop:hover, .upload-drop.drag { border-color: var(--accent); background: var(--accent-ring); color: var(--accent); }
.upload-list { margin-top: 16px; }
.upload-item { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid #f0f0f0; border-radius: 6px; margin-bottom: 8px; }
.upload-item .fname { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .fsize { font-size: 12px; color: #999; width: 80px; text-align: right; }
.progress-bar { width: 180px; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.progress-bar .bar { height: 100%; background: var(--accent); transition: width .3s; }
.progress-bar .bar.error { background: #ff4d4f; }
.progress-bar .bar.done { background: #52c41a; }

/* ========== Preview modal ========== */
.preview-media video { width: 100%; max-height: 60vh; border-radius: 8px; background: #000; }
.preview-media audio { width: 100%; margin-top: 10px; }
.preview-text { max-height: 60vh; overflow: auto; background: #f8f9fb; border: 1px solid #eef0f4; border-radius: 8px; padding: 14px; font-family: Consolas, monospace; font-size: 13px; white-space: pre-wrap; word-break: break-all; color: #444; }
.file-link { color: var(--accent); cursor: pointer; }
.file-link:hover { text-decoration: underline; }

/* ========== Password copy chip ========== */
.pwd-chip { cursor: pointer; font-family: Consolas, monospace; background: #f5f6fa; padding: 2px 10px; border-radius: 6px; color: #555; border: 1px dashed #d0d5e0; font-size: 13px; transition: all .2s; }
.pwd-chip:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-ring); }

/* ========== Theme picker ========== */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.theme-card { position: relative; border: 2px solid transparent; border-radius: 10px; padding: 8px; cursor: pointer; text-align: center; background: #fff; transition: all .2s; }
.theme-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.10); }
.theme-card.selected { border-color: var(--accent); background: var(--accent-ring); }
.theme-preview { height: 64px; border-radius: 8px; display: flex; overflow: hidden; border: 1px solid #e8e8e8; }
.tp-sidebar { width: 34%; }
.tp-main { flex: 1; background: #fff; display: flex; flex-direction: column; justify-content: center; gap: 7px; padding: 0 12px; }
.tp-bar { height: 7px; border-radius: 4px; }
.theme-name { margin-top: 8px; font-size: 13px; color: #555; }
.theme-check { position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 11px; line-height: 18px; text-align: center; display: none; }
.theme-card.selected .theme-check { display: block; }
@media (max-width: 640px) { .theme-grid { grid-template-columns: repeat(2, 1fr); } }

/* ========== Rich text editor ========== */
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border: 1px solid #dcdfe6; border-bottom: none; border-radius: 8px 8px 0 0; background: #fafbfc; }
.editor-toolbar button { min-width: 32px; height: 30px; padding: 0 9px; border: none; background: transparent; border-radius: 6px; cursor: pointer; font-size: 14px; color: #555; transition: all .15s; }
.editor-toolbar button:hover { background: #eef1f6; color: var(--accent); }
.editor-toolbar .sep { width: 1px; height: 20px; background: #e0e4ea; margin: 5px 4px; }
.editor-area { min-height: 280px; max-height: 440px; overflow: auto; padding: 16px; border: 1px solid #dcdfe6; border-radius: 0 0 8px 8px; background: #fff; font-size: 14px; line-height: 1.75; outline: none; }
.editor-area:focus { border-color: var(--accent); }
.editor-area img { max-width: 100%; }
.editor-area:empty::before { content: attr(data-placeholder); color: #bbb; }
.editor-source { display: none; width: 100%; min-height: 280px; font-family: Consolas, monospace; font-size: 13px; padding: 12px; border: 1px solid #dcdfe6; border-radius: 0 0 8px 8px; color: #444; }

/* ========== Share pages ========== */
.share-page { max-width: 800px; margin: 40px auto; padding: 0 20px; }
.share-page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.share-page-head h2 { color: #333; display: flex; align-items: center; gap: 10px; }
.share-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid #eee; background: #f5f6fa; }
.share-footer { text-align: center; margin-top: 30px; color: #999; font-size: 13px; line-height: 2; }
.share-footer a { color: #999; margin: 0 4px; }
.share-footer a:hover { color: var(--accent); }

/* ========== Toast ========== */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 10px 20px; border-radius: 6px; color: #fff; z-index: 9999; font-size: 14px; animation: slideDown .3s; }
.toast.success { background: #52c41a; }
.toast.error { background: #ff4d4f; }
.toast.info { background: #1890ff; }
@keyframes slideDown { from { transform: translate(-50%, -20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

.checkbox { width: 16px; height: 16px; cursor: pointer; }
.text-muted { color: #999; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

@media (max-width: 768px) {
    .sidebar { position: fixed; left: -220px; height: 100%; z-index: 100; }
    .sidebar.show { left: 0; }
    .content { padding: 12px; }
}

/* ========== Share pages (mobile) ========== */
@media (max-width: 720px) {
    .share-page { margin: 16px auto !important; padding: 0 12px !important; }
    .share-page-head { align-items: flex-start; gap: 10px; margin-bottom: 14px; }
    .share-page-head h2 { flex: 1; min-width: 0; font-size: 17px; line-height: 1.45; gap: 8px; word-break: break-word; }
    .share-page .share-avatar { width: 34px; height: 34px; }
    .share-page-head .btn { flex-shrink: 0; }
    .share-breadcrumb { margin: 0 0 14px !important; font-size: 12.5px; line-height: 1.6; word-break: break-all; }
    .share-page .card { padding: 14px; }
    .share-list-head { flex-wrap: wrap; gap: 8px; }
    .share-page .data-table th, .share-page .data-table td { padding: 9px 8px; font-size: 12.5px; }
    .share-page .data-table .col-cat, .share-page .data-table .col-time { display: none; }
    .share-page .data-table .col-size { white-space: nowrap; }
    .share-page .data-table .file-name { word-break: break-all; }
    .share-page .data-table td .btn { padding: 4px 8px; font-size: 12px; }
    .share-page .upload-drop { padding: 20px 12px !important; }
    .share-file-card { flex-wrap: wrap; gap: 12px !important; }
    .share-file-card > a { width: 100%; justify-content: center; }
}
