/* ========================================================
   RMD Unified Custom Dropdown System (.rmd-cs)
   Works identically on Frontend & WP Admin screens
   ======================================================== */

.rmd-cs-native {
  position: absolute !important;
  left: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  border: 0 !important;
  overflow: hidden !important;
}

.rmd-cs {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  vertical-align: middle;
}

.rmd-cs.rmd-cs--inline {
  width: auto;
  max-width: 100%;
}

.rmd-cs-trigger {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 12px 9px 14px;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  color: #0f172a;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
  box-sizing: border-box;
}

.rmd-cs-trigger:hover {
  border-color: #94a3b8;
  background-color: #f8fafc;
}

.rmd-cs-trigger:focus,
.rmd-cs.is-open .rmd-cs-trigger {
  outline: none;
  border-color: #003178;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 49, 120, 0.12);
}

/* Compact Pill Variant (e.g. Cohort / Course Switcher) */
.rmd-cs--compact .rmd-cs-trigger {
  min-height: 34px;
  padding: 6px 10px 6px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #003178;
}

.rmd-cs--compact .rmd-cs-trigger:hover {
  background-color: #dbeafe;
  border-color: #93c5fd;
}

.rmd-cs--compact.is-open .rmd-cs-trigger,
.rmd-cs--compact .rmd-cs-trigger:focus {
  background-color: #ffffff;
  border-color: #003178;
  box-shadow: 0 0 0 3px rgba(0, 49, 120, 0.12);
}

/* WP Admin Variant */
body.wp-admin .rmd-cs {
  max-width: 100%;
}

body.wp-admin .rmd-cs-trigger {
  min-height: 36px;
  padding: 6px 10px 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

body.wp-admin .tablenav .rmd-cs-trigger,
body.wp-admin .rmd-cohort-card .rmd-cs-trigger,
body.wp-admin table .rmd-cs-trigger {
  min-height: 31px;
  padding: 4px 9px 4px 10px;
  border-radius: 7px;
  font-size: 12.5px;
}

.rmd-cs-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rmd-cs-chevron {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: #64748b;
  transition: transform 0.18s ease, color 0.16s ease;
}

.rmd-cs--compact .rmd-cs-chevron {
  color: #003178;
}

.rmd-cs.is-open .rmd-cs-chevron {
  transform: rotate(180deg);
  color: #003178;
}

/* Floating Portaled Dropdown Panel */
.rmd-cs-menu {
  position: fixed;
  z-index: 999999;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 18px 42px -10px rgba(15, 23, 42, 0.2), 0 4px 14px -2px rgba(15, 23, 42, 0.07);
  padding: 6px;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  opacity: 0;
  transform: translateY(-3px) scale(0.99);
  transition: opacity 0.09s ease, transform 0.09s ease;
  pointer-events: none;
}

.rmd-cs-menu.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.rmd-cs-search-wrap {
  position: relative;
  padding: 2px 2px 6px 2px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 4px;
}

.rmd-cs-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-62%);
  width: 14px;
  height: 14px;
  color: #94a3b8;
  pointer-events: none;
}

.rmd-cs-search {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px 6px 30px;
  font-size: 12.5px;
  font-family: inherit;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background-color: #f8fafc;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.rmd-cs-search:focus {
  border-color: #003178;
  background-color: #ffffff;
}

.rmd-cs-list {
  max-height: 256px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1px;
}

.rmd-cs-list::-webkit-scrollbar {
  width: 6px;
}

.rmd-cs-list::-webkit-scrollbar-track {
  background: transparent;
}

.rmd-cs-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

.rmd-cs-opt {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  color: #1e293b;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  box-sizing: border-box;
}

.rmd-cs-opt:hover,
.rmd-cs-opt.is-highlighted {
  background-color: #f1f5f9;
  color: #0f172a;
}

.rmd-cs-opt.is-selected {
  background-color: #eff6ff;
  color: #002663;
  font-weight: 700;
}

.rmd-cs-opt.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.rmd-cs-opt-text {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.rmd-cs-check {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  color: #003178;
}

.rmd-cs-empty {
  padding: 12px 10px;
  text-align: center;
  font-size: 12px;
  color: #64748b;
}

/* Ensure native select disabled states reflect on custom trigger */
.rmd-cs.is-disabled .rmd-cs-trigger {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #f1f5f9;
}
