/* GAL Bookshelf */

.gal-bookshelf {
  margin: 1.5rem 0;
}

.gal-bookshelf__filters {
  display: grid;
  grid-template-columns: repeat(3, auto) auto auto;
  justify-content: start;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f5f5f5;
  border-radius: 4px;
}

.gal-bookshelf__filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.gal-bookshelf__filter-field label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #333;
}

.gal-bookshelf__filter-field select,
.gal-bookshelf__filter-field input[type="text"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  width: 100%;
}

.gal-bookshelf__filter-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}

.gal-bookshelf__filters button {
  padding: 0.4rem 1rem;
  background: #2e6da4;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}

.gal-bookshelf__filters button:hover {
  background: #1e4d7b;
}

.gal-bookshelf__reset {
  font-size: 0.85rem;
  color: #666;
  text-decoration: underline;
  text-align: center;
}

@media (max-width: 768px) {
  .gal-bookshelf__filters {
    grid-template-columns: 1fr;
  }
}

.gal-bookshelf__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.gal-bookshelf__table thead tr {
  background: #2e6da4;
  color: white;
}

.gal-bookshelf__table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.gal-bookshelf__table tbody tr {
  border-bottom: 1px solid #e0e0e0;
  transition: background 0.15s ease;
}

.gal-bookshelf__table tbody tr:hover {
  background: #f0f6ff;
}

.col-cover  { width: 70px;  text-align: center; }
.col-title  { width: 22%; }
.col-region { width: 15%; }
.col-year   { width: 70px; text-align: center; }
.col-summary { width: auto; }

.gal-bookshelf__table td {
  padding: 0.6rem 1rem;
  vertical-align: top;
}

.gal-bookshelf__thumb {
  width: 50px;
  height: 65px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  display: block;
  margin: 0 auto;
}

.gal-bookshelf__no-thumb {
  width: 50px;
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eee;
  border-radius: 3px;
  font-size: 1.5rem;
  margin: 0 auto;
}

.gal-bookshelf__title-link {
  font-weight: 600;
  color: #2e6da4;
  text-decoration: none;
  display: block;
  margin-bottom: 0.2rem;
}

.gal-bookshelf__title-link:hover {
  text-decoration: underline;
}

.gal-bookshelf__author {
  display: block;
  font-size: 0.82rem;
  color: #555;
  margin-bottom: 0.25rem;
}

.gal-bookshelf__type-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.gal-bookshelf__type-badge--book {
  background: #e8f0fb;
  color: #2e6da4;
}

.gal-bookshelf__type-badge--map {
  background: #e8f5e9;
  color: #2e7d32;
}

.col-region small {
  color: #888;
}

.col-summary {
  color: #444;
  line-height: 1.5;
}

.gal-bookshelf__empty {
  padding: 2rem;
  text-align: center;
  color: #666;
  font-style: italic;
}

@media (max-width: 768px) {
  .col-summary { display: none; }
  .col-year    { display: none; }
  .gal-bookshelf__table { font-size: 0.82rem; }
}

/* ================================
   Detail page
   ================================ */

.gal-bookshelf-detail {
  margin: 1.5rem 0;
}

.gal-bookshelf-detail__back {
  display: inline-block;
  margin-bottom: 1.25rem;
  color: #2e6da4;
  text-decoration: none;
  font-size: 0.9rem;
}

.gal-bookshelf-detail__back:hover {
  text-decoration: underline;
}

.gal-bookshelf-detail__title {
  font-size: 1.6rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Top section: image + description */
.gal-bookshelf-detail__top {
  display: grid;
  grid-template-columns: 25% 75%;
  gap: 1.5rem;
  margin-bottom: 2rem;
  align-items: start;
}

.gal-bookshelf-detail__cover {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: block;
}

.gal-bookshelf-detail__no-cover {
  width: 100%;
  aspect-ratio: 2/3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eee;
  border-radius: 4px;
  font-size: 3rem;
}

.gal-bookshelf-detail__description {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #333;
}

.gal-bookshelf-detail__empty {
  color: #888;
  font-style: italic;
}

/* Bottom section: metadata grid */
.gal-bookshelf-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  padding: 1.25rem;
  background: #f5f5f5;
  border-radius: 4px;
  border-top: 3px solid #2e6da4;
}

.gal-bookshelf-detail__meta-item {
  display: flex;
  flex-direction: column;
  min-width: 120px;
}

.gal-bookshelf-detail__meta-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 0.2rem;
}

.gal-bookshelf-detail__meta-value {
  font-size: 0.95rem;
  color: #222;
}

/* Responsive */
@media (max-width: 768px) {
  .gal-bookshelf-detail__top {
    grid-template-columns: 1fr;
  }

  .gal-bookshelf-detail__cover {
    max-width: 200px;
    margin: 0 auto;
  }
}

/* ISBN Lookup */
.isbn-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.isbn-wrapper .form-item {
  flex: 1;
  min-width: 200px;
  margin: 0;
}

#isbn-lookup-btn,
#isbn-scan-btn {
  padding: 0.4rem 1rem;
  background: #2e6da4;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}

#isbn-lookup-btn:hover,
#isbn-scan-btn:hover {
  background: #1e4d7b;
}