:root {
  --color-primary: #ff5f2e;
  --color-secondary: #ff8f4d;
  --color-accent: #ffce4d;
  --color-dark: #1d1d3a;
  --color-muted: #6b7280;
  --color-light: #f5f7fb;
  --color-white: #ffffff;
  --color-emerald: #20c997;
  --shadow-soft: 0 18px 40px rgba(17, 18, 45, 0.16);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --max-width: 1160px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--color-dark);
  background-color: var(--color-white);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

.book-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.book-link::after {
  content: "\2197";
  font-size: 0.85em;
  transition: transform 0.2s ease;
}

.book-link:hover {
  color: var(--color-secondary);
}

.book-link:hover::after {
  transform: translateY(-2px);
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1.1rem;
}

.brand-icon {
  font-size: 1.6rem;
}

.main-nav {
  display: flex;
  gap: 1.5rem;
  font-weight: 500;
  color: var(--color-dark);
}

.main-nav a {
  position: relative;
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--color-primary);
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.2s ease;
}

.main-nav a:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: var(--color-white);
  box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 32px rgba(255, 95, 46, 0.28);
}

.btn-secondary {
  background: var(--color-dark);
  color: var(--color-white);
}

.btn-secondary:hover {
  background: #16162a;
}

.btn-light {
  background: var(--color-white);
  color: var(--color-dark);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.btn-light:hover {
  border-color: rgba(29, 78, 216, 0.6);
}

.btn-ghost {
  background: transparent;
  color: var(--color-dark);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.btn-ghost:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.hero {
  background: linear-gradient(135deg, #ff8255, #f44d8c 60%, #7949ff);
  color: var(--color-white);
  padding: 6rem 0 5rem;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("https://www.transparenttextures.com/patterns/white-diamond.png");
  opacity: 0.25;
  pointer-events: none;
}

.hero-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 3rem;
  position: relative;
  z-index: 1;
}

.hero-text h1 {
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 1.1;
  margin-bottom: 1.2rem;
}

.hero-text p {
  font-size: 1.05rem;
  max-width: 32rem;
  opacity: 0.92;
}

.hero-actions {
  margin: 1.8rem 0 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-benefits {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
  display: grid;
  gap: 0.6rem;
}

.hero-benefits li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.hero-benefits li::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 0.6rem;
  background: url('/static/images/book.png') center/contain no-repeat;
  flex-shrink: 0;
}

.hero-card {
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  backdrop-filter: blur(20px);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
  min-height: 280px;
}

.hero-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.hero-card p {
  opacity: 0.75;
  margin-bottom: 1rem;
}

.featured-books {
  display: grid;
  gap: 1rem;
}

.featured-book {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.25);
  padding: 0.9rem;
  border-radius: var(--radius-md);
}

.featured-book img {
  width: 54px;
  height: 78px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.24);
}

.section {
  padding: 5rem 0;
  background: var(--color-white);
}

.section-light {
  background: var(--color-light);
}

.section-contrast {
  background: linear-gradient(135deg, #272744, #121221);
  color: var(--color-white);
}

.section h2 {
  margin-top: 0;
  font-size: clamp(2rem, 3vw, 2.6rem);
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2.5rem;
}

.list-check {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}

.list-check li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.list-check li::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-top: 0.2rem;
  background: url('/static/images/book.png') center/contain no-repeat;
  flex-shrink: 0;
}

.about-stats {
  display: grid;
  gap: 1.4rem;
  padding: 2rem;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-label {
  color: var(--color-muted);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(420px, 100%);
}

.search-box input {
  flex: 1;
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 0.95rem;
}

.search-btn {
  gap: 0.4rem;
  min-width: 110px;
  padding-inline: 1.1rem;
}

.search-icon {
  display: inline-flex;
  width: 1.1rem;
  height: 1.1rem;
  color: var(--color-white);
}

.search-icon svg {
  width: 100%;
  height: 100%;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 1.6rem;
  background: var(--color-light);
  border-radius: var(--radius-lg);
  margin-bottom: 2.2rem;
}

.filter-grid {
  display: grid;
  gap: 0.6rem;
}

.genre-dropdown {
  position: relative;
  width: 100%;
  max-width: 420px;
}

.genre-dropdown-toggle {
  width: 100%;
  justify-content: space-between;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.45);
  padding: 0.7rem 1rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.genre-dropdown-icon {
  width: 1rem;
  height: 1rem;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  margin-left: 0.5rem;
}

.genre-dropdown.open .genre-dropdown-icon {
  transform: rotate(135deg);
}

.genre-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  width: 100%;
  max-width: min(380px, 90vw);
  max-height: 380px;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: var(--color-white);
  box-shadow: var(--shadow-soft);
  z-index: 20;
  box-sizing: border-box;
}

.genre-dropdown.open .genre-dropdown-menu {
  display: block;
}

.genre-dropdown-body {
  max-height: 260px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.genre-dropdown .filter-grid {
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.genre-dropdown .filter-option {
  align-items: flex-start;
}

.genre-dropdown-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
  padding-bottom: 0.25rem;
}

.genre-dropdown-actions .btn {
  flex: 1 1 calc(50% - 0.4rem);
  min-width: 120px;
  text-align: center;
  pointer-events: auto;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.filter-option span {
  flex: 1;
  white-space: normal;
  line-height: 1.4;
  word-break: break-word;
}

.filter-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 2px solid rgba(148, 163, 184, 0.6);
  display: grid;
  place-items: center;
  background: var(--color-white);
  transition: all 0.2s ease;
  cursor: pointer;
}

.filter-option input[type="checkbox"]::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--color-primary);
  transform: scale(0);
  transition: transform 0.2s ease;
}

.filter-option input[type="checkbox"]:checked {
  border-color: var(--color-primary);
  background: rgba(255, 95, 46, 0.08);
}

.filter-option input[type="checkbox"]:checked::after {
  transform: scale(1);
}

.filter-option input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(255, 95, 46, 0.4);
  outline-offset: 2px;
}

.filters-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.book-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge.available {
  background: rgba(34, 197, 94, 0.14);
  color: #16a34a;
}

.badge.on_hand {
  background: rgba(244, 114, 182, 0.16);
  color: #db2777;
}

.badge.expected {
  background: rgba(252, 211, 77, 0.2);
  color: #d97706;
}

.updates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.4rem;
  align-items: stretch;
}

.update-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  height: 100%;
}

.update-card span {
  font-size: 0.85rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.update-card h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.update-card p {
  margin: 0;
  line-height: 1.6;
  color: var(--color-dark);
  white-space: pre-line;
  flex-grow: 1;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.update-card small {
  font-size: 0.85rem;
  color: var(--color-muted);
  flex-shrink: 0;
  margin-top: auto;
}

.updates-carousel-container {
  position: relative;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.carousel-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.4);
  background: var(--color-white);
  color: var(--color-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.carousel-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-white);
  transform: scale(1.05);
}

.carousel-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.carousel-btn svg {
  width: 20px;
  height: 20px;
}

.carousel-dots {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: rgba(148, 163, 184, 0.4);
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.carousel-dot:hover {
  background: rgba(148, 163, 184, 0.7);
  transform: scale(1.2);
}

.carousel-dot.active {
  background: var(--color-primary);
  width: 12px;
  height: 12px;
}

.info-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
}

.highlight {
  margin-top: 1.2rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 207, 112, 0.2);
  border: 1px solid rgba(255, 207, 112, 0.4);
}

.form-card {
  display: grid;
  gap: 1rem;
  background: var(--color-white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  justify-self: stretch;
}

.form-card label {
  display: grid;
  gap: 0.55rem;
  font-size: 0.9rem;
}

.form-locked {
  margin-top: 1rem;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.12);
  color: var(--color-muted);
  text-align: center;
  font-size: 0.95rem;
}

.section-contrast .form-locked {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.9);
}

.form-card .form-hint {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(71, 85, 105, 0.9);
}

.form-card input,
.form-card select,
.form-card textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.45);
  padding: 0.75rem 0.9rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
}

.form-card textarea {
  resize: vertical;
}

.form-card button[type="submit"] {
  width: 100%;
}

.form-message {
  min-height: 1.5rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.form-message.success {
  color: #15803d;
}

.form-message.error {
  color: #dc2626;
}

.section-contrast .form-card {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.section-contrast .form-card input,
.section-contrast .form-card textarea {
  background: rgba(0, 0, 0, 0.15);
  color: var(--color-white);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.section-contrast .form-card input::placeholder,
.section-contrast .form-card textarea::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.card {
  background: var(--color-white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.login-card {
  display: grid;
  gap: 1.5rem;
}

.login-card h3 {
  margin: 0;
  font-size: 1.3rem;
}

.account-panel {
  display: grid;
  gap: 1rem;
}

.account-panel.form-card {
  margin-top: 0;
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  background: var(--color-white);
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.mini-list {
  margin-top: 1.5rem;
  background: rgba(148, 163, 184, 0.12);
  border-radius: var(--radius-md);
  padding: 1rem;
  color: var(--color-dark);
}

.mini-list h4 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-dark);
}

.mini-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.mini-list li {
  font-size: 0.85rem;
  color: var(--color-dark);
}

.mini-list li strong {
  color: var(--color-dark);
  font-weight: 600;
}

.mini-list li small {
  color: var(--color-dark);
  font-size: 0.85rem;
  opacity: 0.8;
}

.hidden {
  display: none !important;
}

.site-footer {
  background: var(--color-dark);
  color: rgba(255, 255, 255, 0.88);
  padding: 2.5rem 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 1.2rem;
  font-size: 0.9rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.76);
}

@media (max-width: 960px) {
  .main-nav {
    display: none;
  }

  .header-inner {
    gap: 1rem;
  }
}

@media (max-width: 640px) {
  .hero {
    padding-top: 5rem;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .search-box {
    width: 100%;
  }

  .section {
    padding: 4rem 0;
  }

  .form-card {
    padding: 1.5rem;
  }
}

.brand-logo {
  height: 84px;
  width: 226px;
  display: block;
}

.brand-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary);
}

.book-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.book-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.list-icon-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.list-icon-row .book-icon {
  margin-top: 0.2rem;
}

.mini-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.mini-list li .book-icon {
  margin-top: 0.2rem;
}

/* Admin Panel Styles */

.admin-table-container {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow-x: auto;
  margin-top: 2rem;
}

.admin-table {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  white-space: nowrap;
}

.admin-table td:nth-child(3),
.admin-table td:nth-child(4) {
  white-space: normal;
  max-width: 200px;
  word-wrap: break-word;
}

.admin-table th {
  background: var(--color-light);
  font-weight: 600;
  color: var(--color-dark);
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.05);
}

.admin-table img {
  width: 40px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.admin-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-edit {
  background: #3b82f6;
  color: var(--color-white);
}

.btn-edit:hover {
  background: #2563eb;
}

.btn-delete {
  background: #ef4444;
  color: var(--color-white);
}

.btn-delete:hover {
  background: #dc2626;
}

.btn-warning {
  background: #f59e0b;
  color: var(--color-white);
}

.btn-warning:hover {
  background: #b45309;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.form-actions .btn {
  flex: 1;
}

@media (max-width: 768px) {
  .admin-table-container {
    overflow-x: auto;
    margin: 1rem -1rem 0;
    border-radius: 0;
  }

  .admin-table {
    min-width: 900px;
  }

  .admin-table th,
  .admin-table td {
    padding: 0.5rem 0.4rem;
    font-size: 0.8rem;
  }

  .admin-table td:nth-child(3),
  .admin-table td:nth-child(4) {
    max-width: 150px;
  }

  .admin-actions {
    flex-direction: column;
    gap: 0.25rem;
    min-width: 120px;
  }

  .admin-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
  }
}

/* Fix catalog section width to match container */
#catalog .filters,
#catalog .book-grid {
  width: min(100% - 2rem, var(--max-width));
  margin-left: auto;
  margin-right: auto;
}

/* Book tooltip styles */
.book-card {
  position: relative;
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: visible;
}

.book-card > .book-cover {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  overflow: hidden;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px rgba(17, 18, 45, 0.2);
}

.book-card.unavailable {
  opacity: 0.7;
}

.book-cover {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

.book-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 0.5rem;
}

.book-body h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--color-dark);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-body .book-meta {
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.book-body .btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.book-body .badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
}

/* Responsive adjustments for book grid */
@media (min-width: 1200px) {
  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
  }
  
  .book-cover {
    height: 220px;
  }
}

@media (max-width: 768px) {
  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }
  
  .book-cover {
    height: 200px;
  }
  
  .book-body {
    padding: 0.75rem;
  }
  
  .book-body h3 {
    font-size: 0.9rem;
  }
}

/* Book Details Modal */
.book-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.book-modal.hidden {
  display: none;
}

.book-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(29, 29, 58, 0.7);
  backdrop-filter: blur(4px);
}

.book-modal-content {
  position: relative;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
}

.book-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s ease;
}

.book-modal-close:hover {
  background: var(--color-white);
}

.book-modal-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  padding: 2rem;
}

.book-modal-cover-container {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
}

.book-modal-cover {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 350px;
  max-height: 550px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  object-fit: contain;
  object-position: center;
  background: var(--color-light);
}

.book-modal-info {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.book-modal-info h2 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.3;
  color: var(--color-dark);
}

.book-modal-meta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.book-modal-meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.book-modal-meta-item strong {
  color: var(--color-muted);
  font-weight: 600;
  min-width: 80px;
}

.book-modal-description {
  margin-top: 0.5rem;
}

.book-modal-description h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  color: var(--color-dark);
}

.book-modal-description p {
  margin: 0;
  line-height: 1.7;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.book-modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1rem;
}

@media (max-width: 768px) {
  .book-modal-body {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .book-modal-cover-container {
    max-width: 250px;
    margin: 0 auto;
  }

  .book-modal-info h2 {
    font-size: 1.5rem;
  }

  .book-modal-actions {
    flex-direction: column;
  }
}