/* ═══════════════════════════════════════════════════════════════
   library-search.css — modal + result-card styles for
   js/kiosk-library-search.js. Glass aesthetic matches the bilateral
   listening overlay (bilateral-glass.css) for visual consistency
   across the kiosk's modal surfaces.

   Loaded by kiosk.html. Self-contained — no CSS variable deps from
   kiosk.css beyond the system tap-target constants from
   mobile-tokens.css (--tap-target-min, --input-min-fs).
   ═══════════════════════════════════════════════════════════════ */

.lib-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: radial-gradient(circle at 50% 30%, rgba(20,18,32,0.82), rgba(8,6,16,0.92));
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  animation: libSearchFadeIn 0.22s ease-out;
}
@keyframes libSearchFadeIn { from { opacity: 0 } to { opacity: 1 } }

.lib-search-card {
  width: 100%;
  max-width: 640px;
  max-height: 96vh;
  background: linear-gradient(145deg, rgba(36,34,46,0.9), rgba(22,20,30,0.95));
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  backdrop-filter: blur(28px) saturate(1.6);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px 24px 0 0;
  padding: 18px 18px max(env(safe-area-inset-bottom, 0px), 18px);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: #fff;
  font-family: inherit;
  overflow-y: auto;
}
@media (min-width: 640px) {
  .lib-search-overlay { align-items: center; padding: 24px; }
  .lib-search-card { border-radius: 28px; max-height: 88vh; }
}

.lib-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lib-search-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
}
.lib-search-close {
  width: 40px; height: 40px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lib-search-close:hover { background: rgba(255,255,255,0.14); color: #fff; }

.lib-search-hint {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.4;
}

.lib-search-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.lib-search-input {
  flex: 1;
  min-height: var(--tap-target-min, 48px);
  padding: 12px 16px;
  border: 1.5px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-family: inherit;
  font-size: var(--input-min-fs, 16px);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.lib-search-input::placeholder { color: rgba(255,255,255,0.32); }
.lib-search-input:focus {
  border-color: #4A90D9;
  background: rgba(255,255,255,0.10);
}
.lib-search-mic,
.lib-search-go {
  width: var(--tap-target-min, 48px);
  height: var(--tap-target-min, 48px);
  flex-shrink: 0;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s, background 0.15s;
}
.lib-search-mic {
  background: linear-gradient(135deg, #43A047, #2E7D32);
  color: #fff;
  box-shadow: 0 4px 12px rgba(67,160,71,0.32);
}
.lib-search-go {
  background: linear-gradient(135deg, #4A90D9, #2979D6);
  color: #fff;
  box-shadow: 0 4px 12px rgba(74,144,217,0.32);
}
.lib-search-mic:active,
.lib-search-go:active { transform: scale(0.96); }

/* Filter chip — shown when a filter (kids/audio/large-print/mylang/movies)
   has been pre-applied via tile shortcut. Removable via × button. */
.lib-search-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lib-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  background: linear-gradient(135deg, rgba(255,200,111,0.22), rgba(232,163,61,0.16));
  border: 1px solid rgba(255,200,111,0.45);
  border-radius: 999px;
  color: #ffe1ad;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.lib-filter-clear {
  width: 22px; height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.32);
  color: #ffe1ad;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.lib-filter-clear:hover { background: rgba(0,0,0,0.5); color: #fff; }

.lib-search-recent {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.lib-recent-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.45);
}
.lib-recent-chip {
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.82);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}
.lib-recent-chip:hover { background: rgba(255,255,255,0.12); color: #fff; }

.lib-search-status {
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
  padding: 10px 14px;
  border-radius: 12px;
  min-height: 18px;
}
.lib-search-status:empty { display: none; }
.lib-search-status-info { background: rgba(74,144,217,0.16); color: #aacff0; }
.lib-search-status-warn { background: rgba(245,124,0,0.18); color: #ffc89c; }
.lib-search-status-ok   { background: rgba(67,160,71,0.18); color: #a4e0a8; }
.lib-search-status-err  { background: rgba(229,57,53,0.20); color: #ffb4b3; }

.lib-search-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 6px;
}

/* Result card — full-width AAC-style tappable button */
.lib-result-card {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
  animation: libResultIn 0.25s ease-out;
}
@keyframes libResultIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lib-result-card:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.22);
}
.lib-result-card:active { transform: scale(0.99); }
.lib-result-card-tapped {
  background: rgba(74,144,217,0.18) !important;
  border-color: rgba(74,144,217,0.5) !important;
}

.lib-result-cover {
  width: 64px;
  height: 92px;
  flex-shrink: 0;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.lib-result-cover-blank {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(255,255,255,0.45);
}

.lib-result-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0; /* allow text to ellipsize */
}
.lib-result-title {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  /* 2-line clamp keeps cards predictable height */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-result-meta {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.62);
  line-height: 1.3;
  /* 1-line clamp for author + year */
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  width: fit-content;
}

/* ── Branch availability inline panel (tap-to-expand on result cards) ── */
.lib-result-availability {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  line-height: 1.35;
  animation: libResultIn 0.22s ease-out;
}
.lib-avail-loading {
  color: rgba(255,255,255,0.55);
  font-style: italic;
}
.lib-avail-empty,
.lib-avail-err {
  color: rgba(255,200,156,0.85);
  font-size: 0.8rem;
}
.lib-avail-row {
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.lib-avail-icon {
  width: 16px;
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
}
.lib-avail-yes .lib-avail-icon { color: #6fdd87; }
.lib-avail-no  .lib-avail-icon { color: #ffb86b; }
.lib-avail-text { color: rgba(255,255,255,0.88); }
.lib-avail-no .lib-avail-text { color: rgba(255,255,255,0.62); }

/* ── Contextual bottom-nav pill: 🔍 Search ──
   Always present in kiosk.html, but hidden unless the user is on the
   library board (or any future library sub-board). Driven by the
   body[data-current-board] attribute set in kiosk-board.js _showBoard.
   Same nav-item base styles as Home/Numbers/Translate — just gated.
   The library main board id is "library" in both the per-town config
   (kiosk-towns.js) and the universal vertical (verticals/library.js). */
.nav-item.nav-item-library-search { display: none; }
body[data-current-board="library"] .nav-item.nav-item-library-search,
body[data-current-board^="library_"] .nav-item.nav-item-library-search {
  display: flex;
}
