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

html {
  overflow-y: scroll; /* Always show vertical scrollbar */
  scrollbar-gutter: stable; /* Reserve space for scrollbar */
}

body {
  font-family: "Inter", sans-serif;
  background-color: #f8f9fa;
  line-height: 1.6;
  min-height: 100vh;
}

/* Page Layout */
.page-container {
  display: grid;
  grid-template-columns: 1fr min(890px, 100%) 1fr;
  grid-template-areas:
    ". header ."
    ". main .";
  gap: 0;
}

/* Header */
header {
  grid-area: header;
  background: #f8f9fa;
  width: 100%;
  margin-bottom: 1rem;
}

.header-content {
  padding: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
}

.logo h1 {
  color: #333;
  font-size: 1.75rem;
  font-weight: 600;
}

/* Navigation */
.desktop-nav ul {
  display: flex;
  list-style: none;
  gap: 0;
  align-items: center;
}

.desktop-nav li {
  display: flex;
  align-items: center;
}

.desktop-nav li:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 16px;
  background: #333;
  margin: 0 1rem;
}

.desktop-nav a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.5rem 0;
  position: relative;
}

/* Hide admin link without breaking layout */
.desktop-nav li:has(.admin-link),
.mobile-nav li:has(.admin-link) {
  display: none;
}

.desktop-nav li:has(.admin-link):has(a[style*="display: block"]),
.mobile-nav li:has(.admin-link):has(a[style*="display: block"]) {
  display: flex;
}

.desktop-nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: #333;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.desktop-nav a:hover::after,
.desktop-nav a.active::after {
  transform: scaleX(1);
}

/* Mobile Navigation */
.mobile-nav {
  display: none;
  background: white;
  padding: 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: absolute;
  top: 100%;
  right: 0;
  width: min(250px, 80vw);
  border-radius: 4px;
  z-index: 100;
}

.mobile-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mobile-nav a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  font-size: 1rem;
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.mobile-nav a:hover,
.mobile-nav a.active {
  background-color: #f0f0f0;
}

.mobile-nav .login-link .user-email {
  display: none;
}

/* Hamburger Menu */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 6px;
  z-index: 101;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #333;
  transition: 0.3s ease;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 20px;
  background: #f0f0f0;
  border-radius: 3px;
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
}

.progress {
  height: 100%;
  background: #f7e4e4;
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #333;
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

/* List Title Row */
.list-title-row {
  width: 100%;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.current-lists {
  flex: 1;
}

.list-title-text {
  color: #666;
  font-size: 0.88rem;
  font-weight: 400;
}

/* Sort Controls */
.sort-controls {
  position: relative;
}

.sort-button {
  background: none;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #666;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  min-width: 100px;
  justify-content: center;
}

.sort-button:hover {
  background: #f5f5f5;
  color: #333;
}

.sort-button.active {
  background: #f0f0f0;
  color: #333;
}

.sort-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 250px;
  z-index: 100;
}

.sort-dropdown.active {
  display: flex;
}

.sort-option {
  background: none;
  border: none;
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-size: 0.9rem;
  color: #666;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.sort-option:hover {
  background: #f5f5f5;
  color: #333;
}

.sort-option.active {
  background: rgb(174, 242, 205);
  color: #333;
}

/* Main content */
main {
  grid-area: main;
  width: 100%;
}

/* Book grid */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 120px);
  gap: 20px;
  justify-content: center;
  padding: 0;
  margin: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.book-grid.hidden {
  display: none;
}

.book-grid.sorting {
  opacity: 0.6;
  transform: scale(0.98);
}

/* Book card */
.book-card {
  width: 120px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  position: relative;
  display: flex;
  flex-direction: column;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.book-cover-container {
  position: relative;
  width: 120px;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: #f0f0f0;
  flex-shrink: 0;
}

.book-cover {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  transition: filter 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.book-card.read .book-cover {
  filter: grayscale(100%) brightness(0.9);
  opacity: 0.3;
  transition: filter 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* Admin's owned books star indicator */
.owned-star {
  position: absolute;
  top: 5px;
  right: 5px;
  color: lightcoral;
  font-size: 24px;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
  z-index: 10;
  pointer-events: none;
}

.read-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.book-card.read .read-overlay {
  display: flex;
}

.read-check {
  color: #2e7d32;
  font-size: 1.75rem;
}

.book-info {
  padding: 8px;
  flex-grow: 0;
  background: white;
}

.book-title {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  max-height: 2.9em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.book-author {
  font-size: 10px;
  color: #666;
  line-height: 1.2;
  max-height: 2.4em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

.metadata-fields {
  grid-template-columns: 1fr;
}

.metadata-fields .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.metadata-fields .form-group label {
  font-weight: 500;
  margin-bottom: 0;
  font-size: 0.85rem;
}

.metadata-fields .form-group input {
  font-size: 0.85rem;
  padding: 0.75rem;
}

/* Responsive adjustments */
@media (max-width: 1000px) {
  .desktop-nav {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .sort-option {
    font-size: 1rem;
  }

  .header-content {
    position: relative;
  }

  /* Hamburger animation when active */
  .hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  /* Show mobile nav when hamburger is clicked */
  .mobile-nav.active {
    display: block;
  }

  .lists-drawer {
    position: relative;
    z-index: 10;
  }

  .lists-grid {
    grid-template-columns: 1fr;
    margin-top: 2rem;
  }

  .close-drawer {
    top: 0.25rem;
  }
}

@media (max-width: 768px) {
  .page-container {
    gap: 1rem;
    grid-template-columns: 1rem 1fr 1rem;
  }

  .header-content {
    padding: 12px 0;
  }

  .book-grid {
    grid-template-columns: repeat(auto-fill, 120px);
    gap: 20px;
  }

  .book-card {
    width: 120px;
  }

  .book-cover-container {
    width: 120px;
  }

  .book-info {
    padding: 6px;
  }

  .edit-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
    padding: 1rem;
  }

  .edit-row .col-title,
  .edit-row .col-year,
  .edit-row .col-author {
    width: 100%;
  }

  .edit-row .col-cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .edit-row .cover-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .edit-row .cover-preview img {
    margin: 0 auto;
  }

  .edit-row .cover-controls {
    display: flex;
    justify-content: center;
    width: 100%;
    gap: 0.5rem;
  }

  .edit-row .row-actions {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 0.5rem;
  }

  .edit-row input,
  .edit-row select {
    width: 100%;
    text-align: left;
  }

  /* Mobile List Drawer Adjustments */
  .lists-grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-top: 1rem;
  }

  .list-item {
    justify-content: flex-start;
    padding: 0.75rem 0.5rem;
  }

  .list-item .drag-handle {
    align-self: center;
  }

  .list-item span {
    margin-right: auto;
  }

  /* Make list titles clearly visible */
  .list-item span {
    font-weight: 500;
    color: #333;
  }

  /* Mobile drawer improvements */
  .lists-drawer .list-item {
    display: grid;
    grid-template-columns: 3fr 1fr;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background-color: white;
    border: 1px solid #eee;
    margin-bottom: 0.3rem;
  }

  .lists-drawer .list-item span {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    grid-column: 1;
  }

  .lists-drawer .list-item .right-column {
    grid-column: 2;
  }

  .lists-drawer .list-item .list-type-indicator {
    font-size: 0.7rem;
    justify-self: flex-end;
    min-width: auto;
  }
}

/* Lists Drawer */
.lists-drawer {
  display: none;
  width: 100%;
  max-width: 700px;
  background: #f0f0f0;
  border-top: 1px dashed #cac9c9;
  border-bottom: 1px dashed #cac9c9;
  padding: 0;
  position: relative;
  max-height: 300px;
  overflow: hidden;
  margin: 0 auto;
}

.lists-drawer.active {
  display: block;
}

/* New close bar at the top */
.drawer-close-bar {
  width: 100%;
  background: #f7e4e4;
  border-bottom: 1px dashed #cac9c9;
  padding: 0.45rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.drawer-close-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #333;
  cursor: pointer;
  line-height: 1;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.drawer-close-button:hover {
  background: rgba(0, 0, 0, 0.1);
}

.close-drawer {
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #333;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  width: 32px;
  height: 32px;
}

.lists-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.5rem 0.5rem;
}

@media (max-width: 768px) {
  .lists-grid {
    align-items: stretch;
    width: 100%;
  }
}

.list-item {
  width: 500px;
  padding: 0.375rem 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-radius: 4px;
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
}

.list-item span {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item .info-icon {
  color: #666;
  cursor: pointer;
  font-size: 0.875rem;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  text-decoration: none;
  font-weight: bold;
  flex-shrink: 0;
}

.list-item .info-icon:hover {
  opacity: 1;
}

.list-item:hover {
  background-color: rgb(174, 242, 205);
}

.list-item.selected {
  background-color: rgb(174, 242, 205);
}

/* List type indicator */
.list-type-indicator {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 8px;
  margin-right: 8px;
  flex-shrink: 0;
  min-width: 60px;
  text-align: center;
}

.list-type-indicator.admin {
  background-color: rgba(74, 144, 226, 0.1);
  color: #4a90e2;
}

.list-type-indicator.personal {
  background-color: rgba(80, 200, 120, 0.1);
  color: #50c878;
}

/* List section headers */
.lists-section-header {
  font-size: 0.8rem;
  color: #666;
  padding: 0.5rem;
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Default list indicator */
.list-item.default::before {
  content: "★";
  color: #ffd700;
  margin-right: 0.5rem;
  font-size: 1rem;
}

@media (max-width: 700px) {
  .list-item {
    width: 100%;
    padding: 0.5rem;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    text-align: left;
  }

  /* Only apply this grid to non-drawer list items */
  .lists-drawer .list-item {
    grid-template-columns: 3fr 1fr;
  }

  .list-item .drag-handle {
    font-size: 1.5rem;
    margin-right: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    grid-column: 1;
  }

  .list-item span {
    grid-column: 2;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1rem;
    text-align: left;
  }

  /* For drawer items, span takes first column */
  .lists-drawer .list-item span {
    grid-column: 1;
  }

  .list-item .list-type-indicator {
    grid-column: 3;
    justify-self: flex-end;
    font-size: 0.7rem;
    min-width: auto;
    text-align: center;
  }

  .list-item .info-icon {
    grid-column: 3;
    justify-self: flex-end;
    margin-left: auto;
  }

  /* Handle case when both indicator and info icon exist */
  .list-item:has(.info-icon) .list-type-indicator {
    margin-right: 0.5rem;
  }

  /* Create a container for the right column elements */
  .list-item .right-column {
    grid-column: 3;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
  }

  .list-item .list-type-indicator {
    font-size: 0.7rem;
    min-width: auto;
    text-align: center;
  }

  .list-item .info-icon {
    margin-left: 0;
  }
}

/* Scrollbar styling */
.lists-grid::-webkit-scrollbar {
  width: 8px;
}

.lists-grid::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.lists-grid::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.lists-grid::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* Admin Interface */
.admin-view {
  padding: 2rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.admin-view.hidden {
  display: none;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.admin-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
}

.admin-header .actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn-primary {
  background: #333;
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background: #444;
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-warning {
  background: #ff9800;
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-warning:hover {
  background: #f57400;
}

.lists-table {
  width: 100%;
  border: 1px solid #eee;
  border-radius: 4px;
  overflow: hidden;
}

.table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 2fr;
  gap: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
  font-weight: 600;
  color: #333;
  text-align: left;
}

.table-body {
}

/* Admin list rows - single row layout for desktop */
.list-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  grid-template-rows: 1fr;
  gap: 1rem;
  background: white;
  border: 1px solid #eee;
  border-radius: 8px;
  margin-bottom: 1rem;
  padding: 1rem;
  position: relative;
  align-items: center;
}

.list-row .drag-handle,
.list-row > .drag-handle {
  grid-row: 1;
  grid-column: 1;
  font-size: 1.2rem;
  color: #666;
  margin-right: 0.5rem;
  cursor: move;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  padding: 5px;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
}

.list-row .list-name,
.list-row .col-name {
  grid-row: 1;
  grid-column: 2;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
  padding-right: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Book count positioned after the title */
.list-row .col-books {
  grid-row: 1;
  grid-column: 3;
  font-size: 0.9rem;
  color: #666;
  text-align: right;
  align-self: center;
  white-space: nowrap;
}

.list-row .col-actions {
  grid-row: 1;
  grid-column: 4;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  align-items: center;
}

/* Default badge styling for single row */
.list-row .default-badge {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 3px;
  background-color: rgba(255, 215, 0, 0.1);
  color: #b8860b;
  flex-shrink: 0;
}

.btn-icon {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: #f0f0f0;
}

.btn-icon.delete {
  color: rgb(110, 218, 159);
  display: inline-block;
  margin-right: -0.3rem;
}

.btn-icon.nuke {
  color: rgb(248, 99, 99);
  display: inline-block;
}

.btn-icon.delete:hover {
  background: #ffebee;
}

/* Default list star styling */
.btn-icon[title="Make default"] {
  color: #ccc;
  font-size: 1.5rem;
  transition: all 0.2s ease;
}

.list-row.default .btn-icon[title="Make default"] {
  color: #ffd700;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.1);
}

.btn-icon[title="Make default"]:hover {
  color: #ffd700;
  transform: scale(1.1);
  text-shadow: 0 0 4px rgba(255, 215, 0, 0.3);
}

.btn-icon[title="Make default"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* New List Creation Interface */
.new-list-view {
  display: none;
}

.new-list-view.active {
  display: block;
}

.new-list-view textarea {
  width: 100%;
  min-height: 300px;
  padding: 1rem;
  margin: 1rem 0;
  border: 1px solid #eee;
  border-radius: 4px;
  font-family: "Inter", sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

.new-list-view textarea:focus {
  outline: none;
  border-color: #333;
}

.new-list-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Verification Interface */
.verification-view {
  display: none;
}

.verification-view.active {
  display: block;
}

.verification-table {
  width: 100%;
  border: 1px solid #eee;
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}

.verification-table .table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 1fr;
  gap: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
  font-weight: 600;
  color: #333;
}

.verification-row {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 1fr;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid #eee;
  align-items: start;
  position: relative;
}

.verification-row:last-child {
  border-bottom: none;
}

.verification-row .book-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.verification-row .title-text {
  font-weight: 500;
}

.verification-row .search-status {
  font-size: 0.875rem;
  color: #666;
}

.verification-row .search-status.searching {
  color: #2196f3;
}

.verification-row .search-status.error {
  color: #f44336;
}

.verification-row .search-status.success {
  color: #4caf50;
}

.verification-row select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #eee;
  border-radius: 4px;
  font-family: "Inter", sans-serif;
  background: white;
}

.verification-row select:disabled {
  background: #f8f9fa;
  cursor: not-allowed;
}

.verification-row select:focus {
  outline: none;
  border-color: #333;
}

.verification-row .search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #eee;
  border-radius: 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 10;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 0.5rem;
}

.verification-row .results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

.verification-row .result-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid #eee;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.verification-row .result-item:hover {
  border-color: #2196f3;
  background: #f8f9fa;
}

.verification-row .result-item.selected {
  border-color: #4caf50;
  background: #e8f5e9;
}

.verification-row .result-item img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 2px;
}

.verification-row .result-item .result-info {
  font-size: 0.875rem;
}

.verification-row .result-item .result-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.verification-row .result-item .result-author {
  color: #666;
}

@media (max-width: 1000px) {
  .verification-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .verification-row .search-results {
    position: static;
    margin-top: 1rem;
    max-height: none;
  }

  .verification-row .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* Cover Selection Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  overflow-y: auto;
  padding: 2rem 1rem;
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  margin: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 4rem);
  overflow: hidden;
}

.modal-header {
  padding: 1rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #333;
}

.modal-body {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

.cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 1rem;
  width: 100%;
}

.cover-option {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
  cursor: pointer;
  background: white;
}

.cover-option.preferred-edition {
  border: 2px solid rgb(174, 242, 205);
}

.best-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(174, 242, 205, 0.9);
  color: #333;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: 500;
  z-index: 1;
}

/* Style for the best indicator in the dropdown */
.book-select option[data-preferred="true"] {
  font-weight: 500;
  color: #2e7d32;
}

.cover-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.cover-option.selected {
  box-shadow: 0 0 0 3px #4caf50;
  transform: translateY(-2px);
}

.cover-option img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
}

.cover-option .select-cover {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.3rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 0.775rem;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  border: none;
  width: 100%;
  cursor: pointer;
}

.cover-option:hover .select-cover,
.cover-option.selected .select-cover {
  opacity: 1;
}

.cover-option.selected .select-cover {
  background: #4caf50;
}

/* Loading States */
.loading {
  position: relative;
  pointer-events: none;
}

/* Removed global .loading::after spinner to prevent duplicate spinners on the book grid */
/* If you need a small inline spinner elsewhere, use a new class like .inline-loading-spinner */

/* Edit List View */
.edit-list-view {
  display: none;
}

.edit-list-view.active {
  display: block;
}

.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 2rem;
}

.edit-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 1rem;
}

.list-metadata {
  flex: 1;
}

.metadata-fields {
  display: grid;
  grid-template-columns: 1fr;
}

.metadata-fields .form-group:last-child {
  grid-column: 1 / -1;
}

.edit-header .actions {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.edit-table {
  width: 100%;
  border: 1px solid #eee;
  border-radius: 4px;
  overflow: hidden;
}

.edit-row {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) 80px minmax(200px, 2fr) 120px 100px;
  gap: 1rem;
  padding: 0.75rem;
  border-bottom: 1px solid #eee;
  align-items: start;
  position: relative;
}

.edit-row .col-cover {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  grid-column: 4;
}

.edit-row .cover-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.edit-row .cover-controls {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.edit-row .row-actions {
  grid-column: 5;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.edit-row .btn-icon {
  padding: 0.25rem 0.3rem;
  font-size: 0.9rem;
  border: none;
  background: none;
  cursor: pointer;
}

.edit-row input,
.edit-row textarea,
.edit-row select,
.form-input {
  font-family: inherit;
  font-size: 0.85rem;
  color: #222;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.5em;
  box-sizing: border-box;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.edit-row input:focus,
.edit-row textarea:focus,
.edit-row select:focus,
.form-input:focus {
  border-color: #bbb;
  box-shadow: 0 0 0 2px #e0e0e0;
}

.edit-row textarea,
.form-input[type="textarea"] {
  resize: none;
  overflow: auto;
  min-height: 2.2em;
  line-height: 1.4;
}

/* Remove scrollbars and resize handle for textarea unless needed */
.edit-row textarea::-webkit-resizer {
  display: none;
}

/* Top-level form fields (List Name, Short Title, URL) */
input[name="listName"],
input[name="shortTitle"],
input[name="infoUrl"] {
  font-family: inherit;
  font-size: 1rem;
  color: #222;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.5em;
  box-sizing: border-box;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[name="listName"]:focus,
input[name="shortTitle"]:focus,
input[name="infoUrl"]:focus {
  border-color: #bbb;
  box-shadow: 0 0 0 2px #e0e0e0;
}

.edit-row.modified {
  background-color: #fff8e1;
}

.edit-row.error input:invalid {
  border-color: #dc3545;
  background-color: #fff5f5;
}

/* Loading States */
.edit-row.loading select,
.edit-row.loading .select-cover {
  opacity: 0.5;
  pointer-events: none;
}

.edit-row.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Book Search View */
.book-search-view {
  display: none;
  margin-top: 2rem;
}

.book-search-view.active {
  display: block;
}

/* Staged Form */
.staged-form {
  max-width: 600px;
  margin: 0 auto;
}

.search-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  margin-top: 2.5rem;
}

.search-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.search-input {
  font-size: 1.1rem;
  padding: 0.75rem 1.25rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 220px;
  max-width: 350px;
  width: 100%;
  box-sizing: border-box;
}

.search-form .btn-primary {
  font-size: 1.1rem;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
}

@media (max-width: 600px) {
  .search-form {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }
  .search-input {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
  .search-form .btn-primary {
    width: 100%;
  }
}

.search-stage {
  display: none;
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-stage.active {
  display: block;
}

.search-stage h3 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  color: #333;
}

/* Initial Input Stage */
.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #eee;
  border-radius: 4px;
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  margin-top: 0.25rem;
}

.form-input:focus {
  outline: none;
  border-color: #333;
}

/* Book Selection Stage */
.selected-inputs {
  background: #f8f9fa;
  padding: 0.25rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

.input-preview {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.input-preview:last-child {
  margin-bottom: 0;
}

.input-preview .label {
  font-weight: 500;
  color: #666;
  min-width: 60px;
}

.input-preview .value {
  color: #333;
}

#bookSelect {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #eee;
  border-radius: 4px;
  font-family: "Inter", sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
}

#bookSelect option {
  padding: 0.5rem;
}

#bookSelect option:hover {
  background: #f8f9fa;
}

/* Cover Selection Stage */
.selected-book-preview {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

.selected-book-preview h4 {
  margin: 0;
  color: #333;
  font-size: 1rem;
}

.cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

/* Preview Stage */
.book-preview {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin: 1.5rem 0;
}

.preview-cover {
  width: 120px;
  flex-shrink: 0;
}

.preview-cover img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.preview-details {
  flex: 1;
}

.preview-details h4 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: #333;
}

.preview-details p {
  margin: 0 0 0.25rem;
  color: #666;
  font-size: 0.9rem;
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Mobile Optimization */
@media (max-width: 768px) {
  .staged-form {
    max-width: 100%;
  }

  .search-stage {
    padding: 1rem;
  }

  .book-preview {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .preview-cover {
    width: 150px;
    margin-bottom: 1rem;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions button {
    width: 100%;
  }
}

/* Mobile Warning Modal */
#mobileWarningModal .modal-content {
  max-width: 400px;
  margin: 1rem;
}

#mobileWarningModal .modal-header {
  border-bottom: none;
  padding-bottom: 0;
}

#mobileWarningModal .modal-header .modal-close {
  display: none;
}

.modal-close {
  background-color: white;
  border: none;
  font-size: 1.5rem;
  padding-bottom: 0.5rem;
}

#mobileWarningModal .modal-body {
  text-align: center;
  padding: 1.5rem 1rem;
}

#mobileWarningModal p {
  margin-bottom: 1.5rem;
  line-height: 1.5;
  color: #333;
  font-size: 1rem;
}

#mobileWarningModal .modal-actions {
  display: flex;
  justify-content: center;
}

/* Sign-in Prompt Modal */
#signInPromptModal .modal-content {
  max-width: 400px;
  text-align: center;
  padding: 2rem;
}

#signInPromptModal h2 {
  margin: 0 0 1rem;
  color: #333;
}

#signInPromptModal p {
  margin: 0 0 1.5rem;
  color: #666;
  line-height: 1.5;
}

#signInPromptModal .modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

#signInPromptModal .btn-primary {
  background: #4285f4;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

#signInPromptModal .btn-primary:hover {
  background: #3367d6;
}

#signInPromptModal .btn-secondary {
  background: none;
  border: 1px solid #ddd;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

#signInPromptModal .btn-secondary:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

#signInPromptModal .modal-footer {
  color: #666;
  font-size: 0.9rem;
}

#signInPromptModal .modal-footer label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
}
.cover-preview img {
  width: 80px;
}

/* Mobile Admin Interface */
@media (max-width: 1000px) {
  .admin-view {
    padding: 1rem;
  }

  .admin-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .admin-header .actions {
    width: 100%;
    flex-direction: column;
  }

  .admin-header .actions button {
    width: 100%;
  }

  /* Convert table to cards - restore multi-row layout for mobile */
  .table-header {
    display: none;
  }

  .list-row {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 0.5rem;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
    position: relative;
  }

  .list-row .drag-handle,
  .list-row > .drag-handle {
    grid-row: 1;
    grid-column: 1;
    font-size: 1.2rem;
    color: #666;
    margin-right: 0.5rem;
    cursor: move;
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    padding: 5px;
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
  }

  .list-row .list-name,
  .list-row .col-name {
    grid-row: 1;
    grid-column: 2;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
    padding-right: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    display: block;
  }

  /* Book count and actions back to second row on mobile */
  .list-row .col-books {
    grid-row: 2;
    grid-column: 1;
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f5f5f5;
    text-align: left;
    align-self: center;
  }

  .list-row .col-actions {
    grid-row: 2;
    grid-column: 2;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f5f5f5;
    align-items: center;
  }

  /* Remove extra margin and border for compactness */
  .list-row .col-books,
  .list-row .col-actions {
    margin-bottom: 0;
    border-bottom: none;
  }

  /* Remove margin from last list row */
  .list-row:last-child {
    margin-bottom: 0;
  }

  /* Default star styling for mobile */
  .list-row.default .btn-icon[title="Make default"] {
    color: #ffd700;
  }

  /* Edit view mobile optimization */
  .edit-header {
    flex-direction: column;
    gap: 1rem;
  }

  .metadata-fields {
    grid-template-columns: 1fr;
  }

  .edit-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
  }

  .edit-row input {
    font-size: 1rem;
    padding: 0.75rem;
  }

  .edit-row textarea {
    font-size: 1rem;
  }

  .edit-row .year-input {
    width: 100%;
    text-align: left;
  }

  .edit-row .title-input {
    width: 100%;
  }

  .edit-row .col-cover {
    flex-direction: row;
    justify-content: space-between;
  }

  /* Verification view mobile optimization */
  .verification-table .table-header {
    display: none;
  }

  .verification-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
  }

  .verification-row select {
    font-size: 1rem;
    padding: 0.75rem;
  }

  .cover-preview {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .cover-preview img {
    width: 80px;
  }
}

.drag-handle {
  cursor: grab;
  font-size: 1.1rem;
  color: #bbb;
  margin-right: 0.5rem;
  user-select: none;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  transition: color 0.2s;
  flex-shrink: 0;
  flex-grow: 0;
  width: 1.5em;
  justify-content: center;
}

@media (max-width: 768px) {
  .lists-drawer .drag-handle {
    color: #888;
    font-size: 1.3rem;
    margin-right: 0.75rem;
  }
}
.drag-handle:active {
  cursor: grabbing;
  color: #888;
}
.list-item.dragging {
  opacity: 0.5;
}
@media (max-width: 700px) {
  .drag-handle {
    font-size: 2rem;
    margin-right: 1rem;
  }
}

.personal-default-badge {
  background: #e3f6fc;
  color: #2196f3;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.8em;
  font-weight: 600;
  margin-left: 0.5em;
  box-shadow: 0 1px 2px rgba(33, 150, 243, 0.08);
  border: 1px solid #b3e5fc;
}
.global-default-badge {
  background: #fffbe6;
  color: #bfa100;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.8em;
  font-weight: 600;
  margin-left: 0.5em;
  box-shadow: 0 1px 2px rgba(191, 161, 0, 0.08);
  border: 1px solid #ffe082;
}

/* Loading States */
#bookGrid.loading {
  position: relative;
  min-height: 200px; /* Ensure minimum height for spinner visibility */
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.5s ease;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid rgb(174, 242, 205);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 20px;
  font-size: 16px;
  color: #333;
  text-align: center;
}

.loading-progress {
  width: 250px;
  height: 4px;
  background: #f0f0f0;
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
  position: relative;
}

.loading-progress-bar {
  height: 100%;
  background: rgb(174, 242, 205);
  border-radius: 2px;
  transition: width 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
}

.loading-progress-bar.indeterminate {
  width: 40%;
  animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% {
    left: -40%;
  }
  100% {
    left: 100%;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

#bookGrid.loading .book-card {
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

/* Book cover lazy loading animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.book-cover {
  animation: fadeIn 0.3s ease-in-out;
}

/* Improve placeholders */
.cover-placeholder.loaded {
  opacity: 0 !important;
}

/* Responsive list title display in drawer */
.list-title-full {
  display: inline;
}
.list-title-short {
  display: none;
}
@media (max-width: 999px) {
  .list-title-full {
    display: none;
  }
  .list-title-short {
    display: inline;
  }
}

.add-book-button {
  /* Remove custom styles so it inherits btn-primary or btn-secondary */
  margin: 0;
  padding: 0;
  font-size: inherit;
  width: auto;
  display: inline-block;
  background: none;
  border: none;
  box-shadow: none;
}

.progress-fill {
  height: 100%;
  background-color: #4caf50;
  width: 0%;
  transition: width 0.3s ease;
}

.row-white {
  background: #fff;
}

.row-gray {
  background: #f7f7f9;
}

/* --- Search Bar Adjustments (Desktop) --- */
@media (min-width: 769px) {
  .search-form {
    justify-content: center;
    max-width: 500px;
    margin: 2rem auto 1.5rem auto;
  }
  .search-input {
    max-width: 250px;
    min-width: 0;
    width: 250px;
    font-size: 1rem;
    padding: 0.5rem 1rem;
  }
  .search-form .btn-primary {
    font-size: 1rem;
    padding: 0.5rem 1.25rem;
    min-width: 100px;
  }
  #cancelSearch {
    display: block;
    margin: 1.5rem auto 0 auto;
    width: auto;
    min-width: 120px;
    max-width: 200px;
    text-align: center;
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    background: #f5f5f5;
    color: #333;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
  }
  #cancelSearch:hover {
    background: #e0e0e0;
  }
}

/* Utility: Hide element but preserve space */
.invisible-row {
  visibility: hidden !important;
}

/* Allow title-input to wrap to 2-3 lines in edit and verification views */
.edit-row .title-input,
.verification-row .title-input {
  min-height: 1.8em;
  white-space: normal;
  resize: vertical;
  word-break: break-word;
  display: block;
}

.edit-row .title-input,
.edit-row .year-input {
  color: #333;
}

.edit-row .year-input {
  width: 70%;
}

/* Admin modification styles */
.admin-locked {
  background-color: #f5f5f5 !important;
  color: #666 !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}

.admin-locked:hover {
  background-color: #f5f5f5 !important;
}

.admin-modified-indicator {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #ff9800;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  z-index: 10;
  pointer-events: none;
}

.edit-row:has(.admin-modified-indicator) {
  border-left: 3px solid #ff9800;
}

/* Verification error highlighting */
.verification-row.verification-error {
  background-color: #ffebee !important;
  border-left: 4px solid #f44336 !important;
  animation: errorPulse 0.6s ease-in-out;
}

.verification-row.verification-error .book-select,
.verification-row.verification-error .title-input {
  border-color: #f44336 !important;
  box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.1) !important;
}

@keyframes errorPulse {
  0% {
    background-color: #ffebee;
  }
  50% {
    background-color: #ffcdd2;
  }
  100% {
    background-color: #ffebee;
  }
}

/* Search Book Card Styling */
.search-book-card {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border: 1px solid #eee;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 1rem auto;
  max-width: 600px;
  transition: all 0.2s ease-in-out;
}

.search-book-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.search-book-cover {
  flex-shrink: 0;
  position: relative;
}

.search-book-cover:hover {
  opacity: 0.8;
}

/* Read state styling for search cards */
.search-book-card.read .book-cover {
  filter: grayscale(100%) brightness(0.9);
  opacity: 0.3;
  transition: filter 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.search-book-card .read-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.search-book-card.read .read-overlay {
  display: flex;
}

.search-book-card .read-check {
  color: #2e7d32;
  font-size: 1.25rem;
}

.search-book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-book-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
}

.search-book-author {
  font-size: 0.8rem;
  color: #666;
}

.search-book-year {
  font-size: 0.9rem;
  color: #888;
}

.search-book-lists {
  margin-top: 0.5rem;
}

.search-book-lists ul {
  padding-left: 1.5rem;
  margin: 0.25rem 0;
}

.search-book-lists li {
  margin: 0.125rem 0;
}

/* Desktop layout: 2 cards per row */
@media (min-width: 769px) {
  #searchResult {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
  }

  .search-book-card {
    margin: 0;
    max-width: none;
    width: 100%;
  }

  .search-book-title {
    font-size: 0.9rem;
  }
}

/* Mobile responsive adjustments for search card */
@media (max-width: 768px) {
  .search-book-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding: 0.75rem;
    max-width: none;
    margin: 1rem 0;
  }

  .search-book-cover {
    align-self: center;
  }

  .search-book-info {
    align-items: center;
  }
}

/* Add shake animation for validation messages */
@keyframes shake {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
  75% {
    transform: translateX(-3px);
  }
  100% {
    transform: translateX(0);
  }
}

.validation-message {
  border-radius: 4px;
  padding: 8px 12px;
  background-color: #ffe6e6;
  border: 1px solid #ffcccc;
}

.btn-inactive {
  opacity: 0.6;
}

.error-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #ff6f61;
  color: #fff;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  z-index: 9999;
  animation: toast-in-out 3s ease forwards;
}

@keyframes toast-in-out {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  10% {
    opacity: 1;
    transform: translateY(0);
  }
  90% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(20px);
  }
}

/* Edit Search Styles */
.edit-search {
  margin-bottom: 1rem;
  padding: 0 1rem;
}

.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

#editSearchInput {
  width: 100%;
  padding: 0.5rem;
  padding-right: 2rem;
  font-size: 0.9rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  color: #222;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#editSearchInput:focus {
  border-color: #bbb;
  box-shadow: 0 0 0 2px #e0e0e0;
}

.clear-search {
  position: absolute;
  right: 0.5rem;
  cursor: pointer;
  color: #999;
  font-size: 1.2rem;
  padding: 0.25rem;
  transition: color 0.2s;
}

.clear-search:hover {
  color: #666;
}

.search-results-count {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.5rem;
}

/* Mobile responsiveness for search */
@media (max-width: 768px) {
  .edit-search {
    padding: 0 0.5rem;
  }

  #editSearchInput {
    font-size: 1rem;
    padding: 0.75rem;
  }
}
