/**
 * Alves Finança Familiar — Seletor Customizado Estilizado (Design System PRD §23, §25, §26)
 * Desenvolvido por Juliano Alves
 */

.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  height: var(--touch-target-min);
  padding: 0 var(--space-md);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input, #181818);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  font-family: inherit;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.custom-select-trigger:hover {
  border-color: var(--border-strong);
}

.custom-select-trigger.active,
.custom-select-trigger:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 109, 17, 0.2);
  outline: none;
}

[data-theme="dark"] .custom-select-trigger.active,
[data-theme="dark"] .custom-select-trigger:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(200, 240, 79, 0.25);
}

.custom-select-trigger-content {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.custom-select-badge-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.custom-select-icon {
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.custom-select-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.custom-select-placeholder {
  font-size: 13px;
  color: var(--text-secondary);
}

.custom-select-chevron {
  font-size: 14px;
  color: var(--text-secondary);
  transition: transform 200ms ease;
}

.custom-select-wrapper.open .custom-select-chevron {
  transform: rotate(180deg);
}

/* Menu Dropdown Flutuante Sólido */
.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background-color: var(--bg-card, #181818);
  border: 1px solid var(--border-strong, #333333);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.35);
  z-index: 500;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  display: none;
  animation: customSelectFadeIn 150ms ease;
}

[data-theme="light"] .custom-select-dropdown {
  background-color: #FFFFFF;
  border-color: #D3D1C7;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
}

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

.custom-select-wrapper.open .custom-select-dropdown {
  display: block;
}

.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 120ms ease;
  user-select: none;
  background-color: transparent;
}

.custom-select-option:hover {
  background-color: var(--bg-card-hover, #202020);
}

[data-theme="light"] .custom-select-option:hover {
  background-color: #EBE8E0;
}

.custom-select-option.selected {
  background-color: rgba(59, 109, 17, 0.12);
}

[data-theme="dark"] .custom-select-option.selected {
  background-color: rgba(200, 240, 79, 0.18);
}

.custom-select-option-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.custom-select-option-info {
  display: flex;
  flex-direction: column;
}

.custom-select-option-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.custom-select-option.selected .custom-select-option-name {
  font-weight: 600;
  color: var(--accent);
}

.custom-select-option-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.custom-select-check {
  color: var(--accent);
  font-size: 16px;
  display: none;
}

.custom-select-option.selected .custom-select-check {
  display: block;
}
