:root {
  --bulma-scheme-h: 150;
  --bulma-scheme-s: 10%;
  --primary: #4CAF50;
  --primary-light: #81C784;
  --primary-dark: #2E7D32;
  --background: #1a1a2e;
  --surface: #16213e;
  --surface-light: #1f2b47;
  --text: #e8e8e8;
  --text-secondary: #a0aec0;
  --text-muted: #6b7a8d;
  --accent: #FF9800;
  --border: #2d3a52;
}

html, html[data-theme="dark"], html[data-theme="light"] {
  background-color: var(--background) !important;
  color-scheme: dark;
  --bulma-body-background-color: var(--background);
  --bulma-scheme-main: var(--background);
  --bulma-scheme-main-bis: var(--surface);
  --bulma-scheme-main-ter: var(--surface-light);
  --bulma-text: var(--text);
  --bulma-text-strong: var(--text);
}

html {
  scroll-behavior: smooth;
}

body {
  padding-top: 3.25rem;
  color: var(--text);
}

@media (min-width: 1024px) {
  body {
    padding-top: 4rem;
  }

  [id^="section-"] {
    scroll-margin-top: 7.5rem;
  }

  .section-nav {
    top: 4rem;
  }
}

/* Desktop plant header: 2-column layout */
.plant-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .plant-header {
    grid-template-columns: 2fr 3fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 1rem;
  }

  .plant-hero-image {
    border-radius: 8px;
    overflow: hidden;
  }

  .plant-meta .box {
    margin-top: 0 !important;
  }

  .seasonality-map-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
  }

  .seasonality-map-row > div {
    margin-top: 0 !important;
  }
}


/* Grouped observations */

details summary {
  list-style: none;
}
details summary::-webkit-details-marker {
  display: none;
}
details summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.6rem;
  transition: transform 0.2s;
  vertical-align: middle;
}
details[open] summary::before {
  transform: rotate(90deg);
}

/* Bookmark cards */

.bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bookmark-item {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.bookmark-link {
  display: flex;
  align-items: center;
  flex: 1;
  padding: 0.6rem 0.75rem;
  gap: 0.75rem;
  text-decoration: none;
  min-width: 0;
}

.bookmark-thumb {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-light);
}

.bookmark-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bookmark-thumb-empty {
  width: 100%;
  height: 100%;
  background: var(--surface-light);
}

.bookmark-info {
  flex: 1;
  min-width: 0;
}

.bookmark-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
}

.bookmark-sci {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bookmark-secondary {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bookmark-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.saved-panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border-radius: 999px;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.45rem;
  vertical-align: middle;
  margin-left: 0.5rem;
  line-height: 1;
}

.bookmark-notes-badge {
  font-size: 0.65rem;
  background: rgba(76, 175, 80, 0.15);
  color: var(--primary);
  border-radius: 4px;
  padding: 0 0.3rem;
  line-height: 1.5;
}

.bookmark-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.75rem 0.6rem;
  font-size: 0.75rem;
  flex-shrink: 0;
  line-height: 1;
}

.bookmark-remove:hover {
  color: var(--text);
}

@media (min-width: 1024px) {
  .bookmarks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
  }

  .bookmark-item {
    flex-direction: column;
    align-items: stretch;
    border-radius: 8px;
  }

  .bookmark-link {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
  }

  .bookmark-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 4/3;
    border-radius: 0;
    flex-shrink: unset;
  }

  .bookmark-info {
    padding: 0.6rem 0.75rem 0.5rem;
  }

  .bookmark-name {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: unset;
    font-size: 0.85rem;
  }

  .bookmark-remove {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    width: 1.4rem;
    height: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: white;
    font-size: 0.65rem;
  }

  .bookmark-remove:hover {
    background: rgba(0, 0, 0, 0.8);
    color: white;
  }
}

/* Star bookmark button */
.plant-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.1s;
}

.plant-star-btn:hover {
  color: var(--accent);
  transform: scale(1.15);
}

.plant-star-btn.is-saved {
  color: var(--accent);
}

/* Navbar search */
.navbar-search-wrapper {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

[id^="section-"] {
  scroll-margin-top: 7rem;
}

.section-nav {
  position: sticky;
  top: 3.25rem;
  z-index: 5;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  background: var(--background);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.section-nav a {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  white-space: nowrap;
  background: var(--surface-light);
  color: var(--text-secondary) !important;
  text-decoration: none;
  border: 1px solid var(--border);
  transition: background 0.2s, color 0.2s;
}

.section-nav a:hover {
  background: var(--primary);
  color: white !important;
  border-color: var(--primary);
}

html[data-theme="dark"] nav.navbar,
html[data-theme="dark"] .navbar {
  --bulma-navbar-background-color: #16213e !important;
  background-color: #16213e !important;
  border-bottom: 1px solid #2d3a52;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3) !important;
}

.navbar-brand .navbar-item {
  color: var(--primary) !important;
}

.navbar-item {
  color: var(--text-secondary) !important;
}

.title, .subtitle {
  overflow-wrap: break-word;
  word-break: break-word;
}

.title {
  color: var(--text) !important;
}

.subtitle {
  color: var(--text-secondary) !important;
}

.input, .textarea, .select select {
  background-color: var(--surface-light) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-muted) !important;
}

.box {
  background-color: var(--surface) !important;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}

.button.is-outlined {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

@media (hover: hover) {
  .button.is-outlined:hover {
    background-color: var(--primary) !important;
    color: white !important;
  }
}

.button.is-success {
  background-color: var(--primary-dark) !important;
  color: white !important;
}

.button.is-small.is-text {
  color: var(--text-secondary) !important;
}

.notification.is-danger.is-light {
  background-color: #3b1c1c !important;
  color: #ff8a80 !important;
}

a:not(.button):not(.navbar-item):not(.dropdown-item) {
  color: var(--primary-light);
}

/* Location search */

.location-search-dropdown .dropdown-item {
  display: block;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}

.location-search-dropdown .dropdown-item:hover {
  background: var(--surface-light);
}

/* Autocomplete */

.autocomplete-results {
  position: absolute;
  z-index: 10;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  max-height: 320px;
  overflow-y: auto;
  display: none;
}

.autocomplete-results.is-active {
  display: block;
}

.autocomplete-results .dropdown-item {
  display: block;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.autocomplete-results .dropdown-item:hover {
  background: var(--surface-light);
}

.autocomplete-results .dropdown-item strong {
  color: var(--text);
}

.autocomplete-results .dropdown-item small {
  color: var(--text-secondary) !important;
}

.field {
  position: relative;
}

/* Seasonality */

.seasonality-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.seasonality-row.is-current {
  font-weight: 700;
}

.seasonality-row.is-current .seasonality-bar {
  background-color: var(--accent);
}

.seasonality-row.is-current .seasonality-label,
.seasonality-row.is-current .seasonality-value {
  color: var(--accent);
}

.seasonality-label {
  width: 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.seasonality-bar-track {
  flex: 1;
  height: 1rem;
  background: var(--surface-light);
  border-radius: 4px;
  overflow: hidden;
}

.seasonality-bar {
  height: 100%;
  background-color: var(--primary);
  border-radius: 4px;
  transition: width 0.4s ease-out;
}

.seasonality-value {
  width: 2.5rem;
  font-size: 0.75rem;
  text-align: right;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Map / Leaflet dark theme */

[data-map-target="container"] {
  position: relative;
  z-index: 0;
}

.leaflet-container {
  background: var(--surface-light) !important;
}

.leaflet-control-attribution {
  background-color: rgba(22, 33, 62, 0.85) !important;
  color: var(--text-muted) !important;
}

.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

.leaflet-control-zoom a {
  background-color: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.leaflet-control-zoom a:hover {
  background-color: var(--surface-light) !important;
}

/* Toast */

.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  background: var(--primary-dark);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.875rem;
  z-index: 100;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
}

.toast.is-active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Gallery */

.gallery-tabs ul {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.gallery-tabs li a {
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--text-secondary) !important;
  border-color: var(--border) !important;
}

.gallery-tabs li.is-active a {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: white !important;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
}

.gallery-item {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
}

.gallery-item:has(.gallery-item-meta) {
  aspect-ratio: unset;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.gallery-item:has(.gallery-item-meta) img {
  aspect-ratio: 1;
  border-radius: 6px 6px 0 0;
}

.gallery-item-meta {
  background: white;
  border-radius: 0 0 6px 6px;
  padding: 0.25rem 0.4rem;
}

.gallery-item-date {
  font-size: 0.68rem;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-item-place {
  font-size: 0.6rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

.gallery-item.skeleton {
  background: linear-gradient(90deg, var(--surface-light) 25%, var(--border) 50%, var(--surface-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-block {
  background: linear-gradient(90deg, var(--surface-light) 25%, var(--border) 50%, var(--surface-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

/* Mine photos section */

.mine-photos-section {
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.mine-photos-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
}

/* Lightbox */

.lightbox-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  color: white;
  cursor: pointer;
  padding: 0.5rem;
  user-select: none;
  z-index: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.lightbox-prev { left: -3rem; }
.lightbox-next { right: -3rem; }

@media (max-width: 767px) {
  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
}

.lightbox-caption {
  text-align: center;
  color: white;
  font-size: 0.75rem;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  margin-top: 0.5rem;
  padding: 0 0.5rem;
}

.lightbox-obs-link {
  display: block;
  margin-top: 0.35rem;
  color: #81C784;
  font-size: 0.75rem;
  text-decoration: none;
}

.lightbox-obs-link:hover {
  text-decoration: underline;
  color: #a5d6a7;
}

/* Bookmarks page */

.media-content a {
  color: var(--text) !important;
}

.media-content small.has-text-grey {
  color: var(--text-secondary) !important;
}

.tag.is-info.is-light {
  background-color: rgba(76, 175, 80, 0.15) !important;
  color: var(--primary-light) !important;
}

/* Plant info text */

.has-text-grey {
  color: var(--text-secondary) !important;
}

.has-text-grey-light {
  color: var(--text-muted) !important;
}

p, .content {
  color: var(--text);
}

/* Sounds */

.sound-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.sound-item:last-child { border-bottom: none; }

.sound-info { flex: 1; min-width: 0; }

.sound-type {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: capitalize;
}

.sound-meta { margin-top: 0.15rem; }


.sound-play-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.sound-play-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-primary);
}
.sound-play-btn:hover { border-color: #4CAF50; color: #4CAF50; }

/* Notes */

.notes-card {
  background-color: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}
