/* ===================================================================
   library.web.css — Desktop (≥900px) "My Library" page.
   Loaded after home.web.css (header/footer/.web-card) and listing.web.css
   (.web-listing__grid). Only the library-specific chrome lives here; book
   covers reuse the shared .web-card look.
   =================================================================== */

.web-lib {
  background: #FFFBFA;
  min-height: 80vh;
  padding: 40px 0 96px;
  color: #101010;
}

/* Title + controls align their left edge with the first grid column. */
.web-lib__title,
.web-lib__controls {
  max-width: 1312px;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

.web-lib__title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 26px;
}

.web-lib__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

/* ---- Tabs ---------------------------------------------------------- */
.web-lib__tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.web-lib__tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 11px 20px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: #101010;
  border: 1px solid rgba(16,16,16,.18);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.web-lib__tab:hover { background: rgba(16,16,16,.05); }
.web-lib__tab.is-active {
  background: #101010;
  color: #FFFBF4;
  border-color: #101010;
}
.web-lib__tab-count {
  font-size: 13px;
  font-weight: 700;
  opacity: .45;
}
.web-lib__tab.is-active .web-lib__tab-count { opacity: .65; }

/* ---- Format filter ------------------------------------------------- */
.web-lib__fmt { position: relative; }
.web-lib__fmt-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: 999px;
  padding: 11px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: #101010;
  border: 1px solid rgba(16,16,16,.18);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.web-lib__fmt-btn:hover { background: rgba(16,16,16,.05); }
.web-lib__fmt.is-filtered .web-lib__fmt-btn {
  background: #101010;
  color: #FFFBF4;
  border-color: #101010;
}
.web-lib__fmt-caret { transition: transform .18s ease; }
.web-lib__fmt.is-open .web-lib__fmt-caret { transform: rotate(180deg); }
.web-lib__fmt-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid rgba(16,16,16,.10);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(16,16,16,.14);
  padding: 6px;
  list-style: none;
  margin: 0;
  z-index: 20;
  display: none;
}
.web-lib__fmt.is-open .web-lib__fmt-menu { display: block; }
.web-lib__fmt-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #101010;
}
.web-lib__fmt-opt:hover { background: #F4EFE9; }
.web-lib__fmt-opt.is-active { font-weight: 700; color: #FF501C; }

/* ---- Grid + card overlays ----------------------------------------- */
.web-lib__grid { margin-top: 8px; }

/* Each grid item wraps the shared .web-card plus a remove button.
   The wrapper is the grid cell so the card keeps its 192px width. */
.web-lib-item {
  position: relative;
  width: 192px;
}
.web-lib-item .web-card { width: 192px; }

/* 3-dot menu button — top-right, revealed on hover/focus (like the prototype). */
.web-lib-item__dots {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(250,248,245,.94);
  color: #101010;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16,16,16,.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}
.web-lib-item:hover .web-lib-item__dots,
.web-lib-item.is-menu-open .web-lib-item__dots,
.web-lib-item__dots:focus-visible { opacity: 1; pointer-events: auto; }
.web-lib-item__dots:hover { background: #fff; }

/* Dropdown menu (Kaldır / Tamamlandı işaretle). */
.web-lib-menu {
  position: absolute;
  top: 44px;
  right: 8px;
  z-index: 6;
  min-width: 190px;
  background: #fff;
  border: 1px solid rgba(16,16,16,.10);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(16,16,16,.16);
  padding: 6px;
}
.web-lib-menu[hidden] { display: none; }
.web-lib-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #101010;
}
.web-lib-menu__item:hover { background: #F4EFE9; }
.web-lib-menu__item--danger { color: #E0341A; }
.web-lib-menu__item--danger:hover { background: #FBEAE6; }

/* Format chip + action button sit on the CARD (the colored .web-card plate,
   top 153px), NOT on the cover artwork — anchored to the .web-lib-item cell.
   Chip in the top-left corner; play/read FAB in the plate's bottom-right. */
.web-lib-chip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: 99px;
  background: rgba(20,16,12,.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
}
.web-lib-chip svg { display: block; }
.web-lib-play {
  position: absolute;
  top: 160px;          /* bottom edge (~198px) aligns with where the cover ends */
  right: 2px;
  z-index: 4;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #FF501C;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255,80,28,.38);
  transition: transform .15s ease;
}
.web-lib-play:hover { transform: scale(1.07); }
.web-lib-play:active { transform: scale(0.98); }

/* Progress meta (In Progress tab) — replaces the star/duration row. */
.web-card__meta--progress,
.web-card__meta--done {
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
}
.web-lib-record {
  font-size: 12.5px;
  font-weight: 600;
  color: #101010;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.web-lib-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(16,16,16,.12);
  overflow: hidden;
}
.web-lib-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #FF501C;
}
.web-lib-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #5C5C5C;
}
.web-lib-status--done { color: #1F7A46; font-weight: 700; }
.web-lib-status svg { flex-shrink: 0; }

/* ---- Empty state --------------------------------------------------- */
.web-lib__empty {
  max-width: 560px;
  margin: 40px auto 0;
  padding: 0 24px;
  text-align: center;
}
.web-lib__empty-title { font-size: 20px; font-weight: 700; color: #101010; }
.web-lib__empty-body  { font-size: 15px; color: #6E675F; margin-top: 10px; line-height: 1.5; }

.web-lib__bottom-spacer { min-height: 40px; }

/* ---- Toast (with Undo) -------------------------------------------- */
.web-lib__toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 210;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  background: #101010;
  color: #FBF8F4;
  border-radius: 999px;
  padding: 12px 14px 12px 22px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(16,16,16,.28);
  max-width: min(560px, calc(100vw - 48px));
}
.web-lib__toast[hidden] { display: none; }
.web-lib__toast-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.web-lib__toast-undo {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #FF7A4D;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
}
.web-lib__toast-undo:hover { background: rgba(255,255,255,.10); }
