/* =========================================================
   BirdPI – Page Styles: Birddex
   Nutzt globale Variablen aus birdpi.css
   ========================================================= */

.page-birddex {
  --card-w: 155px;
  --card-h: 210px;
}

/* Scroll-Container */
.birddex-scroll-area {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* --- Einzeilige Toolbar --- */
.birddex-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  backdrop-filter: blur(8px);
  background: var(--bg);
  border-bottom: 1px solid var(--grid);
  flex-wrap: wrap;
}
.birddex-toolbar h1 {
  margin: 0;
  font-size: 17px;
  white-space: nowrap;
}

.toolbar-sep {
  width: 1px;
  height: 22px;
  background: var(--grid);
  flex-shrink: 0;
}

.filter-select { font-size: 13px; max-width: 160px; }

/* Segment-Buttons */
.seg { display: inline-flex; border: 1px solid var(--accent); border-radius: var(--radius); overflow: hidden; flex-shrink: 0; }
.seg button { border: 0; background: transparent; color: var(--accent); padding: 5px 9px; cursor: pointer; font: inherit; font-size: 11px; }
.seg button.active { background: var(--accent); color: #fff; }

/* Icon-Buttons (Medaillen, Reset, Info) */
.btn-icon { font-size: 16px; padding: 4px 7px; line-height: 1; min-width: 0; }

.clear { border-color: var(--high); color: var(--high); }
.clear:hover { background: var(--high); color: #fff; }

/* --- Info-Popup --- */
.info-wrap { position: relative; }
.info-popup {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  z-index: 10;
}
.info-popup.open { display: block; }
.info-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-ok { background: var(--ok); }
.dot-rl { background: var(--high); }

/* --- Fortschritts-Ring --- */
.ring { width: 36px; height: 36px; position: relative; flex-shrink: 0; }
.ring svg { width: 36px; height: 36px; transform: rotate(-90deg); }
.ring .txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }

/* --- Karten-Grid --- */
main { padding: 10px 12px; }
section.order { margin-block: 10px 20px; }
section.order > h2 { font-size: 15px; margin: 10px 4px; color: var(--accent); }
.page-birddex .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: 10px;
}

/* --- Birddex-Karten --- */
.page-birddex .card {
  overflow: hidden;
  height: var(--card-h);
  display: flex;
  flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
  cursor: default;
}
.page-birddex .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

.thumb {
  aspect-ratio: 1/1;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--tbl-b);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.page-birddex .card:hover .thumb img {
  transform: scale(1.05);
}

/* Birddex-Badges (Artenstatus) */
.page-birddex .card > .badge,
.page-birddex .card .thumb .badge {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 2px 7px;
  height: auto;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: var(--badge-bg);
  border-radius: 4px;
  z-index: 2;
}
.page-birddex .badge.ok { background: var(--ok); color: #fff; }
.page-birddex .badge.rl { background: var(--high); color: #fff; }

.body { padding: 6px 8px 8px; display: grid; gap: 2px; }
.de { font-size: 13px; font-weight: 700; line-height: 1.25; }
.la { font-size: 11px; color: var(--muted); line-height: 1.2; font-style: italic; }

/* ===================== Unseen-Design ===================== */
.card.unseen {
  opacity: .85;
  transition: opacity .2s ease, transform .2s ease, box-shadow .2s ease;
}
.card.unseen:hover {
  opacity: 1;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

.card.unseen .thumb img {
  filter: grayscale(1) brightness(.3);
}

.card.unseen .thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0,0,0,.2) 0%, rgba(0,0,0,.5) 100%);
  pointer-events: none;
}

.card.unseen .thumb .silhouette {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
}
.card.unseen .thumb .silhouette svg {
  width: 44px;
  height: 44px;
  opacity: .25;
  transition: opacity .2s ease;
}
.card.unseen:hover .thumb .silhouette svg {
  opacity: .4;
}

.card.unseen .de { opacity: .6; }
.card.unseen .la { opacity: .4; }
.card.unseen .badge { display: none; }

/* ===================== Unlock-Burst ===================== */
.card.just-unlocked {
  animation: unlockPop .5s ease-out;
}
.card.just-unlocked::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(232,135,74,.4) 0%, transparent 70%);
  animation: burstFade .6s ease-out forwards;
}
@keyframes unlockPop {
  0% { transform: scale(.95); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes burstFade {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ===================== Seen-Karte: Gradient ===================== */
.card:not(.unseen) .thumb::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30%;
  background: linear-gradient(transparent, rgba(0,0,0,.15));
  pointer-events: none;
}

/* =============================================================== */

@media (max-width: 420px) {
  .page-birddex { --card-w: 130px; --card-h: 190px; }
  .birddex-toolbar h1 { font-size: 15px; }
}
