/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Flash lives outside Components::Layout, so the authenticated bottom landmark is its clearance signal. */
@media (width < 64rem) {
  body:has([data-bottom-navigation]) [data-flash-frame] {
    bottom: calc(5rem + 1px + env(safe-area-inset-bottom));
  }
}

/* A single shared grid track must shrink below the longest data value. */
.scrm-single-column-grid {
  grid-template-columns: minmax(0, 1fr);
}

/* Tom Select structural styles, tuned to sCRM rather than an upstream theme. */
.ts-hidden-accessible {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.ts-wrapper {
  position: relative;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.ts-control {
  position: relative;
  display: flex;
  min-height: 2.625rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  align-items: center;
  gap: 0.375rem;
  border: 1px solid rgb(214 211 209);
  border-radius: 0.5rem;
  background: rgb(255 255 255);
  padding: 0.625rem 2.5rem 0.625rem 0.75rem;
  color: rgb(12 10 9);
  font-size: 0.875rem;
  line-height: 1.25rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  cursor: text;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.ts-control > .item {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ts-control > input {
  min-width: 2rem;
  max-width: 100%;
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  line-height: inherit;
  box-shadow: none;
}

.ts-wrapper.single .ts-control::after {
  content: "";
  position: absolute;
  top: var(--scrm-select-arrow-top, 50%);
  right: var(--scrm-select-arrow-right, 0.875rem);
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.55;
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
  transform-origin: center;
  transition: transform 150ms ease;
}

.ts-wrapper.single.dropdown-active .ts-control::after {
  transform: translateY(-35%) rotate(225deg);
}

.ts-wrapper:focus,
.ts-control:focus,
.ts-control > input:focus {
  outline: none;
}

.ts-wrapper.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ts-wrapper.disabled .ts-control {
  cursor: not-allowed;
}

.ts-dropdown {
  position: absolute;
  z-index: 50;
  top: calc(100% + 0.375rem);
  left: 0;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgb(214 211 209);
  border-radius: 0.75rem;
  background: rgb(255 255 255);
  color: rgb(28 25 23);
  font-size: 0.875rem;
  line-height: 1.25rem;
  box-shadow: 0 12px 28px rgb(28 25 23 / 0.14);
}

.ts-dropdown-content {
  max-height: 16rem;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.375rem;
  scroll-behavior: smooth;
}

.ts-wrapper.scrm-select .dropdown-input-wrap {
  padding: 0.5rem 0.5rem 0;
}

.ts-wrapper.scrm-select .dropdown-input {
  display: block;
  box-sizing: border-box;
  height: 2.625rem;
  width: 100%;
  border: 1px solid rgb(214 211 209);
  border-radius: 0.5rem;
  background: rgb(250 250 249);
  padding: 0.625rem 0.75rem;
  color: rgb(12 10 9);
  font: inherit;
  line-height: 1.25rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.ts-wrapper.scrm-select .dropdown-input::placeholder {
  color: rgb(168 162 158);
}

.ts-dropdown .option,
.ts-dropdown .no-results {
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
}

.ts-dropdown .option {
  cursor: pointer;
}

.ts-dropdown .option.active {
  background: rgb(236 253 245);
  color: rgb(6 95 70);
}

.ts-dropdown .option.selected {
  font-weight: 600;
}

.ts-dropdown .no-results {
  color: rgb(120 113 108);
  cursor: default;
}

.ts-wrapper.scrm-select--organization .ts-control {
  --scrm-select-arrow-right: 0.75rem;
  --scrm-select-arrow-top: 50%;
  min-height: 2.25rem;
  border-color: rgb(231 229 228);
  background: rgb(250 250 249);
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  color: rgb(28 25 23);
  font-weight: 600;
  box-shadow: none;
}

.dark .ts-control {
  border-color: rgb(68 64 60);
  background: rgb(12 10 9);
  color: rgb(255 255 255);
}

.dark .ts-dropdown {
  border-color: rgb(68 64 60);
  background: rgb(28 25 23);
  color: rgb(245 245 244);
  box-shadow: 0 12px 28px rgb(0 0 0 / 0.4);
}

.dark .ts-dropdown .option.active {
  background: rgb(6 78 59);
  color: rgb(209 250 229);
}

.dark .ts-dropdown .no-results {
  color: rgb(168 162 158);
}

.dark .ts-wrapper.scrm-select .dropdown-input {
  border-color: rgb(68 64 60);
  background: rgb(12 10 9);
  color: rgb(255 255 255);
}

.dark .ts-wrapper.scrm-select .dropdown-input::placeholder {
  color: rgb(120 113 108);
}

.dark .ts-wrapper.scrm-select--organization .ts-control {
  border-color: rgb(68 64 60);
  background: rgb(28 25 23);
  color: rgb(245 245 244);
}

/* Focus comes after every theme and variant base rule so the replacement for the native outline always wins. */
.ts-wrapper.focus .ts-control,
.ts-wrapper.scrm-select--organization.focus .ts-control {
  outline: none;
  border-color: rgb(16 185 129);
  box-shadow: 0 0 0 2px rgb(16 185 129 / 0.2);
}

.ts-wrapper.scrm-select .dropdown-input:focus {
  outline: none;
  border-color: rgb(16 185 129);
  box-shadow: 0 0 0 2px rgb(16 185 129 / 0.2);
}

/* Invalid is the final state in the cascade and must stay red while focused in every variant and theme. */
.ts-wrapper.scrm-select.scrm-select--invalid .ts-control {
  border-color: rgb(239 68 68);
}

.ts-wrapper.scrm-select.scrm-select--invalid.focus .ts-control {
  border-color: rgb(239 68 68);
  box-shadow: 0 0 0 2px rgb(239 68 68 / 0.2);
}
