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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #D9C6B0;
  color: #6E574D;
  min-height: 100vh;
  padding: 2rem;
}

h1 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 0.25rem;
  color: #6E574D;
}

h1 a { color: inherit; text-decoration: none; }
h1 a:hover { color: #915A5F; }

.subtitle {
  text-align: center;
  color: #868992;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* --- Tabs --- */
.tabs {
  max-width: 900px;
  margin: 0 auto 1.5rem;
  display: flex;
  border-bottom: 2px solid rgba(178,136,98,0.25);
}

.tabs a {
  padding: 0.55rem 1.4rem;
  text-decoration: none;
  color: #868992;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tabs a.active {
  color: #915A5F;
  border-bottom-color: #915A5F;
  font-weight: 600;
}

.tabs a:hover:not(.active) { color: #6E574D; }

.tab-count {
  font-size: 0.78em;
  background: rgba(178,136,98,0.18);
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  margin-left: 0.35rem;
  font-weight: normal;
}

.tabs a.active .tab-count {
  background: rgba(145,90,95,0.15);
}

/* --- Controls --- */
.controls {
  max-width: 900px;
  margin: 0 auto 1.5rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.controls input[type="text"],
.controls select {
  padding: 0.7rem 1rem;
  border: 1px solid #B28862;
  border-radius: 6px;
  background: #fff;
  color: #6E574D;
  font-size: 1rem;
}

.controls input[type="text"] { flex: 1; min-width: 0; }
.controls select { cursor: pointer; min-width: 0; }

.controls input[type="text"]::placeholder { color: #868992; }
.controls input[type="text"]:focus,
.controls select:focus {
  outline: none;
  border-color: #915A5F;
  box-shadow: 0 0 0 2px rgba(145,90,95,0.15);
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }

.btn-primary {
  background: #915A5F;
  color: #fff;
}

.btn-secondary {
  background: #B28862;
  color: #fff;
}

.btn-danger {
  background: #6E574D;
  color: #fff;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid #B28862;
  color: #6E574D;
}

.stats {
  max-width: 900px;
  margin: 0 auto 1rem;
  color: #868992;
  font-size: 0.85rem;
  padding: 0 0.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.collection {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  gap: 0.75rem;
}

.record {
  background: #fff;
  border: 1px solid rgba(178,136,98,0.3);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.record:hover {
  border-color: #B28862;
  box-shadow: 0 2px 8px rgba(110,87,77,0.1);
}

.record-wishlist {
  border-color: rgba(145,90,95,0.25);
}

.record-wishlist:hover {
  border-color: #915A5F;
  box-shadow: 0 2px 8px rgba(145,90,95,0.12);
}

.record-info h2 {
  font-size: 1.15rem;
  color: #6E574D;
  margin-bottom: 0.25rem;
}

.record-info .artist {
  color: #915A5F;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.record-info .artist a {
  color: inherit;
  text-decoration: none;
}

.record-info .artist a:hover {
  text-decoration: underline;
}

.record-info .details {
  font-size: 0.8rem;
  color: #868992;
}

.record-info .details span { margin-right: 1rem; }

.record-info .details a {
  color: inherit;
  text-decoration: none;
}

.record-info .details a:hover {
  text-decoration: underline;
}

.record-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-end;
}

.record-format {
  background: #B28862;
  color: #fff;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.wishlist-badge {
  background: #915A5F;
  color: #fff;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.record-btns {
  display: flex;
  gap: 0.4rem;
}

.record-btns .btn { font-size: 0.8rem; padding: 0.3rem 0.65rem; }

.no-results {
  text-align: center;
  color: #868992;
  padding: 3rem;
  font-size: 1.1rem;
}

/* Album art in list view */
.record-art {
  width: 60px;
  height: 60px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid rgba(178,136,98,0.2);
}

.record-art-placeholder {
  width: 60px;
  height: 60px;
  border-radius: 4px;
  background: #e8ddd0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #B28862;
  font-size: 1.4rem;
}

/* List view with art */
.collection-list .record {
  grid-template-columns: auto 1fr auto;
}

/* Tile view */
.collection-tiles {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.collection-tiles .record {
  grid-template-columns: 1fr;
  padding: 0;
  overflow: hidden;
  text-align: center;
}

.collection-tiles .record-art,
.collection-tiles .record-art-placeholder {
  width: 100%;
  height: 180px;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid rgba(178,136,98,0.2);
}

.collection-tiles .record-info {
  padding: 0.75rem 1rem;
}

.collection-tiles .record-info h2 {
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.collection-tiles .record-info .artist { font-size: 0.85rem; }
.collection-tiles .record-info .details { font-size: 0.75rem; }
.collection-tiles .record-info .details span { margin-right: 0.5rem; }

.collection-tiles .record-actions {
  padding: 0 1rem 0.75rem;
  align-items: center;
  flex-direction: row;
  justify-content: space-between;
}

.collection-tiles .record-format { font-size: 0.7rem; }
.collection-tiles .wishlist-badge { font-size: 0.7rem; }

/* View toggle button */
.view-toggle {
  display: inline-flex;
  gap: 0;
  border: 1px solid #B28862;
  border-radius: 6px;
  overflow: hidden;
}

.view-toggle a {
  padding: 0.4rem 0.7rem;
  text-decoration: none;
  font-size: 0.85rem;
  color: #6E574D;
  background: transparent;
  transition: background 0.2s;
}

.view-toggle a.active {
  background: #B28862;
  color: #fff;
}

.view-toggle a:hover:not(.active) { background: rgba(178,136,98,0.15); }

/* Form styles */
.form-container {
  max-width: 500px;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  padding: 2rem;
  border: 1px solid rgba(178,136,98,0.3);
}

.form-container h2 {
  margin-bottom: 1.5rem;
  color: #6E574D;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
  color: #868992;
  font-weight: 600;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"] {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid #B28862;
  border-radius: 6px;
  background: #fff;
  color: #6E574D;
  font-size: 1rem;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
  outline: none;
  border-color: #915A5F;
  box-shadow: 0 0 0 2px rgba(145,90,95,0.15);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: #6E574D;
  font-weight: normal;
  margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #915A5F;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* MusicBrainz search results (form.html) */
.mb-result-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(178,136,98,0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  margin-bottom: 0.4rem;
}
.mb-result-item:hover {
  background: rgba(178,136,98,0.08);
  border-color: #B28862;
}
.mb-result-item.selected {
  background: rgba(145,90,95,0.08);
  border-color: #915A5F;
}
.mb-result-thumb {
  width: 50px;
  height: 50px;
  border-radius: 4px;
  object-fit: cover;
  background: #e8ddd0;
  flex-shrink: 0;
}
.mb-result-thumb-placeholder {
  width: 50px;
  height: 50px;
  border-radius: 4px;
  background: #e8ddd0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #B28862;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.mb-result-info {
  flex: 1;
  min-width: 0;
}
.mb-result-info .mb-album {
  font-weight: 600;
  color: #6E574D;
  font-size: 0.95rem;
}
.mb-result-info .mb-artist {
  color: #915A5F;
  font-size: 0.85rem;
}
.mb-result-info .mb-meta {
  color: #868992;
  font-size: 0.78rem;
}
#mb-search-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 600px) {
  body { padding: 1rem; }
  h1 { font-size: 1.8rem; }
  .controls { gap: 0.5rem; }
  .controls input[type="text"] { flex: 1 1 100%; font-size: 16px; }
  .controls select { flex: 1 1 100%; font-size: 16px; }
  .collection-list .record {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  .collection-list .record-art,
  .collection-list .record-art-placeholder {
    width: 100%;
    height: 160px;
    border-radius: 6px;
  }
  .record-actions {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .record-info h2 { font-size: 1.05rem; }
  .form-container { padding: 1.25rem; }
  .form-group input { font-size: 16px; }
  .collection-tiles {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .collection-tiles .record-art,
  .collection-tiles .record-art-placeholder {
    height: 140px;
  }
  .tabs a { padding: 0.5rem 1rem; font-size: 0.9rem; }
}
