/* ==========================================================================
   TrimFile Custom Dropdown Suite
   Container-contained, sleek dark neon glassmorphism for all select dropdowns
   ========================================================================== */

.tf-custom-select-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.tf-select-trigger {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 14px;
  background-color: rgba(6, 15, 10, 0.85);
  border: 1px solid rgba(225, 29, 72, 0.28);
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  outline: none;
  overflow: hidden;
}

.tf-select-trigger:hover,
.tf-select-trigger:focus-visible,
.tf-select-trigger.active {
  border-color: #e11d48;
  box-shadow: 0 0 14px rgba(225, 29, 72, 0.28);
  background-color: rgba(12, 20, 16, 0.95);
}

.tf-select-trigger.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.tf-select-trigger-content {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.tf-select-trigger-label {
  font-weight: 700;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  min-width: 0;
}

.tf-select-trigger-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: #fda4af;
  background: rgba(225, 29, 72, 0.16);
  border: 1px solid rgba(225, 29, 72, 0.32);
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.tf-select-arrow {
  color: #fda4af;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
  flex-shrink: 0;
  margin-left: 6px;
}

.tf-select-trigger.active .tf-select-arrow {
  transform: rotate(180deg);
  color: #ffffff;
}

.tf-select-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(9, 14, 21, 0.98);
  border: 1px solid rgba(225, 29, 72, 0.45);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.85), 0 0 20px rgba(225, 29, 72, 0.22);
  border-radius: 10px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(225, 29, 72, 0.4) transparent;
}

.tf-select-menu.flip-up {
  top: auto;
  bottom: calc(100% + 5px);
}

.tf-select-menu.open {
  display: flex;
  animation: tfDropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tfDropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tf-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid transparent;
  user-select: none;
  width: 100%;
  box-sizing: border-box;
}

.tf-select-item:hover,
.tf-select-item.highlighted {
  background: rgba(225, 29, 72, 0.12);
  border-color: rgba(225, 29, 72, 0.28);
  color: #ffffff;
}

.tf-select-item.selected {
  background: rgba(225, 29, 72, 0.24);
  border-color: rgba(225, 29, 72, 0.5);
  color: #ffffff;
  font-weight: 600;
}

.tf-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.tf-item-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
}

.tf-item-desc {
  font-size: 0.72rem;
  color: #fda4af;
  font-weight: 500;
  line-height: 1.25;
}

.tf-item-check {
  opacity: 0;
  color: #e11d48;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
  margin-left: 10px;
}

.tf-select-item.selected .tf-item-check {
  opacity: 1;
}

/* Visually hide native select without breaking form or JS logic */
select.tf-hidden-native-select {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
}


/* Global Safeguards: Ensure all grid fields & custom dropdowns remain inside containers on mobile */
@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr !important;
  }
  .grid-2 > .field,
  .grid-2 > div,
  .field-full,
  [style*="grid-column: span 2"] {
    grid-column: span 1 !important;
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }
}
