/* ================================================
   CONSECRATIO MUNDI — BIBLIOTECA ESPIRITUAL
   biblioteca.css
   ================================================ */

/* --- 1. GLOBAL HEADER COMPATIBILITY & ACTIVE STATE --- */
.nav-links li a.active,
.nav-links li a[aria-current="page"] {
  color: var(--navy);
  font-weight: 600;
}

.nav-links li a.active::after,
.nav-links li a[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav-user-profile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background var(--transition);
}

.nav-user-profile:hover {
  background: var(--cream);
}

.nav-user-profile img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

/* ================================================
   2. MAIN PAGE WRAPPER & SACRED ATMOSPHERE
   ================================================ */
.library-page {
  position: relative;
  background-color: #FAF8F5;
  min-height: 100vh;
  padding-bottom: 70px;
  overflow-x: hidden;
}

.library-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3.5vw, 36px);
  position: relative;
  z-index: 2;
}

/* ================================================
   3. COMPACT BIBLIOTECA HERO
   ================================================ */
.library-hero {
  position: relative;
  width: 100%;
  background-color: #FAF6EF;
  background-image: url('assets/Open Bible and Rosary on Warm Ivory-1.png');
  background-repeat: no-repeat;
  background-position: right center;
  background-size: auto 100%;
  border-bottom: 1px solid rgba(0, 59, 114, 0.05);
  padding: 24px 0 16px 0;
  overflow: hidden;
}

/* Subtle botanical blend gradient on the left */
.library-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    #FAF6EF 0%,
    rgba(250, 246, 239, 0.96) 38%,
    rgba(250, 246, 239, 0.65) 60%,
    rgba(250, 246, 239, 0.15) 80%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}

.library-hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  position: relative;
  z-index: 2;
  min-height: 150px;
}

.library-hero-left {
  flex: 1 1 auto;
  max-width: 600px;
}

.library-title {
  font-family: var(--font-serif);
  font-size: clamp(34px, 4.4vw, 54px);
  font-weight: 600;
  color: var(--navy);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0;
}

.library-subtitle {
  font-family: var(--font-sans);
  font-size: clamp(16px, 1.8vw, 20px);
  font-weight: 400;
  color: #24436A;
  margin-top: 6px;
  letter-spacing: 0.01em;
}

.library-hero-right {
  flex: 0 1 420px;
  display: flex;
  justify-content: flex-end;
  padding-right: clamp(10px, 3vw, 48px);
}

.library-quote-box {
  text-align: left;
}

.library-quote-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(18px, 1.9vw, 23px);
  line-height: 1.35;
  color: var(--navy);
  margin: 0;
  letter-spacing: 0.01em;
}

.library-quote-cite {
  display: block;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-top: 10px;
  letter-spacing: 0.02em;
}

/* ================================================
   4. SEARCH BAR
   ================================================ */
.library-search-section {
  padding-top: 24px;
  margin-bottom: 20px;
}

.library-search-wrapper {
  position: relative;
  width: 100%;
}

.library-search-input {
  width: 100%;
  height: 52px;
  background-color: var(--white);
  border: 1px solid #D1D9E4;
  border-radius: 8px;
  padding: 0 54px 0 20px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--navy-deep);
  box-shadow: 0 2px 8px rgba(0, 43, 84, 0.04);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.library-search-input::placeholder {
  color: #7D8E9F;
  font-weight: 400;
}

.library-search-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0, 59, 114, 0.12);
}

.library-search-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--transition), transform var(--transition);
}

.library-search-btn:hover {
  background-color: var(--cream);
  transform: translateY(-50%) scale(1.06);
}

.library-search-btn img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

/* ================================================
   5. TOOLBAR (FILTERS + SORT CONTROL)
   ================================================ */
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

/* Filter pills */
.library-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  background-color: var(--white);
  color: var(--navy);
  border: 1px solid #BCCBDC;
  border-radius: 24px;
  padding: 7px 22px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
}

.filter-btn:hover {
  background-color: #F0F4F8;
  border-color: var(--navy);
}

.filter-btn.active,
.filter-btn[aria-pressed="true"] {
  background-color: var(--navy);
  color: var(--white);
  border-color: var(--navy);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 59, 114, 0.18);
}

/* Sort dropdown */
.library-sort-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.library-sort-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--white);
  border: 1px solid #BCCBDC;
  border-radius: 24px;
  padding: 7px 38px 7px 20px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  cursor: pointer;
  background-image: url('assets/Navy blue dropdown chevron-19.png');
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px auto;
  box-shadow: 0 2px 6px rgba(0, 43, 84, 0.03);
  transition: all 0.2s ease;
}

.library-sort-select:hover {
  border-color: var(--navy);
  background-color: #F8FAFC;
}

.library-sort-select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0, 59, 114, 0.12);
}

/* ================================================
   6. RESOURCE GRID & CARDS
   ================================================ */
.library-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-bottom: 50px;
}

.library-card {
  background: var(--white);
  border: 1px solid #DFE5ED;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 30, 60, 0.03);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.library-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 59, 114, 0.09);
  border-color: #CBD7E3;
}

/* Card Image container */
.library-card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background-color: #ECE5DC;
  overflow: hidden;
}

.library-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.library-card:hover .library-card-img {
  transform: scale(1.025);
}

/* Special visual overlay: Gold text on Navy devotional book cover */
.card-overlay-book-title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 28px;
  pointer-events: none;
}

.card-overlay-book-text {
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 600;
  color: #ECC77D;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: pre-line;
}

/* Special visual overlay: Video title on landscape photo */
.card-overlay-video-title {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  padding: 0 12px;
}

.card-overlay-video-title span {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  font-style: italic;
  color: #FFFFFF;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  line-height: 1.25;
  letter-spacing: 0.02em;
  white-space: pre-line;
}

/* Special visual overlay: Centered circular Play button */
.card-overlay-play-btn {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.card-overlay-play-btn svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.library-card:hover .card-overlay-play-btn {
  transform: translate(-50%, -50%) scale(1.1);
}

/* Card Content Area */
.library-card-content {
  padding: 16px 18px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.library-card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.24;
  margin: 0;
  min-height: 44px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}

.library-card-subtitle {
  font-family: var(--font-sans);
  font-size: 13px;
  color: #5D728B;
  margin-top: 3px;
  min-height: 18px;
}

.library-card-meta {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.library-card-meta-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: #52677F;
  line-height: 1.3;
}

.library-card-meta-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

/* Card Actions */
.library-card-actions {
  margin-top: auto;
  padding-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.library-card-actions.single-action {
  grid-template-columns: 1fr;
}

.btn-card-action {
  height: 36px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  border: 1px solid transparent;
}

.btn-card-primary {
  background-color: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.btn-card-primary:hover {
  background-color: var(--navy-deep);
  border-color: var(--navy-deep);
}

.btn-card-secondary {
  background-color: var(--white);
  color: var(--navy);
  border-color: #BCCBDC;
}

.btn-card-secondary:hover {
  background-color: #F0F4F8;
  border-color: var(--navy);
}

/* ================================================
   7. EMPTY STATE
   ================================================ */
.library-empty-state {
  text-align: center;
  padding: 60px 20px 70px;
  background-color: var(--white);
  border: 1px dashed #CBD7E3;
  border-radius: 12px;
  margin-bottom: 50px;
}

.library-empty-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 16px;
}

.library-reset-btn {
  display: inline-block;
  background-color: var(--navy);
  color: var(--white);
  padding: 10px 24px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.library-reset-btn:hover {
  background-color: var(--navy-deep);
}

/* ================================================
   8. TOAST NOTIFICATION
   ================================================ */
.library-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background-color: var(--navy-deep);
  color: var(--white);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 12px 24px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s ease, opacity 0.28s ease;
  z-index: 1000;
  text-align: center;
  max-width: 90vw;
}

.library-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ================================================
   9. RESPONSIVE BREAKPOINTS
   ================================================ */

/* Tablet (<= 1024px) */
@media (max-width: 1024px) {
  .library-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .library-hero-inner {
    gap: 20px;
  }

  .library-hero-right {
    flex: 0 1 360px;
    padding-right: 12px;
  }

  .library-quote-text {
    font-size: 19px;
  }
}

/* Mobile landscape / small tablet (<= 860px) */
@media (max-width: 860px) {
  .library-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .library-sort-wrapper {
    align-self: flex-start;
  }
}

/* Mobile (<= 768px) */
@media (max-width: 768px) {
  .library-hero {
    background-size: cover;
    background-position: right 20% center;
    padding: 24px 0 20px 0;
  }

  .library-hero-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    min-height: auto;
  }

  .library-hero-left {
    max-width: 100%;
  }

  .library-hero-right {
    width: 100%;
    padding-right: 0;
    justify-content: flex-start;
  }

  .library-quote-box {
    border-left: 2px solid var(--gold);
    padding-left: 14px;
  }

  .library-search-section {
    padding-top: 16px;
    margin-bottom: 16px;
  }

  .library-search-input {
    height: 48px;
    font-size: 14px;
  }

  /* Horizontal scrollable chips for filters */
  .library-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    padding-bottom: 6px;
    width: 100%;
  }

  .library-filters::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
  }

  .filter-btn {
    padding: 6px 18px;
    font-size: 13.5px;
    flex-shrink: 0;
  }

  .library-sort-wrapper {
    width: 100%;
  }

  .library-sort-select {
    width: 100%;
  }

  .library-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .library-card-title {
    min-height: auto;
  }
}

/* Small Mobile (<= 480px) */
@media (max-width: 480px) {
  .library-title {
    font-size: 30px;
  }

  .library-subtitle {
    font-size: 15px;
  }

  .library-quote-text {
    font-size: 17px;
  }

  .library-card-content {
    padding: 14px 14px 16px 14px;
  }

  .btn-card-action {
    font-size: 12.5px;
    height: 35px;
  }
}
