/* Public Domain E-Book Search Scoped Styles */
.pdes-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-color, #1f2937);
}

.pdes-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Stat Highlights */
.pdes-summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.pdes-stat-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pdes-stat-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: #7c2d12;
}

.pdes-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Toolbar */
.pdes-toolbar {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 0.5rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pdes-search-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.pdes-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-color, #374151);
}

.pdes-search-row {
  display: flex;
  gap: 0.5rem;
}

.pdes-input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 0.375rem;
  font-size: 0.9375rem;
  background: var(--input-bg, #ffffff);
  color: inherit;
  outline: none;
}

.pdes-input:focus {
  border-color: #9a3412;
  box-shadow: 0 0 0 3px rgba(154, 52, 18, 0.15);
}

.pdes-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pdes-filter-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
}

.pdes-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pdes-pill {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}

.pdes-pill.active {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fdba74;
}

/* Results header */
.pdes-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pdes-results-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}

/* Grid & Cards */
.pdes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.pdes-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 0.5rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pdes-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.pdes-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.pdes-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
}

.pdes-badge-genre {
  background: #ffedd5;
  color: #9a3412;
}

.pdes-badge-year {
  background: #f1f5f9;
  color: #475569;
}

.pdes-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
}

.pdes-card-author {
  font-size: 0.8125rem;
  color: var(--text-muted, #64748b);
  margin: 0;
}

.pdes-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted, #475569);
  padding: 0.4rem 0;
  border-top: 1px dashed var(--border-color, #e5e7eb);
  border-bottom: 1px dashed var(--border-color, #e5e7eb);
}

.pdes-card-summary {
  font-size: 0.8125rem;
  color: var(--text-muted, #4b5563);
  margin: 0;
  line-height: 1.4;
}

.pdes-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

/* Buttons */
.pdes-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.45rem 0.85rem;
  border-radius: 0.375rem;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.pdes-btn-primary {
  background: #9a3412;
  color: #ffffff;
}

.pdes-btn-primary:hover {
  opacity: 0.9;
}

.pdes-btn-secondary {
  background: var(--button-sec-bg, #f3f4f6);
  color: var(--text-color, #374151);
  border-color: var(--border-color, #d1d5db);
}

.pdes-btn-secondary:hover {
  background: var(--button-sec-hover, #e5e7eb);
}

.pdes-btn-read {
  cursor: pointer;
}

.pdes-btn-link {
  color: #475569;
}

.pdes-empty-notice {
  text-align: center;
  color: var(--text-muted, #9ca3af);
  padding: 2.5rem 1rem;
  grid-column: 1 / -1;
}

/* Reader Modal */
.pdes-reader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.pdes-reader-overlay[hidden] {
  display: none;
}

.pdes-reader-box {
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.pdes-theme-light {
  background: #ffffff;
  color: #111827;
}

.pdes-theme-sepia {
  background: #fbf0d9;
  color: #433422;
}

.pdes-theme-dark {
  background: #18181b;
  color: #e4e4e7;
}

.pdes-reader-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.pdes-theme-dark .pdes-reader-toolbar {
  border-bottom-color: #27272a;
}

.pdes-reader-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.pdes-theme-buttons {
  display: flex;
  gap: 0.35rem;
}

.pdes-theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  font-weight: 700;
  cursor: pointer;
}

.pdes-btn-theme-light {
  background: #ffffff;
  color: #111827;
}

.pdes-btn-theme-sepia {
  background: #fbf0d9;
  color: #433422;
}

.pdes-btn-theme-dark {
  background: #18181b;
  color: #ffffff;
  border-color: #3f3f46;
}

.pdes-theme-btn.active {
  outline: 2px solid #9a3412;
}

.pdes-font-slider-box {
  display: flex;
  align-items: center;
}

.pdes-range {
  accent-color: #9a3412;
  cursor: pointer;
  width: 90px;
}

.pdes-reader-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  color: inherit;
  line-height: 1;
}

.pdes-reader-content {
  padding: 2rem 2.5rem;
  overflow-y: auto;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.7;
}

.pdes-reader-book-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
}

.pdes-reader-book-author {
  font-size: 1rem;
  color: inherit;
  opacity: 0.8;
  margin: 0.25rem 0 1rem;
}

.pdes-reader-divider {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

.pdes-theme-dark .pdes-reader-divider {
  border-top-color: #27272a;
}

.pdes-reader-body-text {
  font-size: 1.125rem;
  line-height: 1.8;
}

.pdes-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
