/**
 * Dropdown Component Styles
 * Matches CodeSignal Design System - Light Mode Default Toggle
 */

:root {
  /* Colors - Light Mode */
  --Colors-Dropdown-Toggle-Text: var(--Colors-Text-Body-Medium);
  --Colors-Dropdown-Icon: var(--Colors-Base-Neutral-800);
  --Colors-Dropdown-Icon-Hover: var(--Colors-Icon-Medium);
  --Colors-Dropdown-Icon-Active: var(--Colors-Icon-Primary);
  --Colors-Dropdown-Panel: var(--Colors-Backgrounds-Main-Top);
  --Colors-Dropdown-Panel-Stroke: var(--Colors-Stroke-Default);
  --Colors-Dropdown-Toggle: var(--Colors-Backgrounds-Main-Top);
  --Colors-Dropdown-Toggle-Background: var(--Colors-Backgrounds-Main-Top);
  --Colors-Dropdown-Toggle-Stroke: var(--Colors-Stroke-Default);
  --Colors-Dropdown-Toggle-Hover: var(--Colors-Backgrounds-Main-Top);
  --Colors-Dropdown-Toggle-Hover-Border: var(--Colors-Stroke-Medium);
  --Colors-Dropdown-Panel-Stroke-Hover: var(--Colors-Stroke-Medium);
  --Colors-Shadow-Float: rgba(22, 44, 96, 0.12);
  --Colors-Shadow-Medium-Soft: rgba(22, 44, 96, 0.12);
  --Colors-Menu-Option-Hover: var(--Colors-Base-Neutral-20);
  --Colors-Menu-Option-Background: var(--Colors-Backgrounds-Main-Top);
  --Colors-Menu-Option-Background-Selected: var(--Colors-Primary-Lightest);
  --Colors-Menu-Tab-Active: var(--Colors-Backgrounds-Main-Top);
  
  /* Spacing */
  --Menu-Item-Padding-Horizontal: var(--UI-Spacing-spacing-mxs);
  
  /* Radius */
  --Menu-Item-Roundness: var(--UI-Radius-radius-s);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    /* Colors - Dark Mode */
    --Colors-Dropdown-Toggle-Text: var(--Colors-Text-Body-Default);
    --Colors-Dropdown-Icon-Hover: var(--Colors-Icon-Medium);
    --Colors-Dropdown-Icon-Active: var(--Colors-Icon-Primary);
    --Colors-Dropdown-Panel: var(--Colors-Backgrounds-Main-Medium);
    --Colors-Dropdown-Panel-Stroke: rgba(45, 56, 85, 0.00);
    --Colors-Dropdown-Toggle: var(--Colors-Base-Neutral-1200);
    --Colors-Dropdown-Toggle-Background: var(--Colors-Backgrounds-Main-Medium);
    --Colors-Dropdown-Toggle-Stroke: rgba(45, 56, 85, 0.00);
    --Colors-Dropdown-Toggle-Hover: var(--Colors-Base-Neutral-1050);
    --Colors-Dropdown-Toggle-Hover-Border: rgba(193, 199, 215, 0.35);
    --Colors-Dropdown-Panel-Stroke-Hover: var(--Colors-Stroke-Strong);
    --Colors-Shadow-Float: rgba(13, 21, 40, 0.3);
    --Colors-Shadow-Medium-Soft: rgba(13, 21, 40, 0.4);
    --Colors-Menu-Option-Hover: rgba(193, 199, 215, 0.1);
    --Colors-Menu-Option-Background: var(--Colors-Backgrounds-Main-Medium);
    --Colors-Menu-Option-Background-Selected: var(--Colors-Base-Neutral-1050);
    --Colors-Menu-Tab-Active: var(--Colors-Text-Body-Strong);
  }
}

.dropdown-container {
  position: relative;
  display: inline-block;
  width: 100%;
}

.dropdown-container.grow-to-fit {
  width: auto;
  min-width: 200px;
}

/* Toggle Button */
.dropdown-toggle {
  width: 100%;
  height: var(--UI-Input-sm);
  background: var(--Colors-Dropdown-Toggle) !important;
  border: 1px solid var(--Colors-Dropdown-Toggle-Stroke) !important;
  border-radius: var(--UI-Radius-radius-s) !important;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: "Work Sans", ui-sans-serif, system-ui, sans-serif;
  box-shadow: 0px 2px 3px 0px var(--Colors-Shadow-Medium-Soft);
}

.dropdown-toggle:hover {
  background: var(--Colors-Dropdown-Toggle-Hover) !important;
  border-color: var(--Colors-Dropdown-Panel-Stroke-Hover) !important;
  box-shadow: 0 2px 8px rgba(76, 90, 123, 0.08);
}

.dropdown-toggle:focus {
  outline: none;
}

.dropdown-toggle:focus-visible {
  outline: 2px solid var(--Colors-Primary-Medium);
  outline-offset: 2px;
}

.dropdown-toggle-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--UI-Spacing-spacing-mxs);
  height: 100%;
  padding: var(--UI-Spacing-spacing-mxs) var(--UI-Spacing-spacing-mxs) var(--UI-Spacing-spacing-mxs) var(--UI-Spacing-spacing-ms);
  box-sizing: border-box;
}

.dropdown-toggle-label {
  flex: 1;
  text-align: left;
  font-weight: 500;
  vertical-align: middle;
  color: var(--Colors-Dropdown-Toggle-Text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

.dropdown-container.grow-to-fit .dropdown-toggle-label {
  overflow: visible;
  text-overflow: clip;
}

.dropdown-toggle:hover .dropdown-toggle-label {
  color: var(--Colors-Text-Body-Strong);
}

.dropdown-container.open .dropdown-toggle-label {
  color: var(--Colors-Text-Body-Strong);
}

.dropdown-toggle-icon {
  display: block;
  flex-shrink: 0;
  width: var(--UI-Spacing-spacing-ml);
  height: var(--UI-Spacing-spacing-ml);
  position: relative;
}

.dropdown-toggle-icon svg {
  display: block;
  width: 10px;
  height: 5px;
  position: absolute;
  top: 7.5px;
  left: 5px;
}

.dropdown-toggle-icon svg path {
  transition: stroke 0.2s ease;
}

.dropdown-toggle:hover .dropdown-toggle-icon svg path {
  stroke: var(--Colors-Dropdown-Icon-Hover);
}

.dropdown-container.open .dropdown-toggle-icon svg path {
  stroke: var(--Colors-Dropdown-Icon-Active);
}

/* Dropdown Menu Panel */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 240px;
  height: auto;
  max-height: 284px;
  background: var(--Colors-Dropdown-Panel);
  border: 1px solid var(--Colors-Dropdown-Panel-Stroke);
  border-radius: var(--UI-Radius-radius-s);
  box-shadow: 0px 12px 38px 0px var(--Colors-Shadow-Float);
  z-index: 1000;
  display: none;
  overflow: visible;
  opacity: 1;
}

.dropdown-container.grow-to-fit .dropdown-menu {
  width: 100%;
  min-width: 200px;
}

.dropdown-container.open .dropdown-menu {
  display: block;
}

.dropdown-menu-list {
  display: flex;
  flex-direction: column;
  gap: var(--UI-Spacing-spacing-xxs);
  padding: var(--UI-Spacing-spacing-mxs);
  overflow-y: visible;
}

/* Menu Items */
.dropdown-menu-item {
  display: flex;
  align-items: center;
  width: 216px;
  height: 40px !important;
  min-height: 40px !important;
  flex-shrink: 0 !important;
  padding: var(--UI-Spacing-spacing-none) var(--Menu-Item-Padding-Horizontal) !important;
  gap: var(--UI-Spacing-spacing-s);
  background: var(--Colors-Dropdown-Panel) !important;
  border: none !important;
  border-radius: var(--Menu-Item-Roundness) !important;
  cursor: pointer;
  font-family: "Work Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: -0.24px;
  color: var(--Colors-Text-Body-Default);
  text-align: left;
  transition: background-color 0.15s ease;
  box-sizing: border-box;
  opacity: 1;
}

.dropdown-container.grow-to-fit .dropdown-menu-item {
  width: 100%;
  min-width: 216px;
}

.dropdown-menu-item:hover:not(.selected) {
  background: var(--Colors-Menu-Option-Hover) !important;
}

.dropdown-menu-item:focus {
  outline: 2px solid var(--Colors-Primary-Medium);
  outline-offset: -2px;
}

.dropdown-menu-item.selected {
  width: 216px;
  height: 40px;
  border-radius: var(--Menu-Item-Roundness);
  padding: var(--UI-Spacing-spacing-none) var(--Menu-Item-Padding-Horizontal) !important;
  gap: var(--UI-Spacing-spacing-s);
  opacity: 1;
  background: var(--Colors-Menu-Option-Background-Selected) !important;
  font-family: "Work Sans", ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -0.24px;
  color: var(--Colors-Text-Body-Strong) !important;
}

.dropdown-menu-item.selected .dropdown-menu-item-label {
  color: var(--Colors-Text-Body-Strong) !important;
  font-weight: 500;
}

.dropdown-menu-item-content {
  display: flex;
  align-items: center;
  gap: var(--UI-Spacing-spacing-s);
  width: 100%;
}

.dropdown-menu-item-checkmark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  position: relative;
}

.dropdown-menu-item-checkmark svg {
  display: block;
  width: 16px;
  height: 16px;
  position: relative;
}

.dropdown-menu-item-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-container.grow-to-fit .dropdown-menu-item-label {
  overflow: visible;
  text-overflow: clip;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .dropdown-menu {
    width: 100%;
    min-width: 240px;
  }
}

