/* Index header layout */
.crudite-index-header {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
}
.crudite-index-header .model-tools-dropdown {
  display: none !important;
}
.crudite-index-header .model-tools-inline {
  display: inline-flex !important;
}
.crudite-index-header .model-views-dropdown {
  display: none !important;
}
.crudite-index-header .model-views-inline {
  display: inline-flex !important;
}
.crudite-index-header .title-tools {
  flex: 0 0 auto;
  min-width: 0;
}
.crudite-index-header .crudite-search {
  flex: 1 1 auto;
  min-width: 240px;
  max-width: 640px;
}

@media (max-width: 767.98px) {
  .crudite-index-header {
    flex-wrap: wrap;
  }
  .crudite-index-header .crudite-search {
    flex: 1 1 100%;
    min-width: 0;
    max-width: none;
  }
  .crudite-index-header .model-tools-inline {
    display: none !important;
  }
  .crudite-index-header .model-views-inline {
    display: none !important;
  }
  .crudite-index-header .model-tools-dropdown {
    display: inline-block !important;
  }
}

.crudite-index-header.has-query .model-tools-inline {
  display: inline-flex !important;
}
.crudite-index-header.has-query .model-tools-dropdown {
  display: none !important;
}
.crudite-index-header.has-query .model-views-inline {
  display: inline-flex !important;
}
.crudite-index-header.has-query .model-views-dropdown {
  display: none !important;
}
.crudite-index-header.has-query .crudite-search {
  flex: 1 1 auto !important;
  min-width: 240px !important;
  max-width: 640px !important;
}
@media (max-width: 767.98px) {
  .crudite-index-header.has-query .crudite-search {
    flex: 1 1 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }
  .crudite-index-header.has-query .model-tools-inline {
    display: none !important;
  }
  .crudite-index-header.has-query .model-views-inline {
    display: none !important;
  }
  .crudite-index-header.has-query .model-tools-dropdown {
    display: inline-block !important;
  }
}

/* Search input with overlaid magnifying glass icon */
.crudite-search-input-wrapper {
  position: relative;
}
.crudite-search-input-wrapper .crudite-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bs-secondary-color);
  pointer-events: none;
  z-index: 2;
}
.crudite-search-input-wrapper .crudite-search-input.form-control {
  padding-left: 2rem;
  padding-right: 2rem;
}
.crudite-search-input-wrapper .crudite-search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bs-secondary-color);
  text-decoration: none;
  z-index: 2;
}

/* Lightweight hover effect for add (+) icons inside Crudite dropdowns */
.crudite-plus-btn {
  opacity: 0.3;
  transform: scale(0.8);
  transition: opacity 120ms ease, transform 120ms ease, color 120ms ease;
}
.crudite-plus-btn:hover {
  opacity: 1;
  transform: scale(1);
  color: white;
}

.crudite-mono {
  font-size: 0.875em;
  font-family: var(--bs-font-monospace);
}

.crudite-description {
}

.crudite-json {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.avatar-auto {
  display: inline-block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.crudite-icon img,
.crudite-icon svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.card > .table.report-table:first-child,
.card > .table-responsive > .table.report-table:first-child {
  border-top-left-radius: var(
    --bs-card-inner-border-radius,
    var(--bs-border-radius)
  );
  border-top-right-radius: var(
    --bs-card-inner-border-radius,
    var(--bs-border-radius)
  );
}

.card
  > .table.report-table:first-child
  > :where(thead, tbody, tfoot)
  > tr:first-child
  > :is(th, td),
.card
  > .table-responsive
  > .table.report-table:first-child
  > :where(thead, tbody, tfoot)
  > tr:first-child
  > :is(th, td) {
  border-top: 0;
}

.card > .table.report-table:first-child > tbody > tr:first-child > :first-child,
.card
  > .table-responsive
  > .table.report-table:first-child
  > tbody
  > tr:first-child
  > :first-child {
  border-top-left-radius: var(
    --bs-card-inner-border-radius,
    var(--bs-border-radius)
  );
}
.card > .table.report-table:first-child > tbody > tr:first-child > :last-child,
.card
  > .table-responsive
  > .table.report-table:first-child
  > tbody
  > tr:first-child
  > :last-child {
  border-top-right-radius: var(
    --bs-card-inner-border-radius,
    var(--bs-border-radius)
  );
}

.crudite-table a {
  color: inherit;
  text-decoration: none;
}
a.crudite-primary-link,
.crudite-table a.crudite-primary-link {
  color: var(--bs-link-color, #6ea8fe);
}
a.crudite-primary-link:hover,
.crudite-table a.crudite-primary-link:hover {
  color: var(--bs-link-hover-color, #9ec5fe);
  text-decoration: underline;
}
.crudite-table {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.crudite-quick-actions a {
  color: var(--bs-secondary-color);
}
.crudite-quick-actions a:hover,
.crudite-quick-actions a:focus {
  color: var(--bs-body-color);
}

.crudite-col-key {
  width: 24%;
  min-width: 200px;
}

.crudite-col-value {
  width: 76%;
}

@media (max-width: 576px) {
  .crudite-col-key {
    width: 35%;
    min-width: 120px;
  }
  .crudite-col-value {
    width: 65%;
  }
}

.crudite-history-table {
  table-layout: fixed;
}

.crudite-danger {
  border: 2px solid #dc3545;
  background-color: #3a0a0e;
  padding: 8px;
  border-radius: 6px;
}
.crudite-danger .table.report-table td.bold {
  color: #dc3545;
}
.crudite-danger input,
.crudite-danger select,
.crudite-danger textarea {
  border-color: #dc3545;
}

.crudite-table .badge {
  white-space: normal;
}

.crudite-picker-dropdown {
  min-width: 16rem;
  max-width: 24rem;
  overflow: hidden;
}

.crudite-picker-scroll {
  max-height: min(50vh, 24rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.crudite-picker-search {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bs-dropdown-bg, #fff);
}

.crudite-picker-info {
  opacity: 0.4;
  font-size: 0.75em;
  cursor: help;
  flex-shrink: 0;
}
.crudite-picker-info:hover {
  opacity: 1;
}

@media (max-width: 576px) {
  .crudite-picker-dropdown {
    min-width: 90vw;
    max-width: 95vw;
  }
  .crudite-picker-scroll {
    max-height: 60vh;
  }
}
