/* ==========================================================
   原生前台样式 - 零依赖
   ========================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #0ea5e9;
  --primary-dark: #0369a1;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --error: #dc2626;
  --success: #16a34a;
  --warning: #f59e0b;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 8px; }
.logo { font-size: 22px; }
.title { font-weight: 600; font-size: 16px; }

#main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
}

.card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  padding: 32px;
  width: 100%;
  max-width: 640px;
}

h1 { font-size: 22px; margin-bottom: 8px; }
h2 { font-size: 18px; margin-bottom: 12px; }
.hint { color: var(--muted); margin-bottom: 24px; font-size: 14px; }

form { display: flex; flex-direction: column; gap: 16px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }

input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: #fafbfc;
  transition: border-color 0.15s, background 0.15s;
}
input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

button {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
button:hover { background: var(--primary-dark); }
button:disabled { background: #94a3b8; cursor: not-allowed; }

.error {
  color: var(--error);
  font-size: 14px;
  margin-top: 12px;
  padding: 10px 12px;
  background: #fef2f2;
  border-radius: 6px;
  border: 1px solid #fecaca;
}

/* 文件下载视图 */
.file-info {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.file-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  word-break: break-all;
}
.file-size { color: var(--muted); font-size: 14px; }

.download-btn {
  background: var(--success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.download-btn:hover { background: #15803d; }

/* 文件夹列表视图 */
.folder-name {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.file-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}
.file-list-header,
.file-item {
  display: grid;
  grid-template-columns: 40px 1fr 120px;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}
.file-list-header {
  background: #f8fafc;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.file-item {
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: #f8fafc; }
.file-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}
.file-item .name { word-break: break-all; }
.file-item .size { color: var(--muted); font-size: 13px; text-align: right; }

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.actions button { flex: 1; min-width: 140px; }

.empty {
  text-align: center;
  padding: 32px;
  color: var(--muted);
}

.footer {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 600px) {
  .card { padding: 24px 20px; }
  .file-list-header, .file-item {
    grid-template-columns: 40px 1fr 90px;
    padding: 10px 12px;
    font-size: 13px;
  }
  .file-item .size { font-size: 12px; }
}
