/* CornerShelf – Book lending app styles */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&family=Unna:wght@700&display=swap');

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(145deg, #1a1f2e 0%, #252b3b 50%, #1e2433 100%);
  min-height: 100vh;
  color: #e8eaed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.container {
  width: 100%;
  max-width: 420px;
}

.logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-img {
  display: block;
  max-width: 200px;
  max-height: 64px;
  width: auto;
  height: auto;
  margin: 0 auto 0.75rem auto;
}

.logo h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0;
}

.logo span {
  color: #7c9cbf;
}

.card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card h2 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

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

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #b0b8c4;
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: #e8eaed;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input::placeholder {
  color: #6b7280;
}

.form-group input:focus {
  border-color: #7c9cbf;
  box-shadow: 0 0 0 3px rgba(124, 156, 191, 0.2);
}

.btn {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #5a7a9e 0%, #7c9cbf 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: 0.5rem;
}

.btn:hover {
  opacity: 0.95;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  margin-top: 0.5rem;
  background: rgba(255, 255, 255, 0.12);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-scan {
  background: linear-gradient(135deg, #5a7a9e 0%, #7c9cbf 100%);
  margin-top: 0;
}

.btn-ghost {
  margin-top: 1.5rem;
  background: transparent;
  color: #b0b8c4;
}

.btn-ghost:hover {
  color: #e8eaed;
}

.card-hint {
  color: #b0b8c4;
  font-size: 0.9rem;
  margin: 0 0 1.25rem 0;
}

/* Add book: results list */
.book-results {
  margin: 1rem 0;
}

.book-results-empty {
  color: #b0b8c4;
  font-size: 0.9rem;
  margin: 0;
}

.book-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0;
  margin: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #e8eaed;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.book-result-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.book-result-cover {
  width: 44px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.book-result-cover--placeholder {
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #6b7280;
}

.book-result-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.book-result-info strong {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-result-authors,
.book-result-year {
  font-size: 0.8rem;
  color: #b0b8c4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Add book: selected book + manual fields */
.selected-book {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.selected-book-label {
  font-size: 0.85rem;
  color: #b0b8c4;
  margin: 0 0 0.5rem 0;
}

.selected-book-preview {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.selected-book-cover {
  width: 56px;
  height: 84px;
  object-fit: cover;
  border-radius: 8px;
}

.selected-book-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.selected-book-info strong {
  font-size: 1rem;
}

.selected-book-authors {
  font-size: 0.875rem;
  color: #b0b8c4;
}

.selected-book .manual-fields {
  margin-bottom: 1rem;
}

.selected-book .btn {
  margin-top: 0.5rem;
}

/* Scan barcode overlay */
.scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.scan-overlay-inner {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.scan-overlay-title {
  color: #fff;
  font-size: 1rem;
  margin: 0 0 1rem 0;
}

.scan-video {
  width: 100%;
  max-height: 50vh;
  background: #000;
  border-radius: 12px;
  object-fit: cover;
}

.scan-cancel {
  margin-top: 1rem;
  color: #b0b8c4;
}

.links {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.links a {
  color: #7c9cbf;
  text-decoration: none;
  font-weight: 500;
}

.links a:hover {
  text-decoration: underline;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: none;
}

.message.show {
  display: block;
}

.message.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.message.success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.message.info {
  background: rgba(124, 156, 191, 0.15);
  border: 1px solid rgba(124, 156, 191, 0.3);
  color: #b8d4e8;
}

.nav-links {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-links a {
  color: #7c9cbf;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a:hover {
  text-decoration: underline;
}

/* Index / welcome page */
body.index-page {
  background: #2e1b51;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.index-container {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.index-hero {
  margin-bottom: 3rem;
}

.index-logo {
  display: block;
  max-width: 140px;
  max-height: 140px;
  width: auto;
  height: auto;
  margin: 0 auto 1.25rem auto;
}

.index-title {
  font-family: 'Unna', Georgia, serif;
  font-weight: 700;
  font-size: 2rem;
  color: #fff;
  margin: 0 0 0.75rem 0;
  letter-spacing: -0.02em;
}

.index-tagline {
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  line-height: 1.5;
}

.index-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.btn-index {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #1e103a;
  background: #fff;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
  transition: opacity 0.2s, transform 0.1s;
}

.btn-index:hover {
  opacity: 0.95;
}

.btn-index:active {
  transform: scale(0.98);
}

/* App navigation tabs for logged-in area */
.app-nav {
  margin-bottom: 1.5rem;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 999px;
  padding: 0.25rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.app-nav-list {
  list-style: none;
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
}

.app-nav-link {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 999px;
  color: #b0b8c4;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-nav-link:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #e5e7eb;
}

.app-nav-link--active {
  background: linear-gradient(135deg, #5a7a9e 0%, #7c9cbf 100%);
  color: #fff;
}

/* Mobile-first auth layout (login & signup) */
body.auth-page {
  background: #1d0f49;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
}

.auth-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-bg-arc {
  position: absolute;
  left: -120px;
  top: -80px;
  width: 260px;
  height: 260px;
  background: #ff7a45;
  border-bottom-right-radius: 260px;
}

.auth-bg-circle {
  position: absolute;
  width: 120px;
  height: 120px;
  background: #34d399;
  border-radius: 999px;
}

.auth-bg-circle--one {
  right: -40px;
  top: 40px;
}

.auth-bg-circle--two {
  right: -30px;
  top: 160px;
  opacity: 0.85;
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.75rem 1.5rem 2.5rem;
}

.auth-card {
  width: 100%;
  background: #ffffff;
  border-radius: 32px;
  padding: 2.4rem 1.75rem 2.5rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.45);
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo .logo-img {
  max-width: 80px;
  max-height: 80px;
  margin-bottom: 0.75rem;
}

.auth-logo--small .logo-img {
  max-width: 56px;
  max-height: 56px;
  margin-bottom: 0.5rem;
}

.auth-logo h1 {
  font-family: 'Unna', Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: 1.8rem;
  color: #201047;
}

.auth-logo span {
  color: #201047;
}

.auth-card h2 {
  display: none;
}

.auth-heading {
  display: block;
  font-family: 'Unna', Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: #201047;
  margin: 0 0 1.25rem 0;
  text-align: center;
}

.auth-card .form-group {
  margin-bottom: 1.25rem;
}

.auth-card .form-group input {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  color: #111827;
}

.auth-card .form-group input::placeholder {
  color: #9ca3af;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 8px;
  border: none;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  /* default: password hidden → show \"hide\" icon */
  background-image: url('/images/hide.svg');
  cursor: pointer;
}

.password-toggle--visible {
  /* password visible → show \"see\" icon */
  background-image: url('/images/see.svg');
}

.btn-primary {
  background: #1f1048;
  border-radius: 8px;
  margin-top: 1.25rem;
}

.auth-card .links {
  margin-top: 1.75rem;
  font-size: 0.9rem;
  color: #6b7280;
}

.auth-card .links a {
  color: #1f1048;
  font-weight: 600;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* App shell: logged-in layout with bottom nav */
body.app-shell {
  margin: 0;
  background: #fff;
  min-height: 100vh;
  padding-bottom: 72px;
}

.app-main {
  max-width: 420px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 1rem;
}

.page-title {
  font-family: 'Unna', Georgia, serif;
  font-weight: 700;
  font-size: 1.35rem;
  color: #230F54;
  margin: 0 0 0.25rem 0;
}

.page-subtitle {
  font-size: 0.9rem;
  color: #989898;
  margin: 0 0 1rem 0;
}

.card--app {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #111827;
}

.card--app .form-group label,
.card--app .card-hint {
  color: #6b7280;
}

.card--app .form-group input {
  background: #fff;
  border-color: #e5e7eb;
  color: #111827;
}

.card--app .form-group input::placeholder {
  color: #9ca3af;
}

.shelf-subtitle {
  margin-bottom: 1.25rem;
}

.add-book-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 2rem 1.5rem;
  margin-bottom: 1.5rem;
  background: rgba(35, 15, 84, 0.08);
  border: 2px solid rgba(35, 15, 84, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.add-book-cta:hover {
  background: rgba(35, 15, 84, 0.12);
  border-color: rgba(35, 15, 84, 0.4);
}

.add-book-cta-icon {
  color: #230F54;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-book-cta-label {
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #230F54;
}

.shelf-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.shelf-list--grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.shelf-book {
  min-width: 0;
}

.shelf-book-inner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Fixed 2:3 slot so all covers are same size; fill with no white space, minimal crop */
.shelf-book-cover-wrap {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  flex-shrink: 0;
}

.shelf-book-cover-wrap .shelf-book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 8px;
}

.shelf-book-cover-wrap .shelf-book-cover--placeholder {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #9ca3af;
}

.shelf-book-info strong {
  display: block;
  font-size: 0.9rem;
  color: #230F54;
}

.shelf-book-authors {
  font-size: 0.8rem;
  color: #989898;
}

.app-shell .btn-ghost {
  color: #6b7280;
}

.app-shell .btn-ghost:hover {
  color: #230F54;
}

/* Explore / Home */
.explore-header {
  margin-bottom: 1.5rem;
}

.explore-headline {
  font-family: 'Unna', Georgia, serif;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.3;
  color: #230F54;
  margin: 0 0 1rem 0;
  text-align: center;
}

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

.search-icon {
  position: absolute;
  left: 1rem;
  color: #989898;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  font-size: 1rem;
  font-family: 'Poppins', sans-serif;
  color: #230F54;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  outline: none;
}

.search-input::placeholder {
  color: #989898;
}

.search-input:focus {
  border-color: #230F54;
}

.explore-section {
  margin-top: 1.5rem;
}

.explore-title {
  font-family: 'Unna', Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: #230F54;
  margin: 0 0 0.25rem 0;
}

.explore-subtitle {
  font-size: 0.9rem;
  color: #989898;
  margin: 0 0 1rem 0;
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.explore-empty {
  grid-column: 1 / -1;
  font-size: 0.9rem;
  color: #989898;
  text-align: center;
  padding: 2rem 1rem;
  margin: 0;
}

.explore-book {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.explore-book-title {
  font-size: 0.8rem;
  color: #230F54;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Fixed 2:3 slot so all covers are same size; fill with no white space, minimal crop */
.explore-book-cover-wrap {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  flex-shrink: 0;
}

.explore-book-cover-wrap .explore-book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 8px;
}

.explore-book-cover-wrap .explore-book-cover--placeholder {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #9ca3af;
}

.explore-book-location {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Book detail modal (home) */
.book-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0.25s;
}

.book-modal--open {
  visibility: visible;
  pointer-events: auto;
}

.book-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s;
}

.book-modal--open .book-modal-backdrop {
  opacity: 1;
}

.book-modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: calc(100% - 2rem);
  max-width: 360px;
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
}

.book-modal--open .book-modal-panel {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.book-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #230F54;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.book-modal-close:hover {
  background: rgba(35, 15, 84, 0.1);
  border-color: rgba(35, 15, 84, 0.2);
  color: #230F54;
}

.book-modal-cover-wrap {
  position: relative;
  width: 120px;
  margin: 0 auto 1.25rem;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
}

.book-modal-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-modal-cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #9ca3af;
}

.book-modal-details {
  text-align: center;
}

.book-modal-title {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #230F54;
  margin: 0 0 0.35rem 0;
  line-height: 1.3;
}

.book-modal-authors {
  font-size: 0.95rem;
  color: #6b7280;
  margin: 0 0 0.75rem 0;
  line-height: 1.3;
}

.book-modal-listed-by {
  font-size: 0.9rem;
  color: #989898;
  margin: 0;
}

.book-modal-listed-by #bookModalListerName {
  font-weight: 600;
  color: #230F54;
}

.book-modal-borrow {
  margin-top: 1.25rem;
  width: 100%;
  color: #fff;
  background: #230F54;
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 600;
}

.book-modal-borrow:hover {
  background: #1a0b3d;
  color: #fff;
}

/* Requests page */
.requests-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.requests-tab {
  flex: 1;
  padding: 0.6rem 0.75rem;
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: #595959;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.requests-tab--active {
  font-weight: 600;
  color: #230F54;
  background: rgba(35, 15, 84, 0.12);
}

.requests-content {
  display: block;
}

.requests-pane {
  display: block;
}

.requests-pane--hidden {
  display: none;
}

.requests-section {
  margin-bottom: 1.5rem;
}

.requests-section-title {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #230F54;
  margin: 0 0 0.75rem 0;
}

.requests-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.requests-empty {
  font-size: 0.9rem;
  color: #989898;
  text-align: center;
  padding: 2rem 1rem;
  margin: 0;
}

.request-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.request-card-cover-wrap {
  width: 56px;
  flex-shrink: 0;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: #f3f4f6;
}

.request-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.request-card-cover--placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: #9ca3af;
}

.request-card-body {
  flex: 1;
  min-width: 0;
}

.request-card-title {
  display: block;
  font-size: 0.95rem;
  color: #230F54;
  margin: 0 0 0.25rem 0;
}

.request-card-meta {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0 0 0.5rem 0;
}

.request-card-meta--pending {
  color: #989898;
}

.request-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.request-btn-accept {
  width: auto;
  color: #fff;
  background: #230F54;
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 600;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin-top: 0;
}

.request-btn-accept:hover {
  background: #1a0b3d;
  color: #fff;
}

.request-btn-chat {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Chat panel */
.chat-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 199;
  opacity: 0;
  transition: opacity 0.25s;
}

.chat-panel-backdrop[aria-hidden="false"] {
  opacity: 1;
}

.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease-out;
}

.chat-panel--open {
  transform: translateX(0);
}

.chat-panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 1rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.chat-panel-close {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #230F54;
  cursor: pointer;
  border-radius: 8px;
}

.chat-panel-close:hover {
  background: rgba(35, 15, 84, 0.08);
}

.chat-panel-title {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #230F54;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-messages-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-welcome-hint {
  flex-shrink: 0;
  font-size: 0.9rem;
  color: #6b7280;
  text-align: center;
  margin: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-msg--me {
  align-items: flex-end;
}

.chat-msg-bubble {
  max-width: 85%;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  background: #f3f4f6;
  color: #230F54;
}

.chat-msg--me .chat-msg-bubble {
  background: #230F54;
  color: #fff;
}

.chat-msg-time {
  font-size: 0.7rem;
  color: #989898;
  margin-top: 0.2rem;
}

.chat-input-wrap {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #230F54;
}

.chat-input::placeholder {
  color: #9ca3af;
}

.chat-send {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #230F54;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.chat-send:hover {
  background: #1a0b3d;
}

/* Bottom navigation – consistent across app */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0.5rem 0.5rem max(0.5rem, env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #e5e7eb;
  z-index: 100;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.5rem;
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
  color: #989898;
  transition: color 0.15s;
}

.bottom-nav-item:hover {
  color: #230F54;
}

.bottom-nav-item--active {
  color: #230F54;
}

.bottom-nav-item--active .bottom-nav-icon {
  color: #230F54;
}

.bottom-nav-icon {
  width: 24px;
  height: 24px;
  display: block;
  background-color: #989898;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  transition: background-color 0.15s;
}

.bottom-nav-item--active .bottom-nav-icon {
  background-color: #230F54;
}

.bottom-nav-item:nth-child(1) .bottom-nav-icon {
  -webkit-mask-image: url('/images/Home.svg');
  mask-image: url('/images/Home.svg');
}

.bottom-nav-item:nth-child(2) .bottom-nav-icon {
  -webkit-mask-image: url('/images/Requests.svg');
  mask-image: url('/images/Requests.svg');
}

.bottom-nav-item:nth-child(3) .bottom-nav-icon {
  -webkit-mask-image: url('/images/MyShelf.svg');
  mask-image: url('/images/MyShelf.svg');
}

.bottom-nav-item:nth-child(4) .bottom-nav-icon {
  -webkit-mask-image: url('/images/Profile.svg');
  mask-image: url('/images/Profile.svg');
}

/* Add a Book drawer */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0.25s;
}

.drawer--open {
  visibility: visible;
  pointer-events: auto;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.25s;
}

.drawer--open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70vh;
  max-height: 70vh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 1.5rem 1.25rem max(1.5rem, env(safe-area-inset-bottom));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
}

.drawer--open .drawer-panel {
  transform: translateY(0);
}

.drawer-title {
  font-family: 'Unna', Georgia, serif;
  font-weight: 700;
  font-size: 1.35rem;
  color: #230F54;
  margin: 0 0 0.35rem 0;
}

.drawer-subtitle {
  font-size: 0.9rem;
  color: #989898;
  margin: 0 0 1rem 0;
}

.drawer-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.drawer-tab {
  flex: 1;
  padding: 0.6rem 0.75rem;
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: #595959;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.drawer-tab--active {
  font-weight: 600;
  color: #230F54;
  background: rgba(35, 15, 84, 0.12);
}

.drawer-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.drawer-pane {
  margin-bottom: 1rem;
  min-height: 0;
}

.drawer-pane--hidden {
  display: none;
}

/* Scan: camera preview only, bordered window */
.drawer-scan-area {
  background: #000;
  border: 4px solid #000;
  border-radius: 20px;
  overflow: hidden;
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.drawer-scan-viewfinder {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 120px;
  background: #000;
  overflow: hidden;
  border-radius: 16px;
}

.drawer-scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  vertical-align: top;
}

.drawer-scan-quagga {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.drawer-scan-quagga video,
.drawer-scan-quagga canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.drawer-search-wrap {
  position: relative;
}

.drawer-search {
  margin-bottom: 0;
}

.drawer-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 10;
  display: none;
}

.drawer-dropdown--open {
  display: block;
}

.drawer-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.9rem;
  background: none;
  border: none;
  border-bottom: 1px solid #f3f4f6;
  color: #230F54;
  cursor: pointer;
  transition: background 0.15s;
}

.drawer-dropdown-item:last-child {
  border-bottom: none;
}

.drawer-dropdown-item:hover {
  background: #f9fafb;
}

.drawer-dropdown-empty {
  padding: 0.75rem 1rem;
  margin: 0;
  font-size: 0.9rem;
  color: #989898;
}

.drawer-selected {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 8px;
}

.drawer-selected-label {
  font-size: 0.8rem;
  color: #989898;
  margin: 0 0 0.35rem 0;
}

.drawer-selected-preview {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.drawer-selected-cover {
  width: 48px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
}

.drawer-selected-info strong {
  display: block;
  font-size: 0.95rem;
  color: #230F54;
}

.drawer-selected-authors {
  font-size: 0.85rem;
  color: #989898;
}

.drawer-message {
  margin-bottom: 1rem;
}

.drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.drawer-add-btn {
  margin-top: 0;
  color: #230F54;
  background: rgba(35, 15, 84, 0.12);
  font-family: 'Poppins', system-ui, sans-serif;
}

.drawer-add-btn:hover:not(:disabled) {
  background: rgba(35, 15, 84, 0.18);
}

.drawer-close {
  background: none;
  border: none;
  padding: 0.5rem;
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #230F54;
  cursor: pointer;
}

.drawer-close:hover {
  color: #230F54;
  opacity: 0.85;
}
