/* DGHK Ausleihe – mobile-first */
:root {
  --navy: #011940;
  --navy-light: #0a2a5e;
  --mustard: #E49F18;
  --mustard-dark: #c48a10;
  --green: #2d8a4e;
  --red: #c0392b;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #d8dce8;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(1,25,64,0.10);
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: var(--navy);
  color: #fff;
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.nav-link {
  color: var(--mustard);
  text-decoration: none;
  font-weight: 600;
}
.nav-link:hover { text-decoration: underline; }
.user-email {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}

/* Main */
main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

/* Footer */
footer {
  background: var(--navy);
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem;
  padding: 0.75rem 1rem;
  text-align: center;
}

/* Flash */
.flash {
  background: #d4edda;
  border-left: 4px solid var(--green);
  color: #155724;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}
.flash.error {
  background: #f8d7da;
  border-color: var(--red);
  color: #721c24;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-height: 44px;
}
.btn-primary {
  background: var(--navy);
  color: #fff;
}
.btn-primary:hover { background: var(--navy-light); }
.btn-secondary {
  background: var(--mustard);
  color: var(--navy);
}
.btn-secondary:hover { background: var(--mustard-dark); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--border); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; min-height: 36px; }
.btn-large { padding: 0.8rem 2rem; font-size: 1.05rem; }
.btn-link {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  text-decoration: underline;
}
.btn-link:hover { color: #fff; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-available { background: #d4edda; color: var(--green); }
.badge-loaned { background: #fff3cd; color: #856404; }

/* Book grid */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.page-header h1 { font-size: 1.5rem; }

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

.book-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(1,25,64,0.15);
}

.book-cover {
  width: 100%;
  aspect-ratio: 2/3;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-placeholder {
  font-size: 3rem;
  opacity: 0.3;
}
.cover-placeholder-lg { font-size: 5rem; }

.book-info {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}
.book-title {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-author {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Book detail */
.detail-wrap {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.detail-cover {
  flex-shrink: 0;
  width: 200px;
  aspect-ratio: 2/3;
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-info {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.detail-info h1 { font-size: 1.6rem; line-height: 1.2; }
.detail-author { font-size: 1.1rem; color: var(--text-muted); }
.detail-isbn { color: var(--text-muted); }
.detail-due { font-size: 0.95rem; }
.my-loan-hint { color: var(--green); font-weight: 600; }
.waitlist-hint { color: var(--navy); }
.action-form { margin-top: 0.25rem; }
.back-link { color: var(--navy); text-decoration: none; font-size: 0.9rem; margin-top: 1rem; display: inline-block; }
.back-link:hover { text-decoration: underline; }

/* Forms */
.form-wrap {
  max-width: 400px;
  margin: 2rem auto;
}
.form-wrap-lg { max-width: 640px; }
.form-wrap h1 { margin-bottom: 1.25rem; font-size: 1.4rem; }

.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.form-card label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: -0.4rem;
}
.form-card input[type="email"],
.form-card input[type="password"],
.form-card input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.15s;
  background: var(--bg);
}
.form-card input:focus {
  outline: none;
  border-color: var(--navy);
  background: #fff;
}
.form-hint {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.form-hint a { color: var(--navy); }
.form-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Admin */
.admin-wrap { max-width: 960px; }
.admin-wrap h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.admin-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.admin-section h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.section-header h1,
.section-header h2 { margin-bottom: 0; }

.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
}
.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

.upload-form {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.upload-form input[type="file"] {
  font-size: 0.9rem;
}

/* Scan section */
.scan-section {
  margin-bottom: 1.5rem;
}
.scan-section h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ISBN preview */
.isbn-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Empty state */
.empty-state {
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 1rem 0;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .detail-cover { width: 140px; }
  .detail-info h1 { font-size: 1.3rem; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 1rem; }
  .form-wrap { margin: 1rem auto; }
  .admin-section { padding: 1rem; }
  .header-inner { flex-wrap: wrap; }
}
