/* AROQA Medical Library Feature Styles (dist/features/library/library.css)
 * Phase 12B Visual Identity: ACADEMIC MEDICAL REFERENCE ROOM
 */
.library-academic-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.library-academic-page > *,
.library-hero > *,
.library-layout > * {
  min-width: 0;
}

.library-toolbar .filter-pills {
  flex-wrap: wrap;
  max-width: 100%;
}

.library-hero {
  min-height: 270px;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  gap: 32px;
  padding: 34px clamp(24px, 3.6vw, 48px);
  border: 1px solid rgba(226, 194, 117, 0.22);
  border-radius: 24px;
  background:
    radial-gradient(circle at 82% 28%, rgba(212, 175, 55, 0.14), transparent 34%),
    radial-gradient(circle at 18% 55%, rgba(20, 125, 148, 0.22), transparent 36%),
    linear-gradient(145deg, #0d1a24, #060d14);
  box-shadow: var(--ui-shadow);
}

.library-hero h1 {
  margin: 10px 0;
  font-size: clamp(32px, 3.8vw, 52px);
  line-height: 1.1;
  color: #f3f9fc;
}

.library-hero p,
.product-dashboard .library-hero p {
  max-width: 640px;
  color: #93aab6;
  font-size: 14.5px;
  line-height: 1.65;
  margin: 0;
}

.library-hero-ledger {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.library-ledger-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(226, 194, 117, 0.24);
  background: rgba(212, 175, 55, 0.08);
  color: #ebd494;
  font-size: 12px;
  font-weight: 600;
}

.library-ledger-pill strong {
  color: #fff6db;
  font-family: "Space Grotesk", sans-serif;
}

.library-ledger-pill.subtle {
  border-color: rgba(157, 239, 255, 0.16);
  background: rgba(15, 34, 48, 0.65);
  color: #9bb5c2;
}

.library-search-block {
  display: grid;
  gap: 10px;
}

.library-search {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 16px;
  border: 1px solid rgba(226, 194, 117, 0.28);
  border-radius: 16px;
  background: rgba(6, 16, 25, 0.86);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

.library-search:focus-within {
  border-color: rgba(110, 217, 234, 0.55);
  box-shadow: 0 0 0 3px rgba(110, 217, 234, 0.14);
}

.library-search .ui-icon {
  width: 19px;
  flex-shrink: 0;
  color: #e2c275;
}

.library-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #effcff;
  font-size: 14px;
  outline: none;
}

.library-search input::placeholder {
  color: #748e9b;
}

.library-search button {
  height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(105deg, #f3e2b3, #d4af37);
  color: #09131c;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.library-search button.library-search-clear {
  background: rgba(255, 255, 255, 0.08);
  color: #d6e7f0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0 12px;
}

.library-search-hint {
  color: #7e96a3;
  font-size: 12px;
  line-height: 1.5;
}

.library-hero + .section-toolbar,
.library-toolbar {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.library-pill-count {
  opacity: 0.78;
  font-size: 11px;
  margin-inline-start: 4px;
}

.library-toolbar-status {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #8ca4b0;
  font-size: 13px;
}

.library-toolbar-status strong {
  color: #f3e2b3;
  font-family: "Space Grotesk", sans-serif;
}

/* Bibliographic Inspector Panel */
.library-inspector-panel {
  padding: 24px 26px;
  border-radius: 20px;
  border: 1px solid rgba(226, 194, 117, 0.34);
  background:
    radial-gradient(circle at 90% 15%, rgba(212, 175, 55, 0.12), transparent 36%),
    linear-gradient(155deg, rgba(14, 28, 39, 0.96), rgba(7, 15, 23, 0.98));
  display: grid;
  gap: 16px;
}

.library-inspector-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.library-inspector-head h3 {
  margin: 6px 0 4px;
  font-size: 21px;
  color: #f6fbff;
}

.library-inspector-sub {
  margin: 0;
  color: #ebd494;
  font-size: 13px;
  font-weight: 600;
}

.library-inspector-summary {
  margin: 0;
  color: #b4c8d4;
  font-size: 14px;
  line-height: 1.65;
}

.library-inspector-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.library-inspector-meta-item {
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid rgba(157, 239, 255, 0.12);
  background: rgba(6, 14, 22, 0.65);
  display: grid;
  gap: 5px;
}

.library-inspector-meta-item span {
  color: #7c95a3;
  font-size: 11.5px;
}

.library-inspector-meta-item strong {
  color: #e7f4fa;
  font-size: 13px;
  line-height: 1.45;
}

.library-inspector-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.library-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 11px;
  border: 1px solid rgba(110, 217, 234, 0.26);
  background: rgba(17, 42, 56, 0.65);
  color: #dff7fc;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.library-action-btn.primary {
  border-color: rgba(226, 194, 117, 0.42);
  background: rgba(212, 175, 55, 0.16);
  color: #fff2c6;
}

.library-action-btn.disabled-reader {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #78909c;
  cursor: not-allowed;
}

.library-action-btn .ui-icon {
  width: 13px;
}

.library-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  margin-top: 8px;
}

.book-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 15px;
}

.book-card {
  display: grid;
  grid-template-columns: 124px 1fr;
  gap: 16px;
  min-height: 230px;
  padding: 18px;
  border: 1px solid var(--ui-line);
  border-radius: 18px;
  background: linear-gradient(145deg, #0d1a25, #071019);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.book-card[data-book-inspected="true"] {
  border-color: rgba(226, 194, 117, 0.5);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.book-card[data-book-saved="true"] {
  border-color: rgba(110, 217, 234, 0.42);
}

.book-cover {
  position: relative;
  min-height: 192px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at 70% 22%, #90efff35, transparent 24%),
    linear-gradient(145deg, #176c7d, #08131e);
  box-shadow: 9px 12px 30px #0006;
  overflow: hidden;
}

.book-cover:after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(#ffffff0d 1px, transparent 1px),
    linear-gradient(90deg, #ffffff0d 1px, transparent 1px);
  background-size: 20px 20px;
}

.book-cover > * {
  position: relative;
  z-index: 1;
}

.book-cover span,
.product-dashboard .book-cover span {
  color: #b9f4fa;
  font: 600 10px/1.5 "Space Grotesk", sans-serif;
  letter-spacing: .11em;
}

.book-cover strong {
  font: 800 32px "Space Grotesk", sans-serif;
  color: #ffffff;
}

.book-cover small,
.product-dashboard .book-cover small {
  font: 600 10px/1.5 "Space Grotesk", sans-serif;
  color: #d6eef4;
}

.cover-2 {
  background:
    radial-gradient(circle at 70% 22%, #b0acff34, transparent 24%),
    linear-gradient(145deg, #46418b, #0a1220);
}

.cover-3 {
  background:
    radial-gradient(circle at 70% 22%, #72e3c535, transparent 24%),
    linear-gradient(145deg, #176c64, #08131e);
}

.cover-4 {
  background:
    radial-gradient(circle at 70% 22%, #5e9dff35, transparent 24%),
    linear-gradient(145deg, #224d84, #08131e);
}

.book-card > div:last-child,
.book-card-body {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.book-card-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.access-badge {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid rgba(95, 224, 189, 0.28);
  border-radius: 999px;
  background: rgba(95, 224, 189, 0.08);
  color: #68d8bc;
  font: 700 9.5px "Space Grotesk", sans-serif;
  letter-spacing: 0.04em;
}

.access-badge.licensed {
  border-color: rgba(226, 194, 117, 0.35);
  background: rgba(212, 175, 55, 0.11);
  color: #ebd494;
}

.book-record-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(157, 239, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: #8da5b2;
  font-size: 10.5px;
}

.book-card h3 {
  margin: 10px 0 4px;
  font-size: 16px;
  color: #f1f8fc;
}

.book-card p {
  margin: 0 0 8px;
  color: #8ba3b0;
  font-size: 12.5px;
}

.book-card p.book-scope-note {
  color: #6e8794;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.book-card small {
  display: block;
  margin-top: 6px;
  color: #77909d;
  font-size: 11.5px;
}

.book-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.book-card button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid rgba(110, 217, 234, 0.22);
  border-radius: 9px;
  background: rgba(110, 217, 234, 0.07);
  color: #7ce2f2;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.book-card button.book-save-btn {
  border-color: rgba(226, 194, 117, 0.24);
  background: rgba(212, 175, 55, 0.07);
  color: #e5cb83;
}

.book-card button.book-save-btn.is-saved {
  border-color: rgba(95, 224, 189, 0.38);
  background: rgba(95, 224, 189, 0.14);
  color: #84eccf;
}

.book-card .ui-icon {
  width: 12px;
}

/* Empty Search / Category State */
.library-empty-state {
  margin-top: 15px;
  padding: 28px 24px;
  border-radius: 18px;
  border: 1px dashed rgba(226, 194, 117, 0.32);
  background: rgba(9, 19, 28, 0.78);
  display: grid;
  gap: 10px;
}

.library-empty-state h4 {
  margin: 2px 0;
  font-size: 17px;
  color: #f2f8fc;
}

.library-empty-state p {
  margin: 0;
  color: #8ea5b2;
  font-size: 13.5px;
  line-height: 1.6;
}

.library-reset-btn {
  justify-self: start;
  margin-top: 6px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid rgba(226, 194, 117, 0.38);
  background: rgba(212, 175, 55, 0.14);
  color: #f9e6b3;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.library-layout aside {
  display: grid;
  gap: 12px;
  align-content: start;
}

.saved-list,
.rights-note {
  padding: 21px;
}

.saved-list > .section-head {
  align-items: flex-start;
}

.saved-session-scope {
  display: block;
  margin-top: 3px;
  color: #829aa7;
  font-size: 11.5px;
}

.saved-list > .section-head > span {
  color: #ebd494;
  font: 700 13px "Space Grotesk", sans-serif;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(226, 194, 117, 0.25);
}

.saved-empty-notice {
  margin: 10px 0 6px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.saved-empty-notice p {
  margin: 0;
  color: #839ba8;
  font-size: 12px;
  line-height: 1.55;
}

.saved-shelf-items {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.saved-shelf-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.saved-shelf-row:last-child {
  border-bottom: 0;
}

.saved-shelf-open,
.saved-list > button {
  width: 100%;
  display: grid;
  grid-template-columns: 36px 1fr 14px;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid #ffffff0b;
  background: none;
  color: #dcebf0;
  text-align: start;
  cursor: pointer;
}

.saved-shelf-open {
  border-bottom: 0;
  padding: 4px 0;
}

.saved-list > button:last-child {
  border: 0;
}

.saved-shelf-open > span,
.saved-list > button > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #8beaff1e;
  border-radius: 9px;
  background: #70dfef09;
  color: #65d4e6;
  font: 700 10px "Space Grotesk", sans-serif;
}

.saved-shelf-remove {
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255, 120, 120, 0.24);
  background: rgba(255, 95, 95, 0.08);
  color: #f3a6a6;
  font-size: 11px;
  cursor: pointer;
}

.saved-list b {
  display: block;
  font-size: 12.5px;
  color: #eef8fc;
}

.saved-list small {
  display: block;
  margin-top: 3px;
  color: #748e9b;
  font-size: 11px;
}

.saved-list .ui-icon {
  width: 12px;
  color: #627b87;
}

.rights-note > span {
  width: 41px;
  height: 41px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #52d5b00c;
  color: #66dabb;
}

.rights-note .ui-icon {
  width: 19px;
}

.rights-note h3 {
  margin: 14px 0 7px;
  font-size: 14px;
}

.rights-note p {
  margin: 0;
  color: #8299a6;
  font-size: 12.5px;
  line-height: 1.6;
}

@media (max-width: 1280px) {
  .library-layout {
    grid-template-columns: 1fr 290px;
  }
  .book-card {
    grid-template-columns: 106px 1fr;
  }
  .library-inspector-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1050px) {
  .library-layout {
    grid-template-columns: 1fr;
  }
  .library-layout aside {
    grid-template-columns: 1fr 1fr;
  }
  .rights-note {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .library-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 22px 16px;
    gap: 18px;
  }
  .library-hero h1 {
    font-size: clamp(26px, 7vw, 34px);
  }
  .library-search {
    margin-top: 6px;
    flex-wrap: wrap;
    padding: 8px 12px;
  }
  .library-inspector-panel {
    padding: 18px 16px;
  }
  .library-layout aside {
    grid-template-columns: minmax(0, 1fr);
  }
  .book-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .book-card {
    grid-template-columns: 88px minmax(0, 1fr);
    padding: 14px;
    gap: 12px;
  }
  .library-inspector-meta-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .book-card,
  .library-search,
  .library-action-btn {
    transition: none !important;
  }
}
