/* src/shared/css/view-public-entry.css
   All component/layout styles for the view-public-entry page. */

/* ── Body ─────────────────────────────────────────────────────────────────── */

body {
  min-height: 100vh;
  background-color: #0B1120;
  color: #e5edf7;
}

/* Safe-area top padding for mobile (overridden by web HTML if not needed) */
body.mobile-layout {
  padding-top: env(safe-area-inset-top);
}

/* ── Scrollbar hide ───────────────────────────────────────────────────────── */

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ── Glass panels ─────────────────────────────────────────────────────────── */

.glass-panel {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-header {
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ── Category pills ───────────────────────────────────────────────────────── */

#categoriesContent .category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 9999px;
  background: var(--cat-bg, rgba(255, 255, 255, 0.08));
  background-color: var(--cat-bg, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--cat-border, rgba(255, 255, 255, 0.18));
  border-color: var(--cat-border, rgba(255, 255, 255, 0.18));
  color: #f8fbff;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.03em;
}

#categoriesContent .category-pill.primary {
  padding: 10px 18px;
  font-size: 0.9rem;
}

#categoriesContent .category-pill .material-symbols-rounded {
  color: var(--cat-color, #ffffff);
  font-size: 1.1em;
}

/* ── Photo lightbox ───────────────────────────────────────────────────────── */

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.photo-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.photo-lightbox img {
  max-width: 75vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 0.5rem;
}

/* Admin action strip — positioned right of image inside lightbox */
.lightbox-admin-strip {
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}
/* Only show when not hidden by Tailwind .hidden utility */
.lightbox-admin-strip:not(.hidden) { display: flex; }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav span {
  font-size: 2rem;
  line-height: 1;
}

.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }

.lightbox-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: white;
  padding: 0 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 20;
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

.lightbox-close__label {
  font-size: 0.78rem;
  font-weight: 800;
}

.lightbox-close > span:first-child {
  font-size: 1.55rem;
  line-height: 1;
}

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

/* ── Species comparison bars ──────────────────────────────────────────────── */

.comp-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
}

.comp-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  width: 0%;
}

.comp-bar-fill.green  { background: linear-gradient(90deg, #10B981, #34D399); }
.comp-bar-fill.amber  { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.comp-bar-fill.red    { background: linear-gradient(90deg, #EF4444, #F87171); }

/* ── Species leader cards ─────────────────────────────────────────────────── */

.leader-card {
  min-width: 140px;
  max-width: 160px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.leader-card:hover { background: rgba(255, 255, 255, 0.07); transform: translateY(-1px); }
.leader-card:active { transform: scale(0.97); }

.leader-card.is-current {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
}

.leader-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.leader-card.is-current .leader-photo { border-color: rgba(245, 158, 11, 0.5); }

/* ── Offline button glow ──────────────────────────────────────────────────── */

.offline-ready {
  color: #06b6d4 !important;
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.6));
}

/* ── Desktop two-column card grid (web only) ──────────────────────────────── */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 1.5rem;
  max-width: 1400px;
  margin: 1.5rem auto 0;
}

@media (min-width: 1600px) {
  .cards-grid { max-width: 1600px; }
}

.cards-grid > .card-full { grid-column: 1 / -1; }

#categoriesCard,
#speciesCard,
#historyCard {
  grid-column: 1;
}

#measurementsCard,
#speciesComparisonCard,
#publicMeasurementsCard,
#validationFlagsBanner {
  grid-column: 2;
}

.cards-grid > .glass-panel {
  height: 100%;
}

.desktop-full-width { max-width: 1400px; margin: 0 auto; }

#photoGalleryContainer {
  margin-bottom: 1.25rem;
}

#topActionBar {
  margin-top: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 1600px) {
  .desktop-full-width { max-width: 1600px; }
}

@media (max-width: 1180px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  #categoriesCard,
  #speciesCard,
  #historyCard,
  #measurementsCard,
  #speciesComparisonCard,
  #validationFlagsBanner,
  #publicMeasurementsCard {
    grid-column: 1;
  }
}

@media (max-width: 720px) {
  #compLeaderCards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
    overflow-x: visible;
    padding-bottom: 0;
  }

  .leader-card {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .leader-card > .flex {
    min-width: 0;
  }

  .leader-photo {
    flex: 0 0 auto;
  }
}

@media (max-width: 520px) {
  .lightbox-close {
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: 12px;
    height: 42px;
  }

  .lightbox-close__label {
    display: none;
  }
}

#publicMeasurementsCard .grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

#publicMeasurementsCard .grid > .col-span-2 {
  grid-column: auto;
  border-top: 0;
  padding-top: 0;
}

@media (max-width: 720px) {
  #publicMeasurementsCard .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  #publicMeasurementsCard .grid {
    grid-template-columns: 1fr;
  }
}

.forest-species-breakdown {
  display: grid;
  gap: 0.85rem;
}

.forest-species-summary {
  font-size: 0.75rem;
  color: #93c5fd;
  letter-spacing: 0.01em;
}

.forest-species-list {
  display: grid;
  gap: 0.75rem;
}

.forest-species-item {
  padding: 0.8rem 0.9rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.forest-species-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #f8fafc;
}

.forest-species-sci {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  font-style: italic;
  color: #cbd5e1;
}
