/*
(c) Spacehubs Africa. All rights reserved.
Licensed under the Proprietary License found in the LICENSE file
in the root directory of this source tree.
*/

/* Data tables page */
.table-row-hover:hover { background-color: var(--surface-muted); }
.active-pill { background-color: var(--color-sha-indigo); color: #ffffff; }
.inactive-pill { background-color: var(--surface-subtle); color: var(--text-muted); }
.btn-sha-indigo:hover { background-color: var(--color-sha-indigo-text); }
.btn-sha-green:hover { background-color: var(--color-sha-green-text); }
/* htmx adds .htmx-request to the hx-indicator target (#tab-content-area) while
   a tab/filter request is in flight, and removes it on settle or error — so the
   dimmed loading state is managed entirely by htmx, no manual class toggling. */
#tab-content-area.htmx-request {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

/* Charts panel */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1.25rem;
}
.scope-toggle input[value=""]:checked ~ .scope-toggle__pill {
  background: var(--color-sha-green);
  color: #fff;
}
.scope-toggle input[value="1"]:checked ~ .scope-toggle__pill {
  background: var(--color-sha-indigo);
  color: #fff;
}

.card {
  background: var(--surface-raised);
  border-radius: 0.75rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px 0 var(--shadow-sm);
}
.card h3 {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
#chartBar, #chartPie, #chartMap, #chartLine, #chartTopCountries {
  width: 100%;
  height: 340px;
}
#chartTopCountries { height: 220px; }
@media (min-width: 1024px) {
  #chartMap { height: 420px; }
  #chartLine { height: 260px; }
}
#chartPie {
  overflow: hidden;
  position: relative;
}
.charts-stats { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.75rem; }
.charts-stat { background: var(--surface-raised); border: 1px solid var(--border); padding: 0.5rem 0.75rem; border-radius: 0.5rem; display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.charts-stat .value { font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.charts-stat .label { font-size: 0.72rem; color: var(--text-secondary); }

.charts-rail {
  color: var(--text-primary);
}

.charts-rail .charts-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.charts-rail .charts-stat {
  min-height: 3.875rem;
  border-color: var(--border);
  border-radius: 0.75rem;
  background: var(--surface-raised);
  padding: 0.625rem 0.75rem;
  box-shadow: 0 1px 1px var(--shadow-sm);
}

.charts-rail .charts-stat .value {
  font-size: 1.05rem;
  line-height: 1;
  color: var(--text-primary);
}

.charts-rail .charts-stat .label {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.15;
}

.charts-rail .card {
  border-color: var(--border);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 2px 8px var(--shadow-sm);
}

.charts-rail .chart-card__header {
  margin-bottom: 0.875rem;
}

.charts-rail .chart-card__title {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}

.charts-rail .chart-card__description {
  color: var(--text-muted);
  line-height: 1.25;
}

.charts-rail .card-logo {
  opacity: 0.5;
}

.charts-rail .chart-skeleton {
  border-radius: 0.625rem;
  background-color: var(--surface-muted);
}

.charts-rail .chart-skeleton.loaded {
  background-color: transparent;
}

.charts-rail #chartPie,
.charts-rail #chartBar,
.charts-rail #chartTopCountries,
.charts-rail #chartTreemap {
  height: auto !important;
  min-height: 0;
}

.charts-rail #chartMap {
  height: 17rem;
}

.charts-rail .am5exporting-menu {
  opacity: 0.35;
  transform: scale(0.86);
  transform-origin: top right;
}

.charts-rail .am5exporting-menu:hover,
.charts-rail .am5exporting-menu:focus-within {
  opacity: 0.8;
}

/* chart-rank-* styles live in base.css — available globally */

/* Filter panel collapse chevrons */
#filterChevron,
#sectionFilterChevron {
    transition: transform 0.2s ease;
}
#filterChevron.is-rotated,
#sectionFilterChevron.is-rotated {
    transform: rotate(180deg);
}

@media (max-width: 1023px) {
  #mobileControlDeck #mobileSectionSelector {
    margin-bottom: 0;
  }

  #mobileControlDeck #mobileSectionTrigger {
    border-radius: 0.75rem;
    border-inline-start-width: 3px;
  }

  #mobileControlDeck #mobileFilterTrigger,
  #mobileControlDeck #mobileSectionFilterTrigger {
    min-height: 3.5rem;
    margin-bottom: 0;
    border-radius: 0.75rem;
    padding: 0.75rem;
  }

  #mobileControlDeck #mobileFilterTrigger > span:first-child,
  #mobileControlDeck #mobileSectionFilterTrigger > span:first-child {
    gap: 0.5rem;
  }

  #mobileControlDeck #mobileFilterTrigger > span:first-child > span > span:last-child,
  #mobileControlDeck #mobileSectionFilterTrigger > span:first-child > span > span:last-child {
    display: none;
  }

  #mobileControlDeck #mobileFilterTrigger > span:last-child,
  #mobileControlDeck #mobileSectionFilterTrigger > span:last-child {
    font-size: 0;
    gap: 0;
  }

  #mobileControlDeck #mobileFilterTrigger > span:last-child i,
  #mobileControlDeck #mobileSectionFilterTrigger > span:last-child i {
    font-size: 0.625rem;
  }

  #mobileControlDeck #mobileSectionFilterTrigger {
    border-left-width: 3px;
  }

  .js-mobile-filters .database-filter-form,
  .js-mobile-filters .section-filter-card {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 60;
    max-height: 85vh;
    min-height: min(30rem, 85vh);
    margin-bottom: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -24px 60px var(--shadow-md);
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .js-mobile-filters .database-filter-form.is-mobile-sheet-open,
  .js-mobile-filters .section-filter-card.is-mobile-section-sheet-open {
    transform: translateY(0);
  }

  .js-mobile-filters .database-filter-form.is-mobile-sheet-open #filterBody,
  .js-mobile-filters .section-filter-card.is-mobile-section-sheet-open #sectionFilterBody {
    display: block !important;
  }

  .js-mobile-filters .database-filter-form #filterCollapseHeader,
  .js-mobile-filters .section-filter-card #sectionFilterCollapseHeader {
    display: none;
  }

  .js-mobile-filters .database-filter-form #mobileFilterSheetHeader,
  .js-mobile-filters .section-filter-card #mobileSectionFilterSheetHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .js-mobile-filters .database-filter-form #filterCard,
  .js-mobile-filters .section-filter-card {
    border-inline-start-width: 1px;
    box-shadow: none;
  }
}

/* Toggle switch + amCharts export menu styles live in base.css */
