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

/* ================================
   Admin loans dashboard
   ================================ */

.gal-loans-admin {
  max-width: 1200px;
}

.gal-loans-admin h1 {
  margin-bottom: 1.5rem;
}

.loan-section {
  margin-bottom: 2.5rem;
}

.loan-section h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  border-bottom: 2px solid #eaecef;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

/* Color-coded left border per section */
.loan-section--pending h2  { border-color: #f0ad4e; }
.loan-section--approved h2 { border-color: #5bc0de; }
.loan-section--active h2   { border-color: #5cb85c; }
.loan-section--archive h2  { border-color: #ccc; }

.loan-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0060a8;
  color: #fff;
  border-radius: 50%;
  min-width: 1.5rem;
  height: 1.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 0.3rem;
}

.loan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.loan-table th,
.loan-table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid #e0e6ed;
  vertical-align: top;
}

.loan-table th {
  background: #f6f8fa;
  font-weight: 600;
  white-space: nowrap;
  text-align: left;
}

.loan-table tbody tr {
  transition: background 0.12s ease;
}

.loan-table tbody tr:hover {
  background: #f0f6ff;
}

.loan-table--archive {
  opacity: 0.8;
}

.loan-overdue {
  background: #fff5f5 !important;
}

.loan-overdue:hover {
  background: #ffe8e8 !important;
}

.loan-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  white-space: nowrap;
}

.loan-empty {
  color: #5a6a7e;
  font-style: italic;
  padding: 0.75rem 0;
}

.loan-item-link {
  font-weight: 600;
  color: #2e6da4;
  text-decoration: none;
}

.loan-item-link:hover {
  text-decoration: underline;
}

.loan-muted {
  color: #777;
  font-size: 0.82rem;
}

/* Badges (shared with rental module style) */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge--ok      { background: #e6f4ea; color: #1e7e34; }
.badge--danger  { background: #fce8e6; color: #c0392b; }
.badge--warn    { background: #fff3cd; color: #856404; }
.badge--info    { background: #e8f4fd; color: #0060a8; }
.badge--neutral     { background: #f0f0f0; color: #444; }
.badge--available   { background: #e6f4ea; color: #1e7e34; }
.badge--unavailable { background: #fce8e6; color: #c0392b; }

/* Button variants (if not already in theme) */
.button--danger {
  background: #c0392b;
  color: #fff !important;
  border-color: #a93226;
}

.button--danger:hover {
  background: #a93226;
}

.button--small {
  font-size: 0.8rem;
  padding: 0.2rem 0.65rem;
}

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