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;
}

.book-list {
  padding-left: 0;
  list-style: none;
}

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

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

.book-list li > .book-entry-wrapper,
.book-list li > .book-review {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

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

.book-number-spacer {
  width: 30px; /* 26px + 4px border */
  margin-right: 8px;
  flex-shrink: 0;
}

.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;
}

/* Full-width clickable book button for selection pages */
.book-select-btn {
  display: flex;
  width: 100%;
  background-color: transparent;
  border: none;
  border-radius: 4px;
  padding: 4px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.book-select-btn:hover {
  background-color: #E8E0D4;
}

.book-select-btn:active {
  background-color: #DDD5C8;
}

.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;
  min-width: 0;
}

.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-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;
}


/* 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";
  margin-left: 0.2em;
}

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

.unranked-actions {
  display: flex;
  gap: 6px;
}

.book-actions > .unranked-actions::before {
  content: none;
}

.book-title-link {
  color: inherit;
  text-decoration: none;
}

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

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

.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;
}

/* Reusable button */
.btn {
  padding: 2px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background-color: #f5f5f5;
  color: black;
  font: inherit;
  cursor: pointer;
}

.btn:hover {
  background-color: #e8e8e8;
}

.btn:disabled {
  background-color: #e0e0e0;
  color: #666;
  cursor: default;
}

.btn:disabled:hover {
  background-color: #e0e0e0;
}

/* Reusable text input */
.text-input {
  padding: 2px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background-color: white;
  color: black;
  font: inherit;
  width: 300px;
}

textarea {
  font: inherit;
}

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

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

/* Mobile responsive */
@media (max-width: 600px) {
  body {
    margin: 0 auto;
  }

  .navbar {
    flex-wrap: wrap;
    gap: 4px;
  }

  .navbar-separator {
    margin: 0 4px;
  }

  .navbar-link {
    padding: 4px 0;
  }

  .page-content {
    padding: 12px;
  }

  .book-title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  label {
    white-space: nowrap;
  }

  textarea,
  .text-input {
    max-width: 100%;
    box-sizing: border-box;
  }

  .login-btn {
    padding: 12px 16px;
  }
}

