:root {
  --bg: #f5f2eb;
  --surface: #ffffff;
  --border: #d9d3c7;
  --text: #1a1a1a;
  --text-muted: #666;
  --accent: #2c5f2e;
  --bpl-color: #1a4a8a;
  --ath-color: #7a3030;
  --badge-book: #2c5f2e;
  --badge-ebook: #1a5a7a;
  --badge-audio: #6a4a1a;
  --badge-default: #444;
  --radius: 6px;
}

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

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  background: var(--accent);
  color: white;
  padding: 1.5rem 2rem;
}

header h1 {
  font-size: 1.6rem;
  font-weight: normal;
  letter-spacing: 0.02em;
}

header .subtitle {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 0.25rem;
  font-style: italic;
}

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Search form */
.form-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.form-row input {
  flex: 1;
  min-width: 150px;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
}

.form-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.form-row button {
  padding: 0.6rem 1.4rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
}

.form-row button:hover { opacity: 0.9; }
.form-row button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Status */
#status {
  margin-top: 1.5rem;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Error banners */
.error-banner {
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: #664d03;
}

/* Results */
#results {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Result card */
.result-card {
  display: flex;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.result-cover {
  flex-shrink: 0;
  width: 60px;
  height: 80px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-cover .no-cover {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  padding: 4px;
}

.result-body {
  flex: 1;
  min-width: 0;
}

.result-title {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 0.2rem;
}

.result-title a {
  color: var(--text);
  text-decoration: none;
}

.result-title a:hover { text-decoration: underline; }

.result-author {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.result-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-family: system-ui, sans-serif;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-library-bpl  { background: var(--bpl-color); }
.badge-library-ath  { background: var(--ath-color); }
.badge-format-book  { background: var(--badge-book); }
.badge-format-ebook { background: var(--badge-ebook); }
.badge-format-audio { background: var(--badge-audio); }
.badge-format-other { background: var(--badge-default); }

.result-year {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: system-ui, sans-serif;
}
