/**
 * Author books module styles.
 * Link this file when using author/publisher books modules (n/books/authors_books_module.php, n/books/publisher_books_module.php).
 */
*, *::before, *::after { box-sizing: border-box; }

#main-content { padding: 0 16px 32px; }

/* Fonts from n/fonts.css */
#author-books,
.author-books {
  max-width: 1200px;
  margin: 0 auto;
  font-family: var(--n-font-family);
  font-size: var(--n-font-size-base);
  line-height: var(--n-line-height);
  color: var(--n-color-text);
}

/* Header */
.author-books-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e8e8e8;
}

/* Sort */
.author-books-sort { flex-shrink: 0; }

.author-books-sort form { display: flex; align-items: center; gap: 10px; }

.author-books-sort label {
  margin: 0;
  font-size: var(--n-font-size-sm);
  font-weight: var(--n-font-weight-medium);
  color: var(--n-color-text-secondary);
}

.author-books-sort select {
  padding: 8px 32px 8px 12px;
  font-size: var(--n-font-size-sm);
  font-family: var(--n-font-family);
  color: var(--n-color-text-body);
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.author-books-sort select:hover { border-color: #888; }

.author-books-sort select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* List */
.author-books-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 1024px) {
  .author-books-list { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

@media (max-width: 560px) {
  .author-books-list { grid-template-columns: 1fr; gap: 0; }
  .author-books-header { flex-direction: column; align-items: stretch; }
  .author-books-sort form { justify-content: flex-start; }
}

/* Card item – simple layout, delicate vertical separator */
.author-books-item {
  margin: 0;
  border-right: 1px solid #eaeaea;
  padding-right: 12px;
}

.author-books-item:nth-child(4n) { border-right: none; padding-right: 0; }

@media (max-width: 1024px) {
  .author-books-item:nth-child(4n) { border-right: 1px solid #eaeaea; padding-right: 12px; }
  .author-books-item:nth-child(2n) { border-right: none; padding-right: 0; }
}

@media (max-width: 560px) {
  .author-books-item { border-right: none; padding-right: 0; }
}

/* Mobile – single column, touch-friendly, clear separation */
@media (max-width: 560px) {
  #main-content { padding: 0 12px 24px; }

  .author-books-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
  }

  .author-books-title { font-size: var(--n-heading-h2); }

  .author-books-sort { width: 100%; }
  .author-books-sort form {
    width: 100%;
    flex-wrap: wrap;
  }
  .author-books-sort label { flex: 0 0 100%; margin-bottom: 4px; }
  .author-books-sort select {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 10px 36px 10px 12px;
    font-size: var(--n-font-size-md);
  }

  .author-books-item {
    padding: 24px 0;
    border-bottom: 1px solid #eee;
  }
  .author-books-item:last-child { border-bottom: none; }

  .author-books-cover {
    max-width: 220px;
    margin: 0 auto;
    display: block;
  }

  .author-books-price-row {
    margin-top: 12px;
    min-height: 48px;
    gap: 12px;
    padding-left: 7%;
    padding-right: 7%;
  }
  .author-books-price-row .author-books-price { font-size: var(--n-font-size-xl); }

  .author-books-meta {
    padding-top: 12px;
    padding-left: 5%;
    padding-right: 5%;
    gap: 6px;
  }

  .author-books-item h3.author-books-title-book {
    font-size: var(--n-font-size-md);
    min-height: 0;
  }
  .author-books-isbn,
  .author-books-wydawnictwo,
  .author-books-oferty,
  .author-books-author { font-size: var(--n-font-size-sm); }

  .author-books-pagination {
    margin-top: 28px;
    gap: 8px;
  }
  .author-books-pagination a,
  .author-books-pagination span.page-num {
    min-width: 40px;
    height: 40px;
    font-size: var(--n-font-size-pagination);
  }
}

.author-books-item article {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.author-books-item article:focus-within { outline: none; }
.author-books-item article a:focus { outline: none; }
.author-books-item article a:focus-visible,
.author-books-item article .author-books-btn-kup:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.author-books-item article .author-books-btn-kup:focus-visible { outline-color: #ea580c; }

/* Cover */
.author-books-cover {
  display: block;
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: contain;
}

/* No-cover placeholder (img = 0 or 2): compact box, icon only, no brak.gif */
.author-books-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 220px;
  min-height: 300px;
  max-height: 300px;
  margin-left: auto;
  margin-right: auto;
  padding: 16px;
  background: linear-gradient(145deg, #f1f5f9 0%, #e2e8f0 100%);
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  line-height: 0;
}

.author-books-cover-placeholder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  flex-shrink: 0;
}

.author-books-cover-placeholder-icon svg {
  width: 56px;
  height: 56px;
}

.author-books-item > article > a:first-of-type { line-height: 0; }

/* Price + Kup row – directly under cover */
.author-books-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  min-height: 44px;
  padding-left: 5%;
  padding-right: 5%;
}

.author-books-price-row .author-books-price {
  margin: 0;
  font-weight: var(--n-font-weight-bold);
  font-size: var(--n-font-size-lg);
  color: var(--n-color-price);
}

/* When no price (only Kup/Niedostępna button), keep button on the right */
.author-books-price-row > :only-child {
  margin-left: auto;
}

.author-books-btn-kup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  font-size: var(--n-font-size-xs);
  font-weight: var(--n-font-weight-medium);
  font-family: var(--n-font-family);
  text-decoration: none;
  color: #fff;
  background: #ea580c;
  border: none;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

.author-books-btn-kup:hover { background: #c2410c; }

.author-books-btn-kup:focus { outline: none; }
.author-books-btn-kup:focus-visible {
  outline: 2px solid #ea580c;
  outline-offset: 2px;
}

.author-books-btn-kup-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E") no-repeat center;
  background-size: 20px 20px;
}

.author-books-btn-kup span:last-child { margin-top: 1px; }

.author-books-btn-niedostepna {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  font-size: var(--n-font-size-xs);
  font-weight: var(--n-font-weight-medium);
  font-family: var(--n-font-family);
  text-decoration: none;
  color: #6b7280;
  background: #e5e7eb;
  border: none;
  border-radius: 6px;
  cursor: not-allowed;
  opacity: 0.7;
}

.author-books-btn-niedostepna span:last-child { margin-top: 1px; }

/* Meta block – title, author, details */
.author-books-meta {
  flex: 1;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.author-books-item h3.author-books-title-book {
  min-height: 2.7em;
}

.author-books-item h3.author-books-title-book a {
  color: inherit;
  text-decoration: none;
}

.author-books-item h3.author-books-title-book a:hover { color: var(--n-color-link-hover); text-decoration: underline; }

.author-books-item h3.author-books-title-book a:focus { outline: none; }
.author-books-item h3.author-books-title-book a:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.author-books-author {
  font-size: var(--n-font-size-xs);
  color: var(--n-color-text-secondary);
  margin: 0;
  font-family: var(--n-font-family);
}

.author-books-author a {
  color: var(--n-color-link);
  text-decoration: none;
}

.author-books-author a:hover { color: var(--n-color-link-hover); text-decoration: underline; }

.author-books-isbn,
.author-books-wydawnictwo,
.author-books-oferty {
  font-size: var(--n-font-size-xs);
  color: var(--n-color-text-muted);
  margin: 0;
  font-family: var(--n-font-family);
}

.author-books-wydawnictwo a {
  color: var(--n-color-link);
  text-decoration: none;
}

.author-books-wydawnictwo a:hover { color: var(--n-color-link-hover); text-decoration: underline; }

/* Empty state */
.author-books-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--n-color-text-meta);
  font-size: var(--n-font-size-md);
  font-family: var(--n-font-family);
  background: #f8fafc;
  border-radius: 10px;
  border: 1px dashed #e2e8f0;
}

/* Pagination */
.author-books-pagination {
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.author-books-pagination > span:first-child {
  margin-right: 8px;
  font-size: var(--n-font-size-sm);
  color: var(--n-color-text-meta);
  font-family: var(--n-font-family);
}

.author-books-pagination a,
.author-books-pagination span.page-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: var(--n-font-size-sm);
  font-weight: var(--n-font-weight-medium);
  font-family: var(--n-font-family);
  text-decoration: none;
  color: #334155;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.author-books-pagination a:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

.author-books-pagination .active,
.author-books-pagination span[aria-current="page"] {
  font-weight: 700;
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  cursor: default;
}

.author-books-pagination .pagination-prev,
.author-books-pagination .pagination-next {
  padding: 0 12px;
}

.author-books-pagination .pagination-prev[aria-disabled="true"],
.author-books-pagination .pagination-next[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.author-books-pagination a:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}
