:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #2b6cb0;
  --primary-hover: #1f4f85;
  --danger: #c53030;
  --border: #e2e5ea;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
               "Malgun Gothic", "맑은 고딕", "Noto Sans KR", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

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

.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header .brand { font-weight: 700; font-size: 18px; color: var(--text); }
.site-header nav a { margin-left: 16px; color: var(--muted); }
.site-header nav a:hover { color: var(--primary); }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #f0f2f5; }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #f3c3c3; }
.btn-danger:hover { background: #fff1f1; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-row input[type=text],
.form-row input[type=password],
.form-row input[type=file],
.form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
}
.form-row textarea { min-height: 90px; resize: vertical; }
.form-actions { display: flex; gap: 10px; margin-top: 10px; }

.msg { margin: 10px 0; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.msg-error { background: #fdecec; color: var(--danger); border: 1px solid #f3c3c3; }
.msg-success { background: #e8f5ef; color: #2a7b4f; border: 1px solid #bee0cb; }

table.books { width: 100%; border-collapse: collapse; }
table.books th, table.books td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}
table.books th { color: var(--muted); font-weight: 600; background: #fafbfc; }
table.books tr:hover td { background: #fafbfc; }

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.book-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}
.book-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.08); }
.book-card .cover {
  aspect-ratio: 3 / 4;
  background: #e9ecf1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}
.book-card .cover canvas { width: 100%; height: 100%; object-fit: cover; }
.book-card .info { padding: 12px 14px; }
.book-card .info h3 { margin: 0 0 4px; font-size: 15px; }
.book-card .info .meta { color: var(--muted); font-size: 12px; }

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

.auth-wrap {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}
.auth-card h1 { margin: 0 0 18px; font-size: 20px; text-align: center; }

/* Drop zone for PDF upload */
.drop-zone {
  border: 2px dashed #c7cdd6;
  border-radius: 12px;
  padding: 28px 20px;
  background: #fafbfc;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.05s;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.drop-zone:hover { border-color: var(--primary); background: #f0f5fb; }
.drop-zone:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.drop-zone.dragover {
  border-color: var(--primary);
  background: #e3eefb;
  transform: scale(1.01);
}
.drop-zone.has-file { cursor: default; padding: 16px; }
.drop-zone.has-file:hover { background: #fafbfc; border-color: #c7cdd6; }

.drop-zone-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.drop-icon { font-size: 40px; line-height: 1; }
.drop-text { display: flex; flex-direction: column; gap: 4px; }
.drop-text strong { font-size: 15px; color: var(--text); }
.drop-hint { font-size: 13px; color: var(--muted); }

.drop-zone-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.drop-zone-selected .file-meta { text-align: left; overflow: hidden; }
.drop-zone-selected .file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drop-zone-selected .file-size {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.btn-clear {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #f0f2f5;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-clear:hover { background: #fde2e2; color: var(--danger); }
