/* Small additions on top of the Vuexy theme for elements it has no
   ready-made component for. */

/* The markup ships English defaults; hide them until js/i18n.js has applied
   the selected language (it sets data-i18n-ready on <html>), otherwise every
   page navigation flashes English before switching. */
html:not([data-i18n-ready]) [data-i18n] {
  visibility: hidden;
}

/* Global loading bar (js/api.js LoadingBar): an indeterminate strip pinned
   to the top of the viewport while requests or page navigations are pending. */
.admin-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 2000;
  overflow: hidden;
  background: rgba(var(--bs-primary-rgb, 115, 103, 240), 0.2);
  pointer-events: none;
}

.admin-loading-bar[hidden] {
  display: none;
}

.admin-loading-bar::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 40%;
  background: var(--bs-primary, #7367f0);
  animation: admin-loading-slide 1s ease-in-out infinite;
}

@keyframes admin-loading-slide {
  from {
    left: -40%;
  }
  to {
    left: 100%;
  }
}

.current-image {
  max-width: 200px;
  max-height: 150px;
  border-radius: 0.375rem;
  border: 1px solid #d9dee3;
  object-fit: cover;
  display: block;
}

#current-image {
  margin-top: 0.5rem;
}

.zoomable-image {
  cursor: zoom-in;
}

.image-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0);
  cursor: zoom-out;
  transition: background-color 0.25s ease;
}

.image-zoom-overlay.is-open {
  background: rgba(0, 0, 0, 0.8);
}

.image-zoom-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.5);
  transform-origin: top left;
  transition: transform 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
  .image-zoom-overlay,
  .image-zoom-overlay img {
    transition: none;
  }
}

/* Analytics chart palette. Validated categorical set (dataviz skill):
   3 slots clear every CVD/contrast gate in both light and dark mode.
   Vuexy toggles dark mode via a "dark-style" class on <html>, not a
   data-theme attribute, so that's the selector used here. */
.viz-root {
  --chart-text-primary: #292929;
  --chart-text-secondary: #6f6f6f;
  --chart-grid: #e5e5e3;
  --chart-series-1: #2a78d6;
  --chart-series-2: #eb6834;
  --chart-series-3: #1baf7a;
}

html.dark-style .viz-root {
  --chart-text-primary: #e0e0e0;
  --chart-text-secondary: #b0b0c0;
  --chart-grid: #434968;
  --chart-series-1: #3987e5;
  --chart-series-2: #d95926;
  --chart-series-3: #199e70;
}

.viz-bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 56px;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.viz-bar-label {
  color: var(--chart-text-primary);
  font-size: 13px;
  font-weight: 500;
}

.viz-bar-track {
  background: var(--chart-grid);
  border-radius: 4px;
  height: 24px;
  position: relative;
  overflow: hidden;
}

.viz-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.2s ease;
}

.viz-bar-value {
  color: var(--chart-text-secondary);
  font-size: 13px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.viz-empty {
  color: var(--chart-text-secondary);
  font-size: 13px;
  padding: 8px 0;
}

.viz-table {
  width: 100%;
  font-size: 13px;
}

.viz-table th,
.viz-table td {
  padding: 4px 8px;
}

/* Localizations table: fixed layout so long translation strings never force
   the page to scroll horizontally. Each cell truncates with an ellipsis;
   the full value is still reachable via its title attribute (tooltip). */
.localizations-table {
  table-layout: fixed;
  width: 100%;
}

.localizations-table th:nth-child(1),
.localizations-table td:nth-child(1) {
  width: 20%;
}

.localizations-table th:nth-child(2),
.localizations-table td:nth-child(2),
.localizations-table th:nth-child(3),
.localizations-table td:nth-child(3),
.localizations-table th:nth-child(4),
.localizations-table td:nth-child(4) {
  width: 22%;
}

.localizations-table th:nth-child(5),
.localizations-table td:nth-child(5) {
  width: 14%;
}

.localizations-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.localizations-table td:first-child {
  font-family: var(--bs-font-monospace, monospace);
  font-size: 0.8125rem;
}

/* Directory form Subcategory/Activity pickers: a scrollable list of checkboxes
   instead of a native <select multiple>, which requires an undiscoverable
   ctrl/cmd-click to pick more than one option. */
.category-checkbox-list {
  max-height: 240px;
  overflow-y: auto;
}

.category-checkbox-list .form-check {
  padding-top: 3px;
  padding-bottom: 3px;
}

.category-checkbox-list .form-check-label {
  overflow-wrap: break-word;
}

/* Directory form companies-by-activity groups: each selected Activity gets its
   own titled, scrollable checklist so admins can tell at a glance which
   companies came from which activity instead of one long mixed list —
   important once several Subcategories/Activities are selected at once. */
.category-companies-groups {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.category-companies-group {
  border: 1px solid var(--bs-border-color, #d9dee3);
  border-radius: 0.375rem;
  padding: 0.75rem;
}

.category-companies-group-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.category-companies-group-list {
  max-height: 220px;
  overflow-y: auto;
}

.category-companies-group-list .form-check {
  padding-top: 3px;
  padding-bottom: 3px;
}

.category-companies-group-list .form-check-label {
  overflow-wrap: break-word;
}

.localizations-search {
  max-width: 360px;
}

.localizations-scope {
  width: auto;
}
