.color-input-container {
  position: relative;
  margin-bottom: 1rem;
}

.color-label {
  position: absolute;
  top: -0.8rem;
  left: 0.5rem;
  background-color: var(--surface);
  padding: 0 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 900;
  z-index: 1;

  .required-indicator {
    color: var(--idt-danger);
    margin-left: 2px;
  }
}

.color-selection-wrapper {
  position: relative;
  width: 100%;
}

/* Color Select Button */
.color-select-button {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;

  &:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  &:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(241, 180, 13, 0.1);
  }

  &.open {
    border-color: var(--primary);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

.select-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.selected-display {
  display: flex;
  align-items: center;
  gap: 12px;
}

.selected-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--divider);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.selected-name {
  font-weight: 500;
  color: var(--text-primary);
}

.placeholder {
  color: var(--text-secondary);
  font-style: italic;
}

.dropdown-arrow {
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  font-size: 0.75rem;

  &.rotated {
    transform: rotate(180deg);
  }
}

/* Color Dropdown */
.color-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;

  &.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  padding: 16px;
}

.color-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;

  &:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
  }

  &.selected {
    border-color: var(--idt-primary-color);
    background: rgba(255, 200, 46, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(255, 200, 46, 0.3);
  }
}

.color-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--divider);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;

  .color-option:hover & {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  }

  .color-option.selected & {
    border-color: var(--idt-primary-color);
    transform: scale(1.05);
  }
}

.color-name {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dropdown Actions */
.dropdown-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--divider);
  background: var(--background);
}

.clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--idt-danger);
  background: transparent;
  color: var(--idt-danger);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8125rem;
  font-weight: 500;

  &:hover {
    background: var(--idt-danger);
    color: white;
  }

  &:active {
    transform: scale(0.98);
  }
}

/* Dropdown Overlay */
.dropdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: transparent;
}

/* Tema escuro */
:host-context(.dark-theme) {
  .color-label {
    background-color: var(--surface);
    color: var(--text-secondary);
  }

  .color-select-button {
    background: var(--surface);
    border-color: var(--divider);
    color: var(--text-primary);

    &:hover, &:focus {
      border-color: #FFC82E;
    }

    &.open {
      border-color: #FFC82E;
    }
  }

  .color-dropdown {
    background: var(--surface);
    border-color: #FFC82E;
  }

  .dropdown-actions {
    background: var(--background);
    border-color: var(--divider);
  }
}

/* Responsividade */
@media (max-width: 768px) {
  .color-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
  }

  .color-option {
    padding: 8px 4px;
    gap: 6px;
  }

  .color-circle {
    width: 28px;
    height: 28px;
  }

  .color-name {
    font-size: 0.6875rem;
  }

  .selected-color-display {
    padding: 10px 12px;
    gap: 8px;
  }

  .selected-circle {
    width: 20px;
    height: 20px;
  }

  .selected-name {
    font-size: 0.8125rem;
  }

  .selected-code {
    font-size: 0.6875rem;
  }

  .clear-btn {
    width: 20px;
    height: 20px;
    font-size: 0.6875rem;
  }
} 