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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f0f0f;
  color: #e8e8e8;
  min-height: 100vh;
}

header {
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}
header h1 { font-size: 1.1rem; font-weight: 600; color: #fff; padding: 1rem 0; white-space: nowrap; }

.tabs { display: flex; gap: 0; }
.tab-btn {
  background: none;
  border: none;
  color: #888;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: #ccc; }
.tab-btn.active { color: #fff; border-bottom-color: #1db954; }

.tab-content { display: none; padding: 1.5rem; }
.tab-content.active { display: block; }

.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  background: #1db954;
  color: #000;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: #1ed760; }
.btn.secondary {
  background: #2a2a2a;
  color: #e8e8e8;
  border: 1px solid #3a3a3a;
}
.btn.secondary:hover { background: #333; }
.btn.danger { background: #c0392b; color: #fff; }
.btn.danger:hover { background: #e74c3c; }
.btn.small { padding: 5px 12px; font-size: 0.78rem; }

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

.card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card.overdue { border-color: #c0392b; background: #1e1010; }

.card-cover {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 2rem;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-body { padding: 0.75rem; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.card-album { font-size: 0.9rem; font-weight: 600; color: #fff; line-height: 1.3; }
.card-artist { font-size: 0.8rem; color: #aaa; }
.card-meta { font-size: 0.75rem; color: #666; margin-top: 2px; }
.card-overdue-badge { font-size: 0.72rem; color: #e74c3c; font-weight: 600; margin-top: 2px; }
.card-source { font-size: 0.75rem; color: #888; margin-top: 2px; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0.5rem 0.75rem 0.75rem; }

.empty { color: #555; text-align: center; padding: 3rem; font-size: 0.9rem; }
.warning { background: #2a1a00; border: 1px solid #5a3a00; color: #f0a500; border-radius: 6px; padding: 0.6rem 1rem; font-size: 0.85rem; margin-bottom: 1rem; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 12px;
  width: min(480px, 95vw); max-height: 80vh; overflow-y: auto; padding: 1.5rem;
}
.modal h2 { font-size: 1.1rem; margin-bottom: 1rem; }

.search-results { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.search-result {
  background: #222; border: 1px solid #333; border-radius: 6px;
  padding: 0.6rem 0.75rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
}
.search-result-info { flex: 1; min-width: 0; }
.search-result-title { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-sub { font-size: 0.78rem; color: #888; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: #aaa; margin-bottom: 0.75rem; }
input[type="text"], input[type="date"], select {
  background: #111; border: 1px solid #333; color: #e8e8e8;
  border-radius: 6px; padding: 8px 10px; font-size: 0.88rem; width: 100%;
}
input:focus, select:focus { outline: none; border-color: #1db954; }

#borrow-modal-cover { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; margin-bottom: 1rem; background: #222; display: block; }
