html {
  background-color: white;
}

body {
  font-family: sans-serif;
  max-width: 800px;
  margin: 40px auto;
}

.page-content {
  background-color: #FAF8F5;
  padding: 20px;
}

form {
  margin-bottom: 20px;
}

ol, ul.plain-list {
  padding-left: 0;
  list-style: none;
}

ul.plain-list li {
  margin-bottom: 4px;
  /* Match the space taken by .book-number in ranked tabs (26px + 4px border + 8px margin) */
  margin-left: 38px;
}

ul.plain-list li form {
  margin-bottom: 0;
  display: inline;
}

ol.book-list li {
  display: flex;
  align-items: flex-start;
  margin-bottom: 4px;
}

ol.book-list li > .book-number {
  /* Center with book cover: (76px cover - 30px number) / 2 = 23px */
  margin-top: 23px;
}

ol.book-list li > span:not(.book-number) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

ol.book-list li form {
  margin-bottom: 0;
  display: flex;
  align-items: baseline;
}

.book-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  color: black;
  margin-right: 8px;
  flex-shrink: 0;
  border-width: 2px;
  border-style: solid;
  box-sizing: content-box;
  user-select: none;
}

.book-number.liked {
  background-color: #E8F5E9;
  border-color: #4CAF50;
}

.book-number.ok {
  background-color: #FFFDE7;
  border-color: #FBC02D;
}

.book-number.disliked {
  background-color: #FFEBEE;
  border-color: #F44336;
}

.book-number.unranked {
  background-color: #F5F5F5;
  border-color: #9E9E9E;
  color: #9E9E9E;
}

.book-number.rerank {
  cursor: pointer;
}

.book-number.rerank:hover {
  background-color: #E0E0E0;
  border-color: #757575;
}

.book-number.rerank:active {
  background-color: #BDBDBD;
  border-color: #616161;
}

.navbar {
  background-color: #722F37;
  padding: 5px;
  margin-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-left, .navbar-right {
  display: inline-flex;
  align-items: center;
}

.navbar-link {
  color: white;
  text-decoration: none;
  display: inline-block;
}

.navbar-link::after {
  content: attr(data-text);
  font-weight: bold;
  visibility: hidden;
  display: block;
  height: 0;
  overflow: hidden;
}

.navbar-link:hover {
  text-decoration: underline;
}

.navbar-separator {
  color: white;
  margin: 0 8px;
}

.navbar button:disabled {
  opacity: 1;
  background-color: #e0e0e0;
  color: #666;
}


/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #722F37;
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Book entry layout */
.book-entry {
  display: flex;
  align-items: center;
  gap: 10px;
}

.book-info {
  flex: 1;
  min-width: 0; /* Allow flex item to shrink below content size */
}

.book-title {
  font-size: 1.1em;
  color: black;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-title a {
  color: black;
  text-decoration: none;
}

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

.book-author {
  color: black;
}

.book-cover {
  width: 50px;
  height: 76px;
  flex-shrink: 0;
  order: -1;
  object-fit: contain;
}

.book-cover-placeholder {
  width: 50px;
  height: 76px;
  flex-shrink: 0;
  order: -1;
  background-color: #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 24px;
}

/* Row with icon/button alongside book entry */
.book-entry-row {
  display: flex;
  align-items: center;
}

.book-entry-row .book-entry {
  flex: 1;
  min-width: 0;
}

/* Book review styles */
.book-review {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.book-review summary {
  display: block;
  cursor: pointer;
  list-style: none;
}

.book-review summary::-webkit-details-marker {
  display: none;
}

.review-toggle {
  margin-left: 0;
  cursor: pointer;
  color: #888;
  text-decoration: none;
}

.review-toggle::before {
  content: "▸";
  display: inline-block;
  width: 0.6em;
  text-align: center;
}
details[open] .review-toggle::before {
  content: "▾";
}
.review-toggle::after {
  content: "review";
}

.review-text {
  margin-top: 8px;
  margin-left: 0;
  padding: 8px 0;
  white-space: pre-wrap;
}

/* Book action styles for search results */
.book-action-text {
  margin-left: 0.5em;
  color: #888;
}

.book-actions {
}

.book-actions > form + form::before,
.book-actions > .review-toggle + form::before {
  content: "|";
  color: #888;
  margin: 0 0.2em;
}

.book-action-link {
  background: none;
  border: none;
  color: #888;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.book-action-link:hover {
  text-decoration: underline;
}

/* Login page */
.login-buttons {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.login-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  text-decoration: none;
  color: black;
  background-color: white;
}

.login-btn:hover {
  background-color: #f0f0f0;
}

/* Back/cancel button - grey, top of page */
.btn-back {
  background: none;
  border: none;
  color: #888;
  font: inherit;
  cursor: pointer;
  padding: 0;
  margin-bottom: 8px;
}

.btn-back:hover {
  text-decoration: underline;
}

/* Profile page buttons */
.profile-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-buttons form {
  margin-bottom: 0;
}

