:root {
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.25);
  --text-main: #f5f7fa;
  --text-dim: rgba(255, 255, 255, 0.75);
  --accent: #6ee7f5;
  --accent-2: #93c5fd;
  --danger: #fca5a5;
  --ok: #86efac;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Microsoft YaHei', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
}

body {
  background-image: url('/background.jpg') !important;
  background-size: cover !important;
  background-position: center !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
}

.glass {
  background-color: var(--glass-bg) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; padding: 38px 32px; }
.login-logo { text-align: center; margin-bottom: 8px; }
.login-logo h1 {
  font-size: 30px; letter-spacing: 2px;
  background: linear-gradient(90deg, #a5f3fc, #fbcfe8, #a7f3d0);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.login-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 26px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--glass-border); background: rgba(255,255,255,0.12);
  color: #fff; font-size: 15px; outline: none; transition: border-color .2s;
}
.field input:focus { border-color: var(--accent); background: rgba(255,255,255,0.18); }
.field input::placeholder { color: rgba(255,255,255,0.45); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600; color: #0b1a2a;
  background: linear-gradient(90deg, #67e8f9, #a7f3d0);
  cursor: pointer; transition: opacity .2s, transform .1s;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: rgba(255,255,255,0.2); color: #fff; border: 1px solid var(--glass-border); }
.login-err { color: var(--danger); font-size: 13px; text-align: center; min-height: 18px; margin-top: 10px; }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; position: sticky; top: 0; z-index: 40;
}
.app-header .brand {
  font-size: 20px; font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(90deg, #a5f3fc, #fbcfe8, #a7f3d0);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.app-header .hdr-right { display: flex; align-items: center; gap: 10px; }
.hdr-user { color: var(--text-dim); font-size: 14px; }
.icon-btn {
  border: 1px solid var(--glass-border); background: rgba(255,255,255,0.14);
  color: #fff; border-radius: 10px; padding: 8px 14px; cursor: pointer;
  font-size: 14px; transition: background .2s; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1.2; font-family: inherit;
}
.icon-btn:hover { background: rgba(255,255,255,0.24); }
.icon-btn.primary { background: rgba(110,231,245,0.28); border-color: rgba(110,231,245,0.55); }
.icon-btn.primary:hover { background: rgba(110,231,245,0.4); }

.app-main {
  display: grid; grid-template-columns: 300px 1fr; gap: 16px;
  padding: 18px 22px; height: calc(100vh - 68px);
}
.panel { padding: 16px; overflow-y: auto; }

.panel-title {
  font-size: 15px; font-weight: 700; margin-bottom: 12px; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
}
.file-count { color: var(--text-dim); font-size: 12px; font-weight: 400; }
.dropzone {
  border: 2px dashed rgba(255,255,255,0.35); border-radius: 12px;
  padding: 24px 16px; text-align: center; color: var(--text-dim);
  font-size: 13px; cursor: pointer; transition: all .2s;
}
.dropzone:hover { background: rgba(255,255,255,0.08); border-color: var(--accent); }
.dropzone.dragover { border-color: var(--accent); background: rgba(110,231,245,0.12); }
.dropzone b { color: #fff; }
.dz-hint { margin-top: 6px; font-size: 11px; }
.upload-progress { margin-top: 12px; display: none; }
.upload-status { margin-top: 10px; font-size: 13px; color: var(--text-dim); word-break: break-all; }

.doc-list { margin-top: 16px; }
.doc-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-radius: 10px; background: rgba(255,255,255,0.08);
  margin-bottom: 8px; cursor: pointer; font-size: 13px; transition: background .2s;
}
.doc-item:hover { background: rgba(255,255,255,0.18); }
.doc-item.active { border: 1px solid var(--accent); }
.file-badge {
  flex: 0 0 auto; font-size: 10px; letter-spacing: .5px; font-weight: 700;
  padding: 3px 6px; border-radius: 6px; background: rgba(255,255,255,0.18);
  color: #fff; min-width: 38px; text-align: center;
}
.file-badge.badge-img { background: rgba(147,197,253,0.28); }
.file-badge.badge-txt { background: rgba(167,243,208,0.26); }
.doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.doc-meta { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.doc-time { color: var(--text-dim); font-size: 11px; }
.file-size { color: var(--text-dim); font-size: 11px; }
.doc-del {
  border: none; background: none; color: var(--text-dim);
  cursor: pointer; font-size: 12px; padding: 2px 5px; border-radius: 6px;
  transition: color .15s, background .15s; font-family: inherit;
}
.doc-del:hover { color: var(--danger); background: rgba(255,255,255,0.14); }
.doc-empty { color: var(--text-dim); font-size: 13px; text-align: center; margin-top: 18px; }

/* 查看区 */
.text-area { display: flex; flex-direction: column; overflow: hidden; }
.text-empty {
  height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; color: var(--text-dim); gap: 12px;
}
.text-empty .big { font-size: 18px; letter-spacing: 4px; }
.text-empty .hint { font-size: 12px; }

.viewer { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.viewer-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 2px 2px 14px; border-bottom: 1px solid rgba(255,255,255,0.25); margin-bottom: 14px;
}
.viewer-title {
  font-size: 16px; font-weight: 700; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.viewer-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.viewer-body { flex: 1; overflow: auto; min-height: 0; }

.img-wrap { height: 100%; display: flex; align-items: center; justify-content: center; padding: 8px; }
.img-wrap img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,0.35); }

.editor-wrap { height: 100%; display: flex; }
.editor {
  width: 100%; height: 100%; min-height: 60vh; resize: none; border: none; outline: none;
  background: rgba(0,0,0,0.22); color: #f5f7fa; border-radius: 10px; padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Courier New', monospace;
  font-size: 14px; line-height: 1.7; tab-size: 4;
}

/* Markdown 渲染 */
.md-body {
  max-width: 820px; margin: 0 auto; padding-bottom: 40px;
  font-size: 16px; line-height: 1.9; color: #f5f7fa;
}
.md-body h1, .md-body h2, .md-body h3,
.md-body h4, .md-body h5, .md-body h6 {
  color: #fff; font-weight: 700; line-height: 1.4;
  margin: 22px 0 12px; padding-bottom: 6px;
}
.md-body h1 { font-size: 26px; border-bottom: 1px solid rgba(255,255,255,0.25); }
.md-body h2 { font-size: 22px; border-bottom: 1px solid rgba(255,255,255,0.25); }
.md-body h3 { font-size: 19px; }
.md-body h4, .md-body h5, .md-body h6 { font-size: 16px; }
.md-body p { margin-bottom: 14px; }
.md-body ul, .md-body ol { margin: 10px 0 14px; padding-left: 26px; }
.md-body li { margin-bottom: 6px; }
.md-body a { color: var(--accent); text-decoration: underline; }
.md-body strong { color: #fff; }
.md-body code {
  background: rgba(0,0,0,0.32); padding: 1px 6px; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 90%;
}
.md-body pre {
  background: rgba(0,0,0,0.35); padding: 12px 14px; border-radius: 10px;
  overflow: auto; margin: 12px 0;
}
.md-body pre code { background: none; padding: 0; }
.md-body blockquote {
  border-left: 3px solid rgba(255,255,255,0.35); padding-left: 12px;
  color: var(--text-dim); margin: 12px 0;
}
.md-body table { border-collapse: collapse; margin: 12px 0; width: 100%; }
.md-body th, .md-body td { border: 1px solid rgba(255,255,255,0.25); padding: 6px 10px; }
.md-body th { background: rgba(255,255,255,0.12); color: #fff; }
.md-body hr { border: none; border-top: 1px solid rgba(255,255,255,0.25); margin: 20px 0; }
.md-body img { max-width: 100%; border-radius: 8px; }

::selection { background: rgba(110,231,245,0.35); }

@media (max-width: 900px) {
  .app-main { grid-template-columns: 1fr; height: auto; }
  .text-area { height: 70vh; }
}
